Trait gimli::UnwindSection
[−]
[src]
pub trait UnwindSection<'input, Endian>: Copy + Debug + Eq + _UnwindSectionPrivate<'input, Endian> where
Endian: Endianity, { type Offset: Copy + Debug + Eq + Into<usize> + From<usize>; fn offset(offset: usize) -> Self::Offset { ... } fn entries<'bases>(
&self,
bases: &'bases BaseAddresses
) -> CfiEntriesIter<'bases, 'input, Endian, Self> { ... } fn cie_from_offset<'bases>(
&self,
bases: &'bases BaseAddresses,
offset: Self::Offset
) -> Result<CommonInformationEntry<'input, Endian, Self>> { ... } fn unwind_info_for_address<'bases>(
&self,
bases: &'bases BaseAddresses,
ctx: UninitializedUnwindContext<'input, Endian, Self>,
address: u64
) -> Result<(UnwindTableRow<'input, Endian>, UninitializedUnwindContext<'input, Endian, Self>)> { ... } }
A section holding unwind information: either .debug_frame
or
.eh_frame
. See DebugFrame
and
EhFrame
respectively.
Associated Types
type Offset: Copy + Debug + Eq + Into<usize> + From<usize>
The offset type associated with this CFI section. Either
DebugFrameOffset
or EhFrameOffset
.
Provided Methods
fn offset(offset: usize) -> Self::Offset
Construct a Self::Offset
.
fn entries<'bases>(
&self,
bases: &'bases BaseAddresses
) -> CfiEntriesIter<'bases, 'input, Endian, Self>
&self,
bases: &'bases BaseAddresses
) -> CfiEntriesIter<'bases, 'input, Endian, Self>
Iterate over the CommonInformationEntry
s and FrameDescriptionEntry
s
in this .debug_frame
section.
Can be used with
FallibleIterator
.
fn cie_from_offset<'bases>(
&self,
bases: &'bases BaseAddresses,
offset: Self::Offset
) -> Result<CommonInformationEntry<'input, Endian, Self>>
&self,
bases: &'bases BaseAddresses,
offset: Self::Offset
) -> Result<CommonInformationEntry<'input, Endian, Self>>
Parse the CommonInformationEntry
at the given offset.
fn unwind_info_for_address<'bases>(
&self,
bases: &'bases BaseAddresses,
ctx: UninitializedUnwindContext<'input, Endian, Self>,
address: u64
) -> Result<(UnwindTableRow<'input, Endian>, UninitializedUnwindContext<'input, Endian, Self>)>
&self,
bases: &'bases BaseAddresses,
ctx: UninitializedUnwindContext<'input, Endian, Self>,
address: u64
) -> Result<(UnwindTableRow<'input, Endian>, UninitializedUnwindContext<'input, Endian, Self>)>
Find the frame unwind information for the given address.
If found, the unwind information is returned along with the reset
context in the form Ok((unwind_info, context))
. If not found,
Err(gimli::Error::NoUnwindInfoForAddress)
is returned. If parsing or
CFI evaluation fails, the error is returned.
use gimli::{BaseAddresses, EhFrame, NativeEndian, UninitializedUnwindContext, UnwindSection}; // Get the `.eh_frame` section from the object file. Alternatively, // use `EhFrame` with the `.eh_frame` section of the object file. let eh_frame = EhFrame::<NativeEndian>::new(read_eh_frame_section()); // Get the address of the PC for a frame you'd like to unwind. let address = get_frame_pc(); // This context is reusable, which cuts down on heap allocations. let ctx = UninitializedUnwindContext::new(); // Optionally provide base addresses for any relative pointers. If a // base address isn't provided and a pointer is found that is relative to // it, we will return an `Err`. let bases = BaseAddresses::default() .set_text(address_of_text_section_in_memory) .set_data(address_of_data_section_in_memory); let (unwind_info, ctx) = try!(eh_frame.unwind_info_for_address(&bases, ctx, address)); do_stuff_with(unwind_info);
Implementors
impl<'input, Endian> UnwindSection<'input, Endian> for DebugFrame<'input, Endian> where
Endian: Endianity,impl<'input, Endian> UnwindSection<'input, Endian> for EhFrame<'input, Endian> where
Endian: Endianity,