pub struct TimeTravel { /* private fields */ }Expand description
Time-travel debugger state.
Implementations§
Source§impl TimeTravel
impl TimeTravel
Sourcepub fn with_config(config: TimeTravelConfig) -> Self
pub fn with_config(config: TimeTravelConfig) -> Self
Create a new time-travel debugger with the given configuration.
Sourcepub fn new(mode: CaptureMode, max_entries: usize) -> Self
pub fn new(mode: CaptureMode, max_entries: usize) -> Self
Create a new time-travel debugger with the given capture mode and maximum history size.
This constructor preserves backward compatibility with the existing
VirtualMachine API.
Sourcepub fn should_capture(
&mut self,
ip: usize,
_instruction_count: u64,
is_call_or_return: bool,
) -> bool
pub fn should_capture( &mut self, ip: usize, _instruction_count: u64, is_call_or_return: bool, ) -> bool
Check whether a capture should happen at the current instruction.
Called from the dispatch loop. Returns true if a snapshot should
be captured at this point.
§Arguments
ip- current instruction pointerinstruction_count- total instructions executed so far (reserved)is_call_or_return- true if the current instruction is a Call/Return
Sourcepub fn on_function_entry(&mut self) -> bool
pub fn on_function_entry(&mut self) -> bool
Notify that a function was entered. Captures if in FunctionBoundaries mode.
Sourcepub fn on_function_exit(&mut self) -> bool
pub fn on_function_exit(&mut self) -> bool
Notify that a function was exited. Captures if in FunctionBoundaries mode.
Sourcepub fn record(
&mut self,
_snapshot: VmSnapshot,
ip: usize,
instruction_count: u64,
call_depth: usize,
) -> usize
pub fn record( &mut self, _snapshot: VmSnapshot, ip: usize, instruction_count: u64, call_depth: usize, ) -> usize
Record a shape_runtime::snapshot::VmSnapshot into the history.
This method wraps the runtime snapshot type used by dispatch.rs.
The snapshot is stored in the ring buffer alongside metadata.
Sourcepub fn snapshot_store(&mut self) -> Result<&SnapshotStore, String>
pub fn snapshot_store(&mut self) -> Result<&SnapshotStore, String>
Get the snapshot store, creating it lazily.
Used by dispatch.rs to obtain a SnapshotStore reference for
serializing VM state before recording.
Sourcepub fn capture(&mut self, snapshot: VmSnapshot)
pub fn capture(&mut self, snapshot: VmSnapshot)
Store a snapshot.
Sourcepub fn build_snapshot(
&self,
ip: usize,
sp: usize,
call_depth: usize,
function_id: Option<u16>,
function_name: Option<String>,
instruction_count: u64,
stack: &[ValueWord],
module_bindings: &[ValueWord],
reason: CaptureReason,
) -> VmSnapshot
pub fn build_snapshot( &self, ip: usize, sp: usize, call_depth: usize, function_id: Option<u16>, function_name: Option<String>, instruction_count: u64, stack: &[ValueWord], module_bindings: &[ValueWord], reason: CaptureReason, ) -> VmSnapshot
Build a snapshot from raw VM state.
Sourcepub fn step_back(&mut self) -> Option<&VmSnapshot>
pub fn step_back(&mut self) -> Option<&VmSnapshot>
Move to the previous snapshot. Returns the snapshot if available.
Sourcepub fn step_forward(&mut self) -> Option<&VmSnapshot>
pub fn step_forward(&mut self) -> Option<&VmSnapshot>
Move to the next snapshot. Returns the snapshot if available.
Sourcepub fn goto(&mut self, index: u64) -> Option<&VmSnapshot>
pub fn goto(&mut self, index: u64) -> Option<&VmSnapshot>
Jump to a specific snapshot index.
Sourcepub fn current(&self) -> Option<&VmSnapshot>
pub fn current(&self) -> Option<&VmSnapshot>
Get the current snapshot (at cursor position).
Sourcepub fn latest(&self) -> Option<&VmSnapshot>
pub fn latest(&self) -> Option<&VmSnapshot>
Get the most recent snapshot.
Sourcepub fn snapshot_count(&self) -> usize
pub fn snapshot_count(&self) -> usize
Number of captured snapshots.
Sourcepub fn cursor_position(&self) -> usize
pub fn cursor_position(&self) -> usize
Current cursor position.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether the debugger is actively capturing.
Sourcepub fn context_window(&self, radius: usize) -> Vec<&VmSnapshot>
pub fn context_window(&self, radius: usize) -> Vec<&VmSnapshot>
Get a range of snapshots around the cursor for display.
Auto Trait Implementations§
impl Freeze for TimeTravel
impl RefUnwindSafe for TimeTravel
impl Send for TimeTravel
impl Sync for TimeTravel
impl Unpin for TimeTravel
impl UnsafeUnpin for TimeTravel
impl UnwindSafe for TimeTravel
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more