Skip to main content

Debugger

Struct Debugger 

Source
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

Source

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.

Source

pub fn step(&mut self)

Execute exactly one op (Step Into).

Source

pub fn step_over(&mut self)

Execute one op, but run any function it calls to completion (Step Over).

Source

pub fn step_out(&mut self)

Run until the current function returns (Step Out); from Main, runs to the end.

Source

pub fn resume(&mut self)

Run until the next breakpoint, a block, completion, or the step limit (Continue).

Source

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.

Source

pub fn step_back(&mut self)

Undo the last executed op — time-travel one step backwards.

Source

pub fn seek(&mut self, step: usize)

Jump the time-travel cursor to any already-explored step (the scrubber).

Source

pub fn restart(&mut self)

Rewind to the program entry, keeping the explored history (re-stepping is then instant) and the breakpoints.

Source

pub fn toggle_breakpoint(&mut self, pc: usize)

Toggle a breakpoint on a bytecode pc.

Source

pub fn set_breakpoint(&mut self, pc: usize)

Source

pub fn clear_breakpoint(&mut self, pc: usize)

Source

pub fn breakpoints(&self) -> Vec<usize>

Source

pub fn disassembly(&self) -> &[DisasmLine]

The full disassembly (the bytecode tape).

Source

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.

Source

pub fn snapshot(&self) -> DebugSnapshot

Build a serde snapshot of the current paused state for the UI.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,