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>
impl<R: Reader> NameIndex<R>
Sourcepub fn new(header: NameIndexHeader<R>) -> Result<Self>
pub fn new(header: NameIndexHeader<R>) -> Result<Self>
Create a new name index from a header.
Sourcepub fn compile_unit_count(&self) -> u32
pub fn compile_unit_count(&self) -> u32
Return the number of compilation units in this index.
Sourcepub fn compile_unit(&self, index: u32) -> Result<DebugInfoOffset<R::Offset>>
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.
Sourcepub fn default_compile_unit(&self) -> Result<Option<DebugInfoOffset<R::Offset>>>
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.
Sourcepub fn local_type_unit_count(&self) -> u32
pub fn local_type_unit_count(&self) -> u32
Return the number of local type units in this index.
Sourcepub fn local_type_unit(&self, index: u32) -> Result<DebugInfoOffset<R::Offset>>
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.
Sourcepub fn foreign_type_unit_count(&self) -> u32
pub fn foreign_type_unit_count(&self) -> u32
Return the number of foreign type units in this index.
Sourcepub fn foreign_type_unit(&self, index: u32) -> Result<DebugTypeSignature>
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.
Sourcepub fn type_unit_count(&self) -> u32
pub fn type_unit_count(&self) -> u32
Return the number of type units in this index, both local and foreign.
Sourcepub fn type_unit(&self, index: u32) -> Result<NameTypeUnit<R::Offset>>
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.
Sourcepub fn has_hash_table(&self) -> bool
pub fn has_hash_table(&self) -> bool
Return true if the name index contains a hash table.
Sourcepub fn bucket_count(&self) -> u32
pub fn bucket_count(&self) -> u32
Return the number of buckets in the hash table.
Sourcepub fn find_by_bucket(
&self,
bucket_index: u32,
) -> Result<Option<NameBucketIter<R>>>
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.
Sourcepub fn find_by_hash(&self, hash_value: u32) -> Result<NameHashIter<R>>
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.
Sourcepub fn name_count(&self) -> u32
pub fn name_count(&self) -> u32
Get the number of names in the name index.
This is 1 greater than the maximum valid NameTableIndex.
Sourcepub fn names(&self) -> NameTableIter ⓘ
pub fn names(&self) -> NameTableIter ⓘ
Iterate over the indexes of all names in the name table.
Sourcepub fn name_string_offset(
&self,
index: NameTableIndex,
) -> Result<DebugStrOffset<R::Offset>>
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.
Sourcepub fn name_string(
&self,
index: NameTableIndex,
debug_str: &DebugStr<R>,
) -> Result<R>
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.
Sourcepub fn name_entries(
&self,
index: NameTableIndex,
) -> Result<NameEntryIter<'_, R>>
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.
Sourcepub fn name_entry(
&self,
offset: NameEntryOffset<R::Offset>,
) -> Result<NameEntry<R>>
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.
Sourcepub fn abbreviations(&self) -> &NameAbbreviations
pub fn abbreviations(&self) -> &NameAbbreviations
Get the abbreviation table for name entries in this name index.