pub struct Instruction {
pub offset: u64,
/* private fields */
}Expand description
One instruction of a program and what the compiler says about it.
It reads and writes as an ETHDebug program lists it: its offset, an operation
naming the mnemonic, and a context. A legacy source map says the same few things
about every instruction, so one made from a source map holds them as plain values
(see Instruction::from_source_map) rather than as the JSON objects they stand
for, which cost a dozen allocations an instruction to build, read, and drop.
Fields§
§offset: u64Implementations§
Source§impl Instruction
impl Instruction
Sourcepub fn new(offset: u64, mnemonic: &str, context: Option<Value>) -> Self
pub fn new(offset: u64, mnemonic: &str, context: Option<Value>) -> Self
An instruction at program counter offset that runs mnemonic, with its ETHDebug
context, if any.
Sourcepub fn from_source_map(
offset: u64,
mnemonic: impl Into<Cow<'static, str>>,
context: SourceMapContext,
) -> Self
pub fn from_source_map( offset: u64, mnemonic: impl Into<Cow<'static, str>>, context: SourceMapContext, ) -> Self
An instruction at program counter offset that runs mnemonic, as a legacy
source map describes it.
pub fn mnemonic(&self) -> Option<&str>
pub fn arguments(&self) -> Vec<&str>
pub fn source_location(&self) -> Option<SourceLocation>
Sourcepub fn source_locations(&self) -> Vec<SourceLocation>
pub fn source_locations(&self) -> Vec<SourceLocation>
Returns every source alternative attached to this instruction.
Sourcepub fn function_invocations(&self) -> Vec<FunctionIdentity>
pub fn function_invocations(&self) -> Vec<FunctionIdentity>
Returns every possible function invocation attached to this instruction.
Sourcepub fn function_exit(&self) -> Option<FunctionExit>
pub fn function_exit(&self) -> Option<FunctionExit>
Returns the function exit attached to this instruction.
Sourcepub fn modifier_depth(&self) -> Option<i64>
pub fn modifier_depth(&self) -> Option<i64>
Legacy source-map modifier depth, when this instruction was adapted from one.