Struct symbolic_symcache::InstructionInfo
source · pub struct InstructionInfo {
pub addr: u64,
pub arch: Arch,
pub crashing_frame: bool,
pub signal: Option<u32>,
pub ip_reg: Option<u64>,
}
Expand description
Helper to work with instruction addresses.
The most useful function is InstructionInfo::caller_address
which applies
some heuristics to determine the call site of a function call based on the
return address. See InstructionInfo::caller_address
for more information.
See https://goo.gl/g17EAn for detailed information on this topic.
Fields
addr: u64
The address of the instruction we want to use as a base.
arch: Arch
The architecture we are dealing with.
crashing_frame: bool
This is true if the frame is the cause of the crash.
signal: Option<u32>
If a signal is known that triggers the crash, it can be stored here.
ip_reg: Option<u64>
The optional value of the IP register.
Implementations
sourceimpl InstructionInfo
impl InstructionInfo
sourcepub fn aligned_address(&self) -> u64
pub fn aligned_address(&self) -> u64
Tries to resolve the start address of the current instruction.
For architectures without fixed alignment (such as Intel with variable instruction lengths), this will return the same address. Otherwise, the address is aligned to the architecture’s instruction alignment.
sourcepub fn previous_address(&self) -> u64
pub fn previous_address(&self) -> u64
Return the previous instruction to the current one if we can determine this for the current architecture. Returns the instruction preceding the current one.
For known architectures, this will return the start address of the instruction immediately before the current one in the machine code. This is likely the instruction that was just executed or that called a function returning at the current address.
For unknown architectures or those using variable instruction size, the exact start address cannot be determined. Instead, an address within the preceding instruction will be returned. For this reason, the return value of this function should be considered an upper bound.
sourcepub fn is_crash_signal(&self) -> bool
pub fn is_crash_signal(&self) -> bool
Returns whether the application attempted to jump to an invalid, privileged or misaligned address. This indicates, that certain adjustments should be made on the caller instruction address.
sourcepub fn should_adjust_caller(&self) -> bool
pub fn should_adjust_caller(&self) -> bool
Determines whether the given address should be adjusted to resolve the call site of a stack frame.
This generally applies to all frames except the crashing / suspended frame. However, if the process crashed with an illegal instruction, even the top-most frame needs to be adjusted to account for the signal handler.
sourcepub fn caller_address(&self) -> u64
pub fn caller_address(&self) -> u64
Determines the address of the call site based on a return address.
In the top most frame (often referred to as context frame), this is the value of the instruction pointer register. In all other frames, the return address is generally one instruction after the jump / call.
This function actually resolves an address within the call instruction rather than its beginning. Also, in some cases the top most frame has been modified by certain signal handlers or return optimizations. A set of heuristics tries to recover this for well-known cases.