Struct gimli::read::DebugFrame

source ·
pub struct DebugFrame<R: Reader> {
    section: R,
    address_size: u8,
    vendor: Vendor,
}
Expand description

DebugFrame contains the .debug_frame section’s frame unwinding information required to unwind to and recover registers from older frames on the stack. For example, this is useful for a debugger that wants to print locals in a backtrace.

Most interesting methods are defined in the UnwindSection trait.

§Differences between .debug_frame and .eh_frame

While the .debug_frame section’s information has a lot of overlap with the .eh_frame section’s information, the .eh_frame information tends to only encode the subset of information needed for exception handling. Often, only one of .eh_frame or .debug_frame will be present in an object file.

Fields§

§section: R§address_size: u8§vendor: Vendor

Implementations§

source§

impl<R: Reader> DebugFrame<R>

source

pub fn set_address_size(&mut self, address_size: u8)

Set the size of a target address in bytes.

This defaults to the native word size. This is only used if the CIE version is less than 4.

source

pub fn set_vendor(&mut self, vendor: Vendor)

Set the vendor extensions to use.

This defaults to Vendor::Default.

source§

impl<'input, Endian> DebugFrame<EndianSlice<'input, Endian>>
where Endian: Endianity,

source

pub fn new(section: &'input [u8], endian: Endian) -> Self

Construct a new DebugFrame instance from the data in the .debug_frame section.

It is the caller’s responsibility to read the section and present it as a &[u8] slice. That means using some ELF loader on Linux, a Mach-O loader on macOS, etc.

use gimli::{DebugFrame, NativeEndian};

// Use with `.debug_frame`
let debug_frame = DebugFrame::new(read_debug_frame_section_somehow(), NativeEndian);

Trait Implementations§

source§

impl<R: Clone + Reader> Clone for DebugFrame<R>

source§

fn clone(&self) -> DebugFrame<R>

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: Debug + Reader> Debug for DebugFrame<R>

source§

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

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

impl<R: Reader> From<R> for DebugFrame<R>

source§

fn from(section: R) -> Self

Converts to this type from the input type.
source§

impl<R: PartialEq + Reader> PartialEq for DebugFrame<R>

source§

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

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

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

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

impl<R: Reader> Section<R> for DebugFrame<R>

source§

fn id() -> SectionId

Returns the section id for this type.
source§

fn reader(&self) -> &R

Returns the Reader for this section.
source§

fn section_name() -> &'static str

Returns the ELF section name for this type.
source§

fn dwo_section_name() -> Option<&'static str>

Returns the ELF section name (if any) for this type when used in a dwo file.
source§

fn xcoff_section_name() -> Option<&'static str>

Returns the XCOFF section name (if any) for this type when used in a XCOFF file.
source§

fn load<F, E>(f: F) -> Result<Self, E>
where F: FnOnce(SectionId) -> Result<R, E>,

Try to load the section using the given loader function.
source§

fn dwp_range(&self, offset: u32, size: u32) -> Result<Self>
where R: Reader,

Returns the subrange of the section that is the contribution of a unit in a .dwp file.
source§

fn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<(SectionId, R::Offset)>
where R: Reader,

Returns the Reader for this section.
source§

impl<R: Reader> UnwindSection<R> for DebugFrame<R>

source§

type Offset = DebugFrameOffset<<R as Reader>::Offset>

The offset type associated with this CFI section. Either DebugFrameOffset or EhFrameOffset.
source§

fn entries<'bases>( &self, bases: &'bases BaseAddresses, ) -> CfiEntriesIter<'bases, Self, R>

Iterate over the CommonInformationEntrys and FrameDescriptionEntrys in this .debug_frame section. Read more
source§

fn cie_from_offset( &self, bases: &BaseAddresses, offset: Self::Offset, ) -> Result<CommonInformationEntry<R>>

Parse the CommonInformationEntry at the given offset.
source§

fn partial_fde_from_offset<'bases>( &self, bases: &'bases BaseAddresses, offset: Self::Offset, ) -> Result<PartialFrameDescriptionEntry<'bases, Self, R>>

Parse the PartialFrameDescriptionEntry at the given offset.
source§

fn fde_from_offset<F>( &self, bases: &BaseAddresses, offset: Self::Offset, get_cie: F, ) -> Result<FrameDescriptionEntry<R>>
where F: FnMut(&Self, &BaseAddresses, Self::Offset) -> Result<CommonInformationEntry<R>>,

Parse the FrameDescriptionEntry at the given offset.
source§

fn fde_for_address<F>( &self, bases: &BaseAddresses, address: u64, get_cie: F, ) -> Result<FrameDescriptionEntry<R>>
where F: FnMut(&Self, &BaseAddresses, Self::Offset) -> Result<CommonInformationEntry<R>>,

Find the FrameDescriptionEntry for the given address. Read more
source§

fn unwind_info_for_address<'ctx, F, S>( &self, bases: &BaseAddresses, ctx: &'ctx mut UnwindContext<R::Offset, S>, address: u64, get_cie: F, ) -> Result<&'ctx UnwindTableRow<R::Offset, S>>

Find the frame unwind information for the given address. Read more
source§

impl<R: Copy + Reader> Copy for DebugFrame<R>

source§

impl<R: Eq + Reader> Eq for DebugFrame<R>

source§

impl<R: Reader> StructuralPartialEq for DebugFrame<R>

Auto Trait Implementations§

§

impl<R> Freeze for DebugFrame<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for DebugFrame<R>
where R: RefUnwindSafe,

§

impl<R> Send for DebugFrame<R>
where R: Send,

§

impl<R> Sync for DebugFrame<R>
where R: Sync,

§

impl<R> Unpin for DebugFrame<R>
where R: Unpin,

§

impl<R> UnwindSafe for DebugFrame<R>
where R: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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 T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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.