Skip to main content

DebugNames

Struct DebugNames 

Source
pub struct DebugNames<R> { /* private fields */ }
Expand description

The DebugNames struct represents the DWARF 5 name index information found in the .debug_names section.

The .debug_names section provides an index for efficiently finding debugging information entries (DIEs) by name. It contains hash tables that map names to DIE offsets, allowing debuggers to quickly locate functions, variables, types, and other named entities.

Implementations§

Source§

impl<'input, Endian> DebugNames<EndianSlice<'input, Endian>>
where Endian: Endianity,

Source

pub fn new(debug_names_section: &'input [u8], endian: Endian) -> Self

Construct a new DebugNames instance from the data in the .debug_names section.

It is the caller’s responsibility to read the .debug_names section and present it as a &[u8] slice. That means using some ELF loader on Linux, a Mach-O loader on macOS, etc.

use gimli::{DebugNames, LittleEndian};

let debug_names =
    DebugNames::new(read_debug_names_section_somehow(), LittleEndian);
Source§

impl<T> DebugNames<T>

Source

pub fn borrow<'a, F, R>(&'a self, borrow: F) -> DebugNames<R>
where F: FnMut(&'a T) -> R,

Create a DebugNames section that references the data in self.

This is useful when R implements Reader but T does not.

Used by DwarfSections::borrow.

Source§

impl<R: Reader> DebugNames<R>

Source

pub fn headers(&self) -> NameIndexHeaderIter<R>

Iterate over all name indexes in the .debug_names section.

Trait Implementations§

Source§

impl<R: Clone> Clone for DebugNames<R>

Source§

fn clone(&self) -> DebugNames<R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<R: Debug> Debug for DebugNames<R>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<R: Default> Default for DebugNames<R>

Source§

fn default() -> DebugNames<R>

Returns the “default value” for a type. Read more
Source§

impl<R> From<R> for DebugNames<R>

Source§

fn from(debug_names_section: R) -> Self

Converts to this type from the input type.
Source§

impl<R> Section<R> for DebugNames<R>

Source§

fn id() -> SectionId

Returns the section id for this type.
Source§

fn reader(&self) -> &R

Returns the Reader for this section.
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 xcoff_section_name() -> Option<&'static str>

Returns the XCOFF section name (if any) for this type when used in a XCOFF 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.
Source§

impl<R: Copy> Copy for DebugNames<R>

Auto Trait Implementations§

§

impl<R> Freeze for DebugNames<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for DebugNames<R>
where R: RefUnwindSafe,

§

impl<R> Send for DebugNames<R>
where R: Send,

§

impl<R> Sync for DebugNames<R>
where R: Sync,

§

impl<R> Unpin for DebugNames<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for DebugNames<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for DebugNames<R>
where R: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.