pub struct DebuggerState {
pub current_step: usize,
pub display_mode: DisplayMode,
/* private fields */
}Fields§
§current_step: usize§display_mode: DisplayModeImplementations§
Source§impl DebuggerState
impl DebuggerState
pub fn new() -> Self
Sourcepub fn load_trace(&mut self, trace: TransactionTrace)
pub fn load_trace(&mut self, trace: TransactionTrace)
Loads a trace and maps its call structure. Source lines arrive with
DebuggerState::attach_debug_info; until then stepping is by instruction.
Sourcepub fn attach_debug_info(&mut self, contracts: Vec<ContractDebugInfo>)
pub fn attach_debug_info(&mut self, contracts: Vec<ContractDebugInfo>)
Maps every step through the contracts’ debug info, enabling source-level stepping, line and function breakpoints, and source locations in frames.
Sourcepub fn storage_words(&self) -> Option<StorageWords<'_>>
pub fn storage_words(&self) -> Option<StorageWords<'_>>
The storage words known at the current step, in the storage context it runs in.
Sourcepub fn storage_words_with_chain<'a>(
&'a self,
chain: Option<&'a dyn ChainStorage>,
) -> Option<StorageWords<'a>>
pub fn storage_words_with_chain<'a>( &'a self, chain: Option<&'a dyn ChainStorage>, ) -> Option<StorageWords<'a>>
The same words, with a chain the frontend can read slots the transaction never touched from.
Sourcepub fn storage_address(&self) -> Option<&str>
pub fn storage_address(&self) -> Option<&str>
The account whose storage the current step reads and writes.
Sourcepub fn storage_layout(&self) -> Option<&StorageLayout>
pub fn storage_layout(&self) -> Option<&StorageLayout>
The storage layout of the contract executing at the current step, when it was compiled with one.
pub fn trace(&self) -> Option<&TransactionTrace>
pub fn step_map(&self) -> Option<&StepMap>
Sourcepub fn has_source(&self) -> bool
pub fn has_source(&self) -> bool
Whether any step maps to a source line, which is what source-level stepping needs.
pub fn current_step_data(&self) -> Option<&TraceStep>
Sourcepub fn location(&self) -> Option<StepLocation>
pub fn location(&self) -> Option<StepLocation>
The source location of the current step, when it has one.
pub fn step_count(&self) -> usize
pub fn breakpoints(&self) -> &[Breakpoint]
pub fn set_display_mode(&mut self, mode: DisplayMode) -> StepOutcome
pub fn next_instruction(&mut self) -> StepOutcome
Sourcepub fn next_source(&mut self) -> StepOutcome
pub fn next_source(&mut self) -> StepOutcome
Moves to the start of the next source line in this frame or a caller’s, stopping early at a breakpoint in code it steps over. Without source information this is one instruction.
Sourcepub fn step_into(&mut self) -> StepOutcome
pub fn step_into(&mut self) -> StepOutcome
Moves to the start of the next source line anywhere, entering calls.
Sourcepub fn finish(&mut self) -> StepOutcome
pub fn finish(&mut self) -> StepOutcome
Runs until the current frame has returned to its caller, or to the end of the recording when there is no caller.
pub fn continue_execution(&mut self) -> StepOutcome
Sourcepub fn previous_instruction(&mut self) -> StepOutcome
pub fn previous_instruction(&mut self) -> StepOutcome
Steps back one instruction. The trace is a complete recording, so moving backward is as cheap and exact as moving forward.
Sourcepub fn previous_source(&mut self) -> StepOutcome
pub fn previous_source(&mut self) -> StepOutcome
Moves back to the start of the previous source line in this frame or a caller’s, skipping over calls it made and stopping at a breakpoint on the way.
Sourcepub fn reverse_step_into(&mut self) -> StepOutcome
pub fn reverse_step_into(&mut self) -> StepOutcome
Moves back to the start of the previous source line anywhere, entering calls.
Sourcepub fn reverse_finish(&mut self) -> StepOutcome
pub fn reverse_finish(&mut self) -> StepOutcome
Runs backward to the step in the caller that entered the current frame, or to the first step when there is no caller.
Sourcepub fn reverse_continue(&mut self) -> StepOutcome
pub fn reverse_continue(&mut self) -> StepOutcome
Runs backward to the nearest earlier breakpoint, or to the first step.
pub fn goto_step(&mut self, step: usize) -> StepOutcome
Sourcepub fn set_breakpoint(&mut self, pc: u64) -> StepOutcome
pub fn set_breakpoint(&mut self, pc: u64) -> StepOutcome
Sets a breakpoint on a program counter.
Sourcepub fn clear_breakpoint(&mut self, pc: u64) -> StepOutcome
pub fn clear_breakpoint(&mut self, pc: u64) -> StepOutcome
Clears the breakpoint on a program counter.
Sourcepub fn set_breakpoint_target(
&mut self,
target: &BreakpointTarget,
) -> StepOutcome
pub fn set_breakpoint_target( &mut self, target: &BreakpointTarget, ) -> StepOutcome
Resolves a target against the trace and its debug info and sets a breakpoint on it.
Sourcepub fn set_conditional_breakpoint_target(
&mut self,
target: &BreakpointTarget,
condition: Option<&str>,
) -> StepOutcome
pub fn set_conditional_breakpoint_target( &mut self, target: &BreakpointTarget, condition: Option<&str>, ) -> StepOutcome
Sets a breakpoint that only stops when condition holds there.
Sourcepub fn clear_breakpoint_target(
&mut self,
target: &BreakpointTarget,
) -> StepOutcome
pub fn clear_breakpoint_target( &mut self, target: &BreakpointTarget, ) -> StepOutcome
Clears the breakpoint that target resolves to.
Sourcepub fn delete_breakpoint(&mut self, id: u32) -> StepOutcome
pub fn delete_breakpoint(&mut self, id: u32) -> StepOutcome
Removes a breakpoint by its number.
Sourcepub fn breakpoint_hit(&self, step: usize) -> Option<Breakpoint>
pub fn breakpoint_hit(&self, step: usize) -> Option<Breakpoint>
The first breakpoint that step triggers.
Sourcepub fn evaluate_condition(
&self,
condition: &Condition,
step: usize,
) -> Evaluation
pub fn evaluate_condition( &self, condition: &Condition, step: usize, ) -> Evaluation
Evaluates a breakpoint condition at step.
A condition that cannot be read there — an untouched slot, an unknown name — does
not stop, and the reason is kept for DebuggerState::take_note.
Sourcepub fn take_note(&self) -> Option<String>
pub fn take_note(&self) -> Option<String>
Takes what the frontend should tell the user since the last call: a breakpoint that cannot be hit, or a condition that could not be evaluated.
Sourcepub fn frames_at(&self, step: usize) -> Vec<Frame>
pub fn frames_at(&self, step: usize) -> Vec<Frame>
The call structure at any step, with each frame’s arguments.
Sourcepub fn frames(&self) -> Vec<Frame>
pub fn frames(&self) -> Vec<Frame>
The call structure at the current step, innermost frame first.
Sourcepub fn source_listing(&self, radius: u64) -> Option<SourceListing>
pub fn source_listing(&self, radius: u64) -> Option<SourceListing>
Source lines around the current step.
Sourcepub fn current_call(&self) -> Option<&ExecutionCall>
pub fn current_call(&self) -> Option<&ExecutionCall>
The innermost recorded call that contains the current step, when the backend recorded calls.
Sourcepub fn calldata(&self) -> Option<String>
pub fn calldata(&self) -> Option<String>
The calldata the current frame was called with: the transaction’s input at the root, the recorded call’s input in a nested frame, or nothing when the backend did not record calls.
pub fn apply_command(&mut self, command: DebuggerCommand) -> Option<StepOutcome>
Trait Implementations§
Source§impl Clone for DebuggerState
impl Clone for DebuggerState
Source§fn clone(&self) -> DebuggerState
fn clone(&self) -> DebuggerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DebuggerState
impl Debug for DebuggerState
Source§impl Default for DebuggerState
impl Default for DebuggerState
impl Eq for DebuggerState
Source§impl PartialEq for DebuggerState
impl PartialEq for DebuggerState
impl StructuralPartialEq for DebuggerState
Auto Trait Implementations§
impl !Freeze for DebuggerState
impl !RefUnwindSafe for DebuggerState
impl !Sync for DebuggerState
impl Send for DebuggerState
impl Unpin for DebuggerState
impl UnsafeUnpin for DebuggerState
impl UnwindSafe for DebuggerState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.