Struct gimli::read::EhHdrTable
source · pub struct EhHdrTable<'a, R: Reader> { /* private fields */ }
Expand description
The CFI binary search table that is an optional part of the .eh_frame_hdr
section.
Implementations§
source§impl<'a, R: Reader + 'a> EhHdrTable<'a, R>
impl<'a, R: Reader + 'a> EhHdrTable<'a, R>
sourcepub fn iter<'bases>(
&self,
bases: &'bases BaseAddresses,
) -> EhHdrTableIter<'_, 'bases, R>
pub fn iter<'bases>( &self, bases: &'bases BaseAddresses, ) -> EhHdrTableIter<'_, 'bases, R>
Return an iterator that can walk the .eh_frame_hdr
table.
Each table entry consists of a tuple containing an initial_location
and address
.
The initial location
represents the first address that the targeted FDE
is able to decode. The address
is the address of the FDE in the .eh_frame
section.
The address
can be converted with EhHdrTable::pointer_to_offset
and EhFrame::fde_from_offset
to an FDE.
sourcepub fn lookup(&self, address: u64, bases: &BaseAddresses) -> Result<Pointer>
pub fn lookup(&self, address: u64, bases: &BaseAddresses) -> Result<Pointer>
Probably returns a pointer to the FDE for the given address.
This performs a binary search, so if there is no FDE for the given address, this function will return a pointer to any other FDE that’s close by.
To be sure, you must call contains
on the FDE.
sourcepub fn pointer_to_offset(
&self,
ptr: Pointer,
) -> Result<EhFrameOffset<R::Offset>>
pub fn pointer_to_offset( &self, ptr: Pointer, ) -> Result<EhFrameOffset<R::Offset>>
Convert a Pointer
to a section offset.
This does not support indirect pointers.
sourcepub fn fde_for_address<F>(
&self,
frame: &EhFrame<R>,
bases: &BaseAddresses,
address: u64,
get_cie: F,
) -> Result<FrameDescriptionEntry<R>>where
F: FnMut(&EhFrame<R>, &BaseAddresses, EhFrameOffset<R::Offset>) -> Result<CommonInformationEntry<R>>,
pub fn fde_for_address<F>(
&self,
frame: &EhFrame<R>,
bases: &BaseAddresses,
address: u64,
get_cie: F,
) -> Result<FrameDescriptionEntry<R>>where
F: FnMut(&EhFrame<R>, &BaseAddresses, EhFrameOffset<R::Offset>) -> Result<CommonInformationEntry<R>>,
Returns a parsed FDE for the given address, or NoUnwindInfoForAddress
if there are none.
You must provide a function to get its associated CIE. See
PartialFrameDescriptionEntry::parse
for more information.
§Example
let table = eh_frame_hdr.table().unwrap();
let fde = table.fde_for_address(&eh_frame, &bases, addr, EhFrame::cie_from_offset)?;
sourcepub fn unwind_info_for_address<'ctx, F, A: UnwindContextStorage<R>>(
&self,
frame: &EhFrame<R>,
bases: &BaseAddresses,
ctx: &'ctx mut UnwindContext<R, A>,
address: u64,
get_cie: F,
) -> Result<&'ctx UnwindTableRow<R, A>>where
F: FnMut(&EhFrame<R>, &BaseAddresses, EhFrameOffset<R::Offset>) -> Result<CommonInformationEntry<R>>,
pub fn unwind_info_for_address<'ctx, F, A: UnwindContextStorage<R>>(
&self,
frame: &EhFrame<R>,
bases: &BaseAddresses,
ctx: &'ctx mut UnwindContext<R, A>,
address: u64,
get_cie: F,
) -> Result<&'ctx UnwindTableRow<R, A>>where
F: FnMut(&EhFrame<R>, &BaseAddresses, EhFrameOffset<R::Offset>) -> Result<CommonInformationEntry<R>>,
Returns the frame unwind information for the given address,
or NoUnwindInfoForAddress
if there are none.
You must provide a function to get the associated CIE. See
PartialFrameDescriptionEntry::parse
for more information.