Trait gimli::read::UnwindContextStorage

source ·
pub trait UnwindContextStorage<T: ReaderOffset>: Sized {
    type Rules: ArrayLike<Item = (Register, RegisterRule<T>)>;
    type Stack: ArrayLike<Item = UnwindTableRow<T, Self>>;
}
Expand description

Specification of what storage should be used for UnwindContext.

Here’s an implementation which uses a fixed-size stack and allocates everything in-line, which will cause UnwindContext to be large:

struct StoreOnStack;

impl<T: ReaderOffset> UnwindContextStorage<T> for StoreOnStack {
    type Rules = [(Register, RegisterRule<T>); 192];
    type Stack = [UnwindTableRow<T, Self>; 4];
}

let mut ctx = UnwindContext::<_, StoreOnStack>::new_in();

// Initialize the context by evaluating the CIE's initial instruction program,
// and generate the unwind table.
let mut table = some_fde.rows(&eh_frame, &bases, &mut ctx)?;
while let Some(row) = table.next_row()? {
    // Do stuff with each row...
}

Required Associated Types§

source

type Rules: ArrayLike<Item = (Register, RegisterRule<T>)>

The storage used for register rules in a unwind table row.

Note that this is nested within the stack.

source

type Stack: ArrayLike<Item = UnwindTableRow<T, Self>>

The storage used for unwind table row stack.

Object Safety§

This trait is not object safe.

Implementors§