Struct gimli::read::DwarfPackageSections

source ·
pub struct DwarfPackageSections<T> {
    pub cu_index: DebugCuIndex<T>,
    pub tu_index: DebugTuIndex<T>,
    pub debug_abbrev: DebugAbbrev<T>,
    pub debug_info: DebugInfo<T>,
    pub debug_line: DebugLine<T>,
    pub debug_str: DebugStr<T>,
    pub debug_str_offsets: DebugStrOffsets<T>,
    pub debug_loc: DebugLoc<T>,
    pub debug_loclists: DebugLocLists<T>,
    pub debug_rnglists: DebugRngLists<T>,
    pub debug_types: DebugTypes<T>,
}
Expand description

The sections from a .dwp file.

This is useful for storing sections when T does not implement Reader. It can be used to create a DwarfPackage that references the data in self. If T does implement Reader, then use DwarfPackage directly.

§Example Usage

It can be useful to load DWARF sections into owned data structures, such as Vec. However, we do not implement the Reader trait for Vec, because it would be very inefficient, but this trait is required for all of the methods that parse the DWARF data. So we first load the DWARF sections into Vecs, and then use borrow to create Readers that reference the data.

// Read the DWARF sections into `Vec`s with whatever object loader you're using.
let dwp_sections: gimli::DwarfPackageSections<Vec<u8>> = gimli::DwarfPackageSections::load(loader)?;
// Create references to the DWARF sections.
let dwp: gimli::DwarfPackage<_> = dwp_sections.borrow(
    |section| gimli::EndianSlice::new(&section, gimli::LittleEndian),
    gimli::EndianSlice::new(&[], gimli::LittleEndian),
)?;

Fields§

§cu_index: DebugCuIndex<T>

The .debug_cu_index section.

§tu_index: DebugTuIndex<T>

The .debug_tu_index section.

§debug_abbrev: DebugAbbrev<T>

The .debug_abbrev.dwo section.

§debug_info: DebugInfo<T>

The .debug_info.dwo section.

§debug_line: DebugLine<T>

The .debug_line.dwo section.

§debug_str: DebugStr<T>

The .debug_str.dwo section.

§debug_str_offsets: DebugStrOffsets<T>

The .debug_str_offsets.dwo section.

§debug_loc: DebugLoc<T>

The .debug_loc.dwo section.

Only present when using GNU split-dwarf extension to DWARF 4.

§debug_loclists: DebugLocLists<T>

The .debug_loclists.dwo section.

§debug_rnglists: DebugRngLists<T>

The .debug_rnglists.dwo section.

§debug_types: DebugTypes<T>

The .debug_types.dwo section.

Only present when using GNU split-dwarf extension to DWARF 4.

Implementations§

source§

impl<T> DwarfPackageSections<T>

source

pub fn load<F, E>(section: F) -> Result<Self, E>
where F: FnMut(SectionId) -> Result<T, E>, E: From<Error>,

Try to load the .dwp sections using the given loader function.

section loads a DWARF section from the object file. It should return an empty section if the section does not exist.

source

pub fn borrow<'a, F, R>( &'a self, borrow: F, empty: R, ) -> Result<DwarfPackage<R>>
where F: FnMut(&'a T) -> R, R: Reader,

Create a DwarfPackage structure that references the data in self.

Trait Implementations§

source§

impl<T: Debug> Debug for DwarfPackageSections<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for DwarfPackageSections<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for DwarfPackageSections<T>
where T: RefUnwindSafe,

§

impl<T> Send for DwarfPackageSections<T>
where T: Send,

§

impl<T> Sync for DwarfPackageSections<T>
where T: Sync,

§

impl<T> Unpin for DwarfPackageSections<T>
where T: Unpin,

§

impl<T> UnwindSafe for DwarfPackageSections<T>
where T: 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> 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, 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.