Skip to main content

Module debugger

Module debugger 

Source
Expand description

Breakpoints and single stepping for program-image execution.

Use crate::ExecutionState<DebuggerState> as the machine’s program device and Debugger<u32, I> as a debugger device, where I is the machine’s runtime instruction type. Implement HasBreakpointInstruction for I. The debugger’s authored Step builds a BreakpointMessage, executes the debugger, and applies its Break effect to the execution state.

Call crate::Loadable::start to initialize an invocation, then crate::Loadable::resume_with_breaks with DebugAction::Continue or DebugAction::Step. A gutter breakpoint pauses before its displaced instruction; continuing or stepping executes that instruction once. An explicit breakpoint resumes at the following instruction. Ordinary crate::Loadable::resume leaves a breakpoint-suspended invocation untouched.

Breakpoint bookkeeping belongs to the patched image. After successful image replacement, or before reusing the machine with a different image, call Debugger::forget_breakpoints. To remove breakpoints while keeping the old image usable, restore its instructions with Debugger::clear_all instead. Invocation-only resets retain installed breakpoints.

Run the complete wiring, stepping, replacement, and reuse example with:

cargo run -p vihaco-stdlib --features program-image-execution --example debugger

Modules§

dialect

Structs§

Break
An effect that propagates a hit breakpoint.
BreakpointMessage
Identify the breakpoint being executed.
Debugger
A component that manages breakpoints.

Enums§

DebugAction
Select continuous execution or a single step.
DebuggerState
Debugger-specific execution suspension.
IsBreakpointInstalled
IsBreakpointToggled

Traits§

BreakpointPatchableProgram
HasBreakpointInstruction
This instruction set has a breakpoint instruction. Implement this for your component’s runtime instruction set to define how it can build a breakpoint instruction.

Functions§

resume_with_breaks
Continue or single-step execution through the selected debugger.