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 = try!(ctx.initialize(some_fde.cie()));

{
    // 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) = try!(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]

Construct a new call frame unwinding context.

impl<Section, R> UninitializedUnwindContext<Section, R> where
    R: Reader,
    Section: UnwindSection<R>, 
[src]

Signal Safe Methods

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

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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Section: Debug, R: Debug> Debug for UninitializedUnwindContext<Section, R> where
    R: Reader,
    Section: UnwindSection<R>, 
[src]

Formats the value using the given formatter.

impl<Section, R> Default for UninitializedUnwindContext<Section, R> where
    R: Reader,
    Section: UnwindSection<R>, 
[src]

Returns the "default value" for a type. Read more