Struct gimli::read::cfi::UnwindContext

source ·
pub struct UnwindContext<R: Reader, A: UnwindContextStorage<R> = StoreOnHeap> {
    stack: ArrayVec<A::Stack>,
    initial_rule: Option<(Register, RegisterRule<R>)>,
    is_initialized: bool,
}
Expand description

Common context needed when evaluating the call frame unwinding information.

This structure can be large so it is advisable to place it on the heap. To avoid re-allocating the context multiple times when evaluating multiple CFI programs, it can be reused.

use gimli::{UnwindContext, UnwindTable};

// An uninitialized context.
let mut ctx = Box::new(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<A::Stack>§initial_rule: Option<(Register, RegisterRule<R>)>§is_initialized: bool

Implementations§

source§

impl<R: Reader> UnwindContext<R>

source

pub fn new() -> Self

Construct a new call frame unwinding context.

source§

impl<R: Reader, A: UnwindContextStorage<R>> UnwindContext<R, A>

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.

source

pub fn new_in() -> Self

Construct a new call frame unwinding context.

source

fn initialize<Section: UnwindSection<R>>( &mut self, section: &Section, bases: &BaseAddresses, cie: &CommonInformationEntry<R> ) -> Result<()>

Run the CIE’s initial instructions and initialize this UnwindContext.

source

fn reset(&mut self)

source

fn row(&self) -> &UnwindTableRow<R, A>

source

fn row_mut(&mut self) -> &mut UnwindTableRow<R, A>

source

fn save_initial_rules(&mut self) -> Result<()>

source

fn start_address(&self) -> u64

source

fn set_start_address(&mut self, start_address: u64)

source

fn set_register_rule( &mut self, register: Register, rule: RegisterRule<R> ) -> Result<()>

source

fn get_initial_rule(&self, register: Register) -> Option<RegisterRule<R>>

Returns None if we have not completed evaluation of a CIE’s initial instructions.

source

fn set_cfa(&mut self, cfa: CfaRule<R>)

source

fn cfa_mut(&mut self) -> &mut CfaRule<R>

source

fn push_row(&mut self) -> Result<()>

source

fn pop_row(&mut self) -> Result<()>

Trait Implementations§

source§

impl<R: Clone + Reader, A: Clone + UnwindContextStorage<R>> Clone for UnwindContext<R, A>where A::Stack: Clone,

source§

fn clone(&self) -> UnwindContext<R, A>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<R: Reader, S: UnwindContextStorage<R>> Debug for UnwindContext<R, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<R: Reader, A: UnwindContextStorage<R>> Default for UnwindContext<R, A>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<R: PartialEq + Reader, A: PartialEq + UnwindContextStorage<R>> PartialEq<UnwindContext<R, A>> for UnwindContext<R, A>where A::Stack: PartialEq,

source§

fn eq(&self, other: &UnwindContext<R, A>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<R: Eq + Reader, A: Eq + UnwindContextStorage<R>> Eq for UnwindContext<R, A>where A::Stack: Eq,

source§

impl<R: Reader, A: UnwindContextStorage<R>> StructuralEq for UnwindContext<R, A>

source§

impl<R: Reader, A: UnwindContextStorage<R>> StructuralPartialEq for UnwindContext<R, A>

Auto Trait Implementations§

§

impl<R, A> RefUnwindSafe for UnwindContext<R, A>where R: RefUnwindSafe, <<A as UnwindContextStorage<R>>::Stack as Sealed>::Storage: RefUnwindSafe,

§

impl<R, A> Send for UnwindContext<R, A>where R: Send, <<A as UnwindContextStorage<R>>::Stack as Sealed>::Storage: Send,

§

impl<R, A> Sync for UnwindContext<R, A>where R: Sync, <<A as UnwindContextStorage<R>>::Stack as Sealed>::Storage: Sync,

§

impl<R, A> Unpin for UnwindContext<R, A>where R: Unpin, <<A as UnwindContextStorage<R>>::Stack as Sealed>::Storage: Unpin,

§

impl<R, A> UnwindSafe for UnwindContext<R, A>where R: UnwindSafe, <<A as UnwindContextStorage<R>>::Stack as Sealed>::Storage: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.