[][src]Struct symbolic_common::InstructionInfo

pub struct InstructionInfo {
    pub addr: u64,
    pub arch: Arch,
    pub crashing_frame: bool,
    pub signal: Option<u32>,
    pub ip_reg: Option<u64>,
}

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

impl InstructionInfo[src]

pub fn aligned_address(&self) -> u64[src]

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.

pub fn previous_address(&self) -> u64[src]

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.

pub fn is_crash_signal(&self) -> bool[src]

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.

pub fn should_adjust_caller(&self) -> bool[src]

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.

pub fn caller_address(&self) -> u64[src]

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.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.