Struct gimli::read::UnwindContext
source · pub struct UnwindContext<T, S = StoreOnHeap>where
T: ReaderOffset,
S: UnwindContextStorage<T>,{
stack: ArrayVec<S::Stack>,
initial_rule: Option<(Register, RegisterRule<T>)>,
is_initialized: bool,
}
Expand description
Common context needed when evaluating the call frame unwinding information.
By default, this structure is small and allocates its internal storage
on the heap using Box
during UnwindContext::new
.
This can be overridden by providing a custom UnwindContextStorage
type parameter.
When using a custom storage with in-line arrays, the UnwindContext
type itself
will be big, so in that case it’s recommended to place UnwindContext
on the
heap, e.g. using Box::new(UnwindContext::<R, MyCustomStorage>::new_in())
.
To avoid re-allocating the context multiple times when evaluating multiple
CFI programs, the same UnwindContext
can be reused for multiple unwinds.
use gimli::{UnwindContext, UnwindTable};
// An uninitialized context.
let mut ctx = UnwindContext::new();
// 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...
}
Fields§
§stack: ArrayVec<S::Stack>
§initial_rule: Option<(Register, RegisterRule<T>)>
§is_initialized: bool
Implementations§
source§impl<T: ReaderOffset> UnwindContext<T>
impl<T: ReaderOffset> UnwindContext<T>
source§impl<T, S> UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
impl<T, S> UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
§Signal Safe Methods
These methods are guaranteed not to allocate, acquire locks, or perform any other signal-unsafe operations, if an non-allocating storage is used.
sourcefn initialize<Section, R>(
&mut self,
section: &Section,
bases: &BaseAddresses,
cie: &CommonInformationEntry<R>,
) -> Result<()>where
R: Reader<Offset = T>,
Section: UnwindSection<R>,
fn initialize<Section, R>(
&mut self,
section: &Section,
bases: &BaseAddresses,
cie: &CommonInformationEntry<R>,
) -> Result<()>where
R: Reader<Offset = T>,
Section: UnwindSection<R>,
Run the CIE’s initial instructions and initialize this UnwindContext
.
fn reset(&mut self)
fn row(&self) -> &UnwindTableRow<T, S>
fn row_mut(&mut self) -> &mut UnwindTableRow<T, S>
fn save_initial_rules(&mut self) -> Result<()>
fn start_address(&self) -> u64
fn set_start_address(&mut self, start_address: u64)
fn set_register_rule( &mut self, register: Register, rule: RegisterRule<T>, ) -> Result<()>
sourcefn get_initial_rule(&self, register: Register) -> Option<RegisterRule<T>>
fn get_initial_rule(&self, register: Register) -> Option<RegisterRule<T>>
Returns None
if we have not completed evaluation of a CIE’s initial
instructions.
fn set_cfa(&mut self, cfa: CfaRule<T>)
fn cfa_mut(&mut self) -> &mut CfaRule<T>
fn push_row(&mut self) -> Result<()>
fn pop_row(&mut self) -> Result<()>
Trait Implementations§
source§impl<T, S> Clone for UnwindContext<T, S>
impl<T, S> Clone for UnwindContext<T, S>
source§fn clone(&self) -> UnwindContext<T, S>
fn clone(&self) -> UnwindContext<T, S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<T, S> Debug for UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
impl<T, S> Debug for UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
source§impl<T, S> Default for UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
impl<T, S> Default for UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
source§impl<T, S> PartialEq for UnwindContext<T, S>
impl<T, S> PartialEq for UnwindContext<T, S>
impl<T, S> Eq for UnwindContext<T, S>
impl<T, S> StructuralPartialEq for UnwindContext<T, S>where
T: ReaderOffset,
S: UnwindContextStorage<T>,
Auto Trait Implementations§
impl<T, S> Freeze for UnwindContext<T, S>
impl<T, S> RefUnwindSafe for UnwindContext<T, S>
impl<T, S> Send for UnwindContext<T, S>
impl<T, S> Sync for UnwindContext<T, S>
impl<T, S> Unpin for UnwindContext<T, S>
impl<T, S> UnwindSafe for UnwindContext<T, S>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)