Trait gimli::read::UnwindContextStorage
source · pub trait UnwindContextStorage<R: Reader>: Sized {
type Rules: ArrayLike<Item = (Register, RegisterRule<R>)>;
type Stack: ArrayLike<Item = UnwindTableRow<R, Self>>;
}
Expand description
Specification of what storage should be used for UnwindContext
.
Normally you would only need to use StoreOnHeap
, which places the stack
on the heap using Vec
. This is the default storage type parameter for UnwindContext
.
If you need to avoid UnwindContext
from allocating memory, e.g. for signal safety,
you can provide you own storage specification:
struct StoreOnStack;
impl<R: Reader> UnwindContextStorage<R> for StoreOnStack {
type Rules = [(Register, RegisterRule<R>); 192];
type Stack = [UnwindTableRow<R, 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§
sourcetype Rules: ArrayLike<Item = (Register, RegisterRule<R>)>
type Rules: ArrayLike<Item = (Register, RegisterRule<R>)>
The storage used for register rules in a unwind table row.
Note that this is nested within the stack.
sourcetype Stack: ArrayLike<Item = UnwindTableRow<R, Self>>
type Stack: ArrayLike<Item = UnwindTableRow<R, Self>>
The storage used for unwind table row stack.
Object Safety§
This trait is not object safe.