Dwarf

Trait Dwarf 

Source
pub trait Dwarf<'data> {
    // Required methods
    fn endianity(&self) -> Endian;
    fn raw_section(&self, name: &str) -> Option<DwarfSection<'data>>;

    // Provided methods
    fn section(&self, name: &str) -> Option<DwarfSection<'data>> { ... }
    fn has_section(&self, name: &str) -> bool { ... }
}
Expand description

Provides access to DWARF debugging information independent of the container file type.

When implementing this trait, verify whether the container file type supports compressed section data. If so, override the provided section_data method. Also, if there is a faster way to check for the existence of a section without loading its data, override has_section.

Required Methods§

Source

fn endianity(&self) -> Endian

Returns whether the file was compiled for a big-endian or little-endian machine.

This can usually be determined by inspecting the file’s headers. Sometimes, this is also given by the architecture.

Source

fn raw_section(&self, name: &str) -> Option<DwarfSection<'data>>

Returns information and raw data of a section.

The section name is given without leading punctuation, such dots or underscores. For instance, the name of the Debug Info section would be "debug_info", which translates to ".debug_info" in ELF and "__debug_info" in MachO.

Certain containers might allow compressing section data. In this case, this function returns the compressed data. To get uncompressed data instead, use section_data.

Provided Methods§

Source

fn section(&self, name: &str) -> Option<DwarfSection<'data>>

Returns information and data of a section.

If the section is compressed, this decompresses on the fly and returns allocated memory. Otherwise, this should return a slice of the raw data.

The section name is given without leading punctuation, such dots or underscores. For instance, the name of the Debug Info section would be "debug_info", which translates to ".debug_info" in ELF and "__debug_info" in MachO.

Source

fn has_section(&self, name: &str) -> bool

Determines whether the specified section exists.

The section name is given without leading punctuation, such dots or underscores. For instance, the name of the Debug Info section would be "debug_info", which translates to ".debug_info" in ELF and "__debug_info" in MachO.

Implementors§

Source§

impl<'data> Dwarf<'data> for ElfObject<'data>

Source§

impl<'data> Dwarf<'data> for MachObject<'data>

Source§

impl<'data> Dwarf<'data> for PeObject<'data>

Source§

impl<'data> Dwarf<'data> for WasmObject<'data>