Skip to main content

NameIndex

Struct NameIndex 

Source
pub struct NameIndex<R: Reader> { /* private fields */ }
Expand description

A single name index from the .debug_names section.

It provides access to the compilation unit table, type unit tables, hash table, name table, and entry pool that make up the accelerated lookup structure.

Implementations§

Source§

impl<R: Reader> NameIndex<R>

Source

pub fn new(header: NameIndexHeader<R>) -> Result<Self>

Create a new name index from a header.

Source

pub fn compile_unit_count(&self) -> u32

Return the number of compilation units in this index.

Source

pub fn compile_unit(&self, index: u32) -> Result<DebugInfoOffset<R::Offset>>

Get the .debug_info offset of a compilation unit.

index must be less than Self::compile_unit_count.

Returns an error if index is invalid.

Source

pub fn default_compile_unit(&self) -> Result<Option<DebugInfoOffset<R::Offset>>>

Return the .debug_info offset of the default compilation unit, if any.

If there is only one compilation unit, then entries may omit the DW_IDX_compile_unit attribute.

Source

pub fn local_type_unit_count(&self) -> u32

Return the number of local type units in this index.

Source

pub fn local_type_unit(&self, index: u32) -> Result<DebugInfoOffset<R::Offset>>

Get the .debug_info offset of a local type unit.

index must be less than Self::local_type_unit_count.

Returns an error if index is invalid.

Source

pub fn foreign_type_unit_count(&self) -> u32

Return the number of foreign type units in this index.

Source

pub fn foreign_type_unit(&self, index: u32) -> Result<DebugTypeSignature>

Get the signature of a foreign type unit.

index must be less than Self::foreign_type_unit_count.

Returns an error if index is invalid.

Source

pub fn type_unit_count(&self) -> u32

Return the number of type units in this index, both local and foreign.

Source

pub fn type_unit(&self, index: u32) -> Result<NameTypeUnit<R::Offset>>

Get a type unit reference.

index must be less than Self::type_unit_count, and normally is obtained from a DW_IDX_type_unit attribute.

Returns an error if index is invalid.

Source

pub fn has_hash_table(&self) -> bool

Return true if the name index contains a hash table.

Source

pub fn bucket_count(&self) -> u32

Return the number of buckets in the hash table.

Source

pub fn find_by_bucket( &self, bucket_index: u32, ) -> Result<Option<NameBucketIter<R>>>

Iterate over the hash entries for a bucket in the hash table.

This function is only for diagnostic uses. Usually Self::find_by_hash should be called instead.

The given bucket index is 0 based, and must be less than Self::bucket_count.

Returns an error if there is no hash table or the bucket index is invalid. Returns Ok(None) if the bucket is empty.

Source

pub fn find_by_hash(&self, hash_value: u32) -> Result<NameHashIter<R>>

Iterate over the indexes of the names with the given hash value.

The user must then check each name to see if it matches the desired name.

Returns an error if there is no hash table.

Source

pub fn name_count(&self) -> u32

Get the number of names in the name index.

This is 1 greater than the maximum valid NameTableIndex.

Source

pub fn names(&self) -> NameTableIter

Iterate over the indexes of all names in the name table.

Source

pub fn name_string_offset( &self, index: NameTableIndex, ) -> Result<DebugStrOffset<R::Offset>>

Get the string table offset for the name at the given index.

Returns an error if index is invalid.

Source

pub fn name_string( &self, index: NameTableIndex, debug_str: &DebugStr<R>, ) -> Result<R>

Get the name at the given index using the provided .debug_str section.

Returns an error if index is invalid, or the string table offset is invalid.

Source

pub fn name_entries( &self, index: NameTableIndex, ) -> Result<NameEntryIter<'_, R>>

Iterate over the series of entries for the given name table index.

Each name in the name table has a corresponding series of entries with that name in the entry pool.

Returns an error if index is invalid, or the entry pool offset is invalid.

Source

pub fn name_entry( &self, offset: NameEntryOffset<R::Offset>, ) -> Result<NameEntry<R>>

Parse the entry at the given entry pool offset.

This is useful for reading the entry referenced by a DW_IDX_parent attribute.

Source

pub fn abbreviations(&self) -> &NameAbbreviations

Get the abbreviation table for name entries in this name index.

Trait Implementations§

Source§

impl<R: Debug + Reader> Debug for NameIndex<R>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<R> UnwindSafe for NameIndex<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> 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, 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.