Struct gimli::read::UnwindTable

source ·
pub struct UnwindTable<'a, 'ctx, R, S = StoreOnHeap>{
    code_alignment_factor: Wrapping<u64>,
    data_alignment_factor: Wrapping<i64>,
    address_size: u8,
    next_start_address: u64,
    last_end_address: u64,
    returned_last_row: bool,
    current_row_valid: bool,
    instructions: CallFrameInstructionIter<'a, R>,
    ctx: &'ctx mut UnwindContext<R::Offset, S>,
}
Expand description

The UnwindTable iteratively evaluates a FrameDescriptionEntry’s CallFrameInstruction program, yielding the each row one at a time.

6.4.1 Structure of Call Frame Information

DWARF supports virtual unwinding by defining an architecture independent basis for recording how procedures save and restore registers during their lifetimes. This basis must be augmented on some machines with specific information that is defined by an architecture specific ABI authoring committee, a hardware vendor, or a compiler producer. The body defining a specific augmentation is referred to below as the “augmenter.”

Abstractly, this mechanism describes a very large table that has the following structure:

LOCCFAR0R1...RN
L0
L1
...
LN

The first column indicates an address for every location that contains code in a program. (In shared objects, this is an object-relative offset.) The remaining columns contain virtual unwinding rules that are associated with the indicated location.

The CFA column defines the rule which computes the Canonical Frame Address value; it may be either a register and a signed offset that are added together, or a DWARF expression that is evaluated.

The remaining columns are labeled by register number. This includes some registers that have special designation on some architectures such as the PC and the stack pointer register. (The actual mapping of registers for a particular architecture is defined by the augmenter.) The register columns contain rules that describe whether a given register has been saved and the rule to find the value for the register in the previous frame.

This table would be extremely large if actually constructed as described. Most of the entries at any point in the table are identical to the ones above them. The whole table can be represented quite compactly by recording just the differences starting at the beginning address of each subroutine in the program.

Fields§

§code_alignment_factor: Wrapping<u64>§data_alignment_factor: Wrapping<i64>§address_size: u8§next_start_address: u64§last_end_address: u64§returned_last_row: bool§current_row_valid: bool§instructions: CallFrameInstructionIter<'a, R>§ctx: &'ctx mut UnwindContext<R::Offset, S>

Implementations§

source§

impl<'a, 'ctx, R, S> UnwindTable<'a, 'ctx, R, S>

§Signal Safe Methods

These methods are guaranteed not to allocate, acquire locks, or perform any other signal-unsafe operations.

source

pub fn new<Section: UnwindSection<R>>( section: &'a Section, bases: &'a BaseAddresses, ctx: &'ctx mut UnwindContext<R::Offset, S>, fde: &FrameDescriptionEntry<R>, ) -> Result<Self>

Construct a new UnwindTable for the given FrameDescriptionEntry’s CFI unwinding program.

source

fn new_for_fde<Section: UnwindSection<R>>( section: &'a Section, bases: &'a BaseAddresses, ctx: &'ctx mut UnwindContext<R::Offset, S>, fde: &FrameDescriptionEntry<R>, ) -> Self

source

fn new_for_cie<Section: UnwindSection<R>>( section: &'a Section, bases: &'a BaseAddresses, ctx: &'ctx mut UnwindContext<R::Offset, S>, cie: &CommonInformationEntry<R>, ) -> Self

source

pub fn next_row(&mut self) -> Result<Option<&UnwindTableRow<R::Offset, S>>>

Evaluate call frame instructions until the next row of the table is completed, and return it.

Unfortunately, this cannot be used with FallibleIterator because of the restricted lifetime of the yielded item.

source

pub fn into_current_row(self) -> Option<&'ctx UnwindTableRow<R::Offset, S>>

Returns the current row with the lifetime of the context.

source

fn evaluate( &mut self, instruction: CallFrameInstruction<R::Offset>, ) -> Result<bool>

Evaluate one call frame instruction. Return Ok(true) if the row is complete, Ok(false) otherwise.

Trait Implementations§

source§

impl<'a, 'ctx, R, S> Debug for UnwindTable<'a, 'ctx, R, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'ctx, R, S> Freeze for UnwindTable<'a, 'ctx, R, S>
where R: Freeze,

§

impl<'a, 'ctx, R, S> RefUnwindSafe for UnwindTable<'a, 'ctx, R, S>

§

impl<'a, 'ctx, R, S> Send for UnwindTable<'a, 'ctx, R, S>
where R: Send + Sync, <<S as UnwindContextStorage<<R as Reader>::Offset>>::Stack as Sealed>::Storage: Send, <R as Reader>::Offset: Send,

§

impl<'a, 'ctx, R, S> Sync for UnwindTable<'a, 'ctx, R, S>
where R: Sync, <<S as UnwindContextStorage<<R as Reader>::Offset>>::Stack as Sealed>::Storage: Sync, <R as Reader>::Offset: Sync,

§

impl<'a, 'ctx, R, S> Unpin for UnwindTable<'a, 'ctx, R, S>
where R: Unpin,

§

impl<'a, 'ctx, R, S = StoreOnHeap> !UnwindSafe for UnwindTable<'a, 'ctx, R, S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.