Struct gimli::UninitializedUnwindContext
[−]
[src]
pub struct UninitializedUnwindContext<Section, R>(_)
where
R: Reader,
Section: UnwindSection<R>;
Common context needed when evaluating the call frame unwinding information.
To avoid re-allocating the context multiple times when evaluating multiple
CFI programs, it can be reused. At first, a context is uninitialized
(UninitializedUnwindContext
). It can be initialized by providing the
CommonInformationEntry
for the CFI program about to be evaluated and
calling UninitializedUnwindContext::initialize
. The result is an
InitializedUnwindContext
, which can be used to evaluate and run a
FrameDescriptionEntry
's CFI program. When the CFI program is complete, the
context can be de-initialized by calling InitializedUnwindContext::reset
.
use gimli::{UninitializedUnwindContext, UnwindTable}; // An uninitialized context. let ctx = UninitializedUnwindContext::new(); // Initialize the context by evaluating the CIE's initial instruction program. let mut ctx = ctx.initialize(some_fde.cie()).map_err(|(err, ctx)| { // Recover the uninitialized `ctx` to reuse it for future unwinding. recover(ctx); err })?; { // The initialized context can now be used to generate the unwind table. let mut table = UnwindTable::new(&mut ctx, &some_fde); while let Some(row) = table.next_row()? { // Do stuff with each row... } } // Reset the context to the uninitialized state and re-use it with other CFI // programs. let ctx = ctx.reset();
In general, the states will flow from one to the other in accordance to the following diagram:
+-------+
| Start |
+-------+
|
|
UninitializedUnwindContext::new()
|
|
V
+----------------------------+
| UninitializedUnwindContext |<---------------.
+----------------------------+ |
| |
| |
ctx.initialize(&cie) Use with UnwindTable,
| and then do ctx.reset()
| |
V |
+--------------------------+ |
| InitializedUnwindContext |-----------------'
+--------------------------+
|
|
Drop
|
|
V
+-----+
| End |
+-----+
Methods
impl<Section, R> UninitializedUnwindContext<Section, R> where
R: Reader,
Section: UnwindSection<R>,
[src]
R: Reader,
Section: UnwindSection<R>,
fn new() -> UninitializedUnwindContext<Section, R>
[src]
Construct a new call frame unwinding context.
impl<Section, R> UninitializedUnwindContext<Section, R> where
R: Reader,
Section: UnwindSection<R>,
[src]
R: Reader,
Section: UnwindSection<R>,
Signal Safe Methods
These methods are guaranteed not to allocate, acquire locks, or perform any other signal-unsafe operations.
fn initialize(
self,
cie: &CommonInformationEntry<Section, R, R::Offset>
) -> UnwindResult<InitializedUnwindContext<Section, R>, Self>
[src]
self,
cie: &CommonInformationEntry<Section, R, R::Offset>
) -> UnwindResult<InitializedUnwindContext<Section, R>, Self>
Run the CIE's initial instructions, creating an
InitializedUnwindContext
.
Trait Implementations
impl<Section: Clone, R: Clone> Clone for UninitializedUnwindContext<Section, R> where
R: Reader,
Section: UnwindSection<R>,
[src]
R: Reader,
Section: UnwindSection<R>,
fn clone(&self) -> UninitializedUnwindContext<Section, R>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<Section: Debug, R: Debug> Debug for UninitializedUnwindContext<Section, R> where
R: Reader,
Section: UnwindSection<R>,
[src]
R: Reader,
Section: UnwindSection<R>,
impl<Section, R> Default for UninitializedUnwindContext<Section, R> where
R: Reader,
Section: UnwindSection<R>,
[src]
R: Reader,
Section: UnwindSection<R>,