pub trait Section<R>: From<R> {
// Required methods
fn id() -> SectionId;
fn reader(&self) -> &R
where R: Reader;
// Provided methods
fn section_name() -> &'static str { ... }
fn dwo_section_name() -> Option<&'static str> { ... }
fn xcoff_section_name() -> Option<&'static str> { ... }
fn load<F, E>(f: F) -> Result<Self, E>
where F: FnOnce(SectionId) -> Result<R, E> { ... }
fn dwp_range(&self, offset: u32, size: u32) -> Result<Self>
where R: Reader { ... }
fn lookup_offset_id(
&self,
id: ReaderOffsetId,
) -> Option<(SectionId, R::Offset)>
where R: Reader { ... }
}
Expand description
A convenience trait for loading DWARF sections from object files. To be used like:
use gimli::{DebugInfo, EndianSlice, LittleEndian, Reader, Section};
let buf = [0x00, 0x01, 0x02, 0x03];
let reader = EndianSlice::new(&buf, LittleEndian);
let loader = |name| -> Result<_, ()> { Ok(reader) };
let debug_info: DebugInfo<_> = Section::load(loader).unwrap();
Required Methods§
Provided Methods§
sourcefn section_name() -> &'static str
fn section_name() -> &'static str
Returns the ELF section name for this type.
sourcefn dwo_section_name() -> Option<&'static str>
fn dwo_section_name() -> Option<&'static str>
Returns the ELF section name (if any) for this type when used in a dwo file.
sourcefn xcoff_section_name() -> Option<&'static str>
fn xcoff_section_name() -> Option<&'static str>
Returns the XCOFF section name (if any) for this type when used in a XCOFF file.
sourcefn load<F, E>(f: F) -> Result<Self, E>
fn load<F, E>(f: F) -> Result<Self, E>
Try to load the section using the given loader function.
sourcefn dwp_range(&self, offset: u32, size: u32) -> Result<Self>where
R: Reader,
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.
sourcefn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<(SectionId, R::Offset)>where
R: Reader,
fn lookup_offset_id(&self, id: ReaderOffsetId) -> Option<(SectionId, R::Offset)>where
R: Reader,
Returns the Reader
for this section.
Object Safety§
This trait is not object safe.