gimli::read

Trait Section

Source
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 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§

Source

fn id() -> SectionId

Returns the section id for this type.

Source

fn reader(&self) -> &R
where R: Reader,

Returns the Reader for this section.

Provided Methods§

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 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R> Section<R> for DebugAbbrev<R>

Source§

impl<R> Section<R> for DebugAddr<R>

Source§

impl<R> Section<R> for DebugAranges<R>

Source§

impl<R> Section<R> for DebugCuIndex<R>

Source§

impl<R> Section<R> for DebugInfo<R>

Source§

impl<R> Section<R> for DebugLine<R>

Source§

impl<R> Section<R> for DebugLineStr<R>

Source§

impl<R> Section<R> for DebugLoc<R>

Source§

impl<R> Section<R> for DebugLocLists<R>

Source§

impl<R> Section<R> for DebugRanges<R>

Source§

impl<R> Section<R> for DebugRngLists<R>

Source§

impl<R> Section<R> for DebugStr<R>

Source§

impl<R> Section<R> for DebugStrOffsets<R>

Source§

impl<R> Section<R> for DebugTuIndex<R>

Source§

impl<R> Section<R> for DebugTypes<R>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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