Struct gimli::read::DwarfSections
source · pub struct DwarfSections<T> {Show 13 fields
pub debug_abbrev: DebugAbbrev<T>,
pub debug_addr: DebugAddr<T>,
pub debug_aranges: DebugAranges<T>,
pub debug_info: DebugInfo<T>,
pub debug_line: DebugLine<T>,
pub debug_line_str: DebugLineStr<T>,
pub debug_str: DebugStr<T>,
pub debug_str_offsets: DebugStrOffsets<T>,
pub debug_types: DebugTypes<T>,
pub debug_loc: DebugLoc<T>,
pub debug_loclists: DebugLocLists<T>,
pub debug_ranges: DebugRanges<T>,
pub debug_rnglists: DebugRngLists<T>,
}
Expand description
All of the commonly used DWARF sections.
This is useful for storing sections when T
does not implement Reader
.
It can be used to create a Dwarf
that references the data in self
.
If T
does implement Reader
, then use Dwarf
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 Vec
s, and then use
borrow
to create Reader
s that reference the data.
// Read the DWARF sections into `Vec`s with whatever object loader you're using.
let dwarf_sections: gimli::DwarfSections<Vec<u8>> = gimli::DwarfSections::load(loader)?;
// Create references to the DWARF sections.
let dwarf: gimli::Dwarf<_> = dwarf_sections.borrow(|section| {
gimli::EndianSlice::new(§ion, gimli::LittleEndian)
});
Fields§
§debug_abbrev: DebugAbbrev<T>
The .debug_abbrev
section.
debug_addr: DebugAddr<T>
The .debug_addr
section.
debug_aranges: DebugAranges<T>
The .debug_aranges
section.
debug_info: DebugInfo<T>
The .debug_info
section.
debug_line: DebugLine<T>
The .debug_line
section.
debug_line_str: DebugLineStr<T>
The .debug_line_str
section.
debug_str: DebugStr<T>
The .debug_str
section.
debug_str_offsets: DebugStrOffsets<T>
The .debug_str_offsets
section.
debug_types: DebugTypes<T>
The .debug_types
section.
debug_loc: DebugLoc<T>
The .debug_loc
section.
debug_loclists: DebugLocLists<T>
The .debug_loclists
section.
debug_ranges: DebugRanges<T>
The .debug_ranges
section.
debug_rnglists: DebugRngLists<T>
The .debug_rnglists
section.
Implementations§
source§impl<T> DwarfSections<T>
impl<T> DwarfSections<T>
sourcepub fn load<F, E>(section: F) -> Result<Self, E>
pub fn load<F, E>(section: F) -> Result<Self, E>
Try to load the DWARF 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.
sourcepub fn borrow<'a, F, R>(&'a self, borrow: F) -> Dwarf<R>
pub fn borrow<'a, F, R>(&'a self, borrow: F) -> Dwarf<R>
Create a Dwarf
structure that references the data in self
.
sourcepub fn borrow_with_sup<'a, F, R>(&'a self, sup: &'a Self, borrow: F) -> Dwarf<R>
pub fn borrow_with_sup<'a, F, R>(&'a self, sup: &'a Self, borrow: F) -> Dwarf<R>
Create a Dwarf
structure that references the data in self
and sup
.
This is like borrow
, but also includes the supplementary object file.
This is useful when R
implements Reader
but T
does not.
§Example Usage
// Read the DWARF sections into `Vec`s with whatever object loader you're using.
let dwarf_sections: gimli::DwarfSections<Vec<u8>> = gimli::DwarfSections::load(loader)?;
let dwarf_sup_sections: gimli::DwarfSections<Vec<u8>> = gimli::DwarfSections::load(sup_loader)?;
// Create references to the DWARF sections.
let dwarf = dwarf_sections.borrow_with_sup(&dwarf_sup_sections, |section| {
gimli::EndianSlice::new(§ion, gimli::LittleEndian)
});