pub struct Debugger { /* private fields */ }Expand description
A self-contained stepping debugger over one compiled program.
Execution is deterministic, so history is the single execution prefix explored
so far and cursor is simply where you are looking. Step / step-back / seek /
restart all just move the cursor; a new VM op is only ever computed when the
cursor reaches the unexplored frontier. That makes step-back, restart, redo, and
the time-travel scrubber instant, and reverse-continue a pure cursor walk.
Implementations§
Source§impl Debugger
impl Debugger
Sourcepub fn from_source(src: &str) -> Result<Debugger, String>
pub fn from_source(src: &str) -> Result<Debugger, String>
Compile src (exactly as the Studio “Run” path does) and arm a debugger at
the program’s entry. The program is debugged on the bytecode tier with no
JIT, so stepping is per-op and output matches a normal run.
Sourcepub fn step_over(&mut self)
pub fn step_over(&mut self)
Execute one op, but run any function it calls to completion (Step Over).
Sourcepub fn step_out(&mut self)
pub fn step_out(&mut self)
Run until the current function returns (Step Out); from Main, runs to the end.
Sourcepub fn resume(&mut self)
pub fn resume(&mut self)
Run until the next breakpoint, a block, completion, or the step limit (Continue).
Sourcepub fn reverse_resume(&mut self)
pub fn reverse_resume(&mut self)
Run BACKWARD to the previous breakpoint, or the program entry — reverse continue. Pure cursor motion over the recorded history, a time-travel feature almost no debugger has.
Sourcepub fn seek(&mut self, step: usize)
pub fn seek(&mut self, step: usize)
Jump the time-travel cursor to any already-explored step (the scrubber).
Sourcepub fn restart(&mut self)
pub fn restart(&mut self)
Rewind to the program entry, keeping the explored history (re-stepping is then instant) and the breakpoints.
Sourcepub fn toggle_breakpoint(&mut self, pc: usize)
pub fn toggle_breakpoint(&mut self, pc: usize)
Toggle a breakpoint on a bytecode pc.
pub fn set_breakpoint(&mut self, pc: usize)
pub fn clear_breakpoint(&mut self, pc: usize)
pub fn breakpoints(&self) -> Vec<usize>
Sourcepub fn disassembly(&self) -> &[DisasmLine]
pub fn disassembly(&self) -> &[DisasmLine]
The full disassembly (the bytecode tape).
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the program is still paused mid-execution at the current cursor (cheap,
no snapshot build). false once it has finished, blocked, or errored here.
Sourcepub fn snapshot(&self) -> DebugSnapshot
pub fn snapshot(&self) -> DebugSnapshot
Build a serde snapshot of the current paused state for the UI.
Sourcepub fn variable_timeline(&self) -> VarTimeline
pub fn variable_timeline(&self) -> VarTimeline
The variable oscilloscope: every Main-frame variable’s value across the
recorded execution, with a playhead at the cursor. On-demand (only the Timeline
tab calls it), tail-windowed to the most recent [TIMELINE_MAX_STEPS] steps so
a long loop stays cheap and viewable.
Sourcepub fn observed_invariants(&self) -> Vec<VarInsight>
pub fn observed_invariants(&self) -> Vec<VarInsight>
Observed invariants (Daikon-style dynamic detection): for each variable, reduce its recorded trace into the facts that held over this run — constant, monotonic, value range, distinct count. Dynamic, not a static proof (the formally-proven counterpart comes from the Oracle), but exact for what happened.
Sourcepub fn proven_invariants(&self) -> Vec<ProvenInsight>
pub fn proven_invariants(&self) -> Vec<ProvenInsight>
Proven invariants: the Oracle’s statically-verified facts per variable
(range, non-negativity, scalar type) — guarantees that hold on every run, not
just this one. The formal companion to Debugger::observed_invariants. Only
variables with at least one non-trivial proven fact are returned, sorted by name.
Sourcepub fn assert_at_cursor(&self, predicate: &str) -> AssertionResult
pub fn assert_at_cursor(&self, predicate: &str) -> AssertionResult
Live proof at a breakpoint: assert a comparison predicate (x < y, x >= 0,
sum == 13) and get both lenses — whether it holds now (concretely, from the
live values) and whether it is proven for every run (from the Oracle’s proven
ranges, by sound interval entailment; pure Rust, no Z3). The dual answer is the
point: a thing can be true now yet unproven in general, or proven yet about a value
not yet reached.
Sourcepub fn provenance(&self, reg: u16) -> Option<CausalNode>
pub fn provenance(&self, reg: u16) -> Option<CausalNode>
Causal provenance: trace the value currently in innermost-frame register
reg back to the exact op that produced it, and recursively the ops that
produced that op’s inputs — the precise answer to “why is this value here?”.
Returns None only if the register holds nothing at the cursor.
Auto Trait Implementations§
impl Freeze for Debugger
impl !RefUnwindSafe for Debugger
impl !Send for Debugger
impl !Sync for Debugger
impl Unpin for Debugger
impl UnsafeUnpin for Debugger
impl !UnwindSafe for Debugger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.