pub struct UnitHeader<R, Offset = <R as Reader>::Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,{ /* private fields */ }Expand description
The common fields for the headers of compilation units and type units.
Implementations§
Source§impl<R, Offset> UnitHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
Static methods.
impl<R, Offset> UnitHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
Static methods.
Sourcepub fn new(
encoding: Encoding,
unit_length: Offset,
unit_type: UnitType<Offset>,
debug_abbrev_offset: DebugAbbrevOffset<Offset>,
section: SectionId,
unit_offset: UnitSectionOffset<Offset>,
entries_buf: R,
) -> Self
pub fn new( encoding: Encoding, unit_length: Offset, unit_type: UnitType<Offset>, debug_abbrev_offset: DebugAbbrevOffset<Offset>, section: SectionId, unit_offset: UnitSectionOffset<Offset>, entries_buf: R, ) -> Self
Construct a new UnitHeader.
Source§impl<R, Offset> UnitHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
Instance methods.
impl<R, Offset> UnitHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
Instance methods.
Sourcepub fn offset(&self) -> UnitSectionOffset<Offset>
pub fn offset(&self) -> UnitSectionOffset<Offset>
Get the offset of this unit within its section.
Sourcepub fn debug_info_offset(&self) -> Option<DebugInfoOffset<Offset>>
pub fn debug_info_offset(&self) -> Option<DebugInfoOffset<Offset>>
Get the offset of this unit as an offset within the .debug_info section.
Returns None if this unit is not in the .debug_info section.
Sourcepub fn debug_types_offset(&self) -> Option<DebugTypesOffset<Offset>>
pub fn debug_types_offset(&self) -> Option<DebugTypesOffset<Offset>>
Get the offset of this unit as an offset within the .debug_types section.
Returns None if this unit is not in the .debug_types section.
Sourcepub fn size_of_header(&self) -> usize
pub fn size_of_header(&self) -> usize
Return the serialized size of the common unit header for the given DWARF format.
Sourcepub fn unit_length(&self) -> Offset
pub fn unit_length(&self) -> Offset
Get the length of the debugging info for this compilation unit, not including the byte length of the encoded length itself.
Sourcepub fn length_including_self(&self) -> Offset
pub fn length_including_self(&self) -> Offset
Get the length of the debugging info for this compilation unit, including the byte length of the encoded length itself.
Sourcepub fn version(&self) -> u16
pub fn version(&self) -> u16
Get the DWARF version of the debugging info for this compilation unit.
Sourcepub fn debug_abbrev_offset(&self) -> DebugAbbrevOffset<Offset>
pub fn debug_abbrev_offset(&self) -> DebugAbbrevOffset<Offset>
The offset into the .debug_abbrev section for this compilation unit’s
debugging information entries’ abbreviations.
Sourcepub fn address_size(&self) -> u8
pub fn address_size(&self) -> u8
The size of addresses (in bytes) in this compilation unit.
Sourcepub fn format(&self) -> Format
pub fn format(&self) -> Format
Whether this compilation unit is encoded in 64- or 32-bit DWARF.
Sourcepub fn header_size(&self) -> Offset
pub fn header_size(&self) -> Offset
The serialized size of the header for this compilation unit.
Sourcepub fn root_offset(&self) -> UnitOffset<Offset>
pub fn root_offset(&self) -> UnitOffset<Offset>
The unit offset of the root entry.
Sourcepub fn range(&self, idx: Range<UnitOffset<Offset>>) -> Result<R>
pub fn range(&self, idx: Range<UnitOffset<Offset>>) -> Result<R>
Get the underlying bytes for the supplied range.
Sourcepub fn range_from(&self, idx: RangeFrom<UnitOffset<Offset>>) -> Result<R>
pub fn range_from(&self, idx: RangeFrom<UnitOffset<Offset>>) -> Result<R>
Get the underlying bytes for the supplied range.
Sourcepub fn range_to(&self, idx: RangeTo<UnitOffset<Offset>>) -> Result<R>
pub fn range_to(&self, idx: RangeTo<UnitOffset<Offset>>) -> Result<R>
Get the underlying bytes for the supplied range.
Sourcepub fn entry<'abbrev>(
&self,
abbreviations: &'abbrev Abbreviations,
offset: UnitOffset<Offset>,
) -> Result<DebuggingInformationEntry<R>>
pub fn entry<'abbrev>( &self, abbreviations: &'abbrev Abbreviations, offset: UnitOffset<Offset>, ) -> Result<DebuggingInformationEntry<R>>
Read the DebuggingInformationEntry at the given offset.
Creating a DebuggingInformationEntry requires an allocation, so frequent use of
this method may be slow. Use methods such as Self::entries_at_offset to read
multiple entries where possible, or Self::entries_raw which does not allocate.
Sourcepub fn entries<'abbrev>(
&self,
abbreviations: &'abbrev Abbreviations,
) -> EntriesCursor<'abbrev, R>
pub fn entries<'abbrev>( &self, abbreviations: &'abbrev Abbreviations, ) -> EntriesCursor<'abbrev, R>
Navigate this unit’s DebuggingInformationEntrys.
Sourcepub fn entries_at_offset<'abbrev>(
&self,
abbreviations: &'abbrev Abbreviations,
offset: UnitOffset<Offset>,
) -> Result<EntriesCursor<'abbrev, R>>
pub fn entries_at_offset<'abbrev>( &self, abbreviations: &'abbrev Abbreviations, offset: UnitOffset<Offset>, ) -> Result<EntriesCursor<'abbrev, R>>
Navigate this compilation unit’s DebuggingInformationEntrys
starting at the given offset.
Sourcepub fn entries_tree<'abbrev>(
&self,
abbreviations: &'abbrev Abbreviations,
offset: Option<UnitOffset<Offset>>,
) -> Result<EntriesTree<'abbrev, R>>
pub fn entries_tree<'abbrev>( &self, abbreviations: &'abbrev Abbreviations, offset: Option<UnitOffset<Offset>>, ) -> Result<EntriesTree<'abbrev, R>>
Navigate this unit’s DebuggingInformationEntrys as a tree
starting at the given offset.
Sourcepub fn entries_raw<'abbrev>(
&self,
abbreviations: &'abbrev Abbreviations,
offset: Option<UnitOffset<Offset>>,
) -> Result<EntriesRaw<'abbrev, R>>
pub fn entries_raw<'abbrev>( &self, abbreviations: &'abbrev Abbreviations, offset: Option<UnitOffset<Offset>>, ) -> Result<EntriesRaw<'abbrev, R>>
Read the raw data that defines the Debugging Information Entries.
Sourcepub fn abbreviations(
&self,
debug_abbrev: &DebugAbbrev<R>,
) -> Result<Abbreviations>
pub fn abbreviations( &self, debug_abbrev: &DebugAbbrev<R>, ) -> Result<Abbreviations>
Parse this unit’s abbreviations.
Sourcepub fn is_tombstone_address(&self, address: u64) -> bool
pub fn is_tombstone_address(&self, address: u64) -> bool
Return true if the given address is a tombstone.
This currently checks if the address is -1 or -2 for the address size of the unit.
Note that this cannot detect the use of 0 as a tombstone since that is ambiguous. The caller must use their own knowledge of valid address ranges to determine that if required.
Trait Implementations§
Source§impl<R, Offset> Clone for UnitHeader<R, Offset>
impl<R, Offset> Clone for UnitHeader<R, Offset>
Source§fn clone(&self) -> UnitHeader<R, Offset>
fn clone(&self) -> UnitHeader<R, Offset>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<R, Offset> Debug for UnitHeader<R, Offset>
impl<R, Offset> Debug for UnitHeader<R, Offset>
Source§impl<R, Offset> PartialEq for UnitHeader<R, Offset>
impl<R, Offset> PartialEq for UnitHeader<R, Offset>
impl<R, Offset> Copy for UnitHeader<R, Offset>
impl<R, Offset> Eq for UnitHeader<R, Offset>
impl<R, Offset> StructuralPartialEq for UnitHeader<R, Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
Auto Trait Implementations§
impl<R, Offset> Freeze for UnitHeader<R, Offset>
impl<R, Offset> RefUnwindSafe for UnitHeader<R, Offset>where
Offset: RefUnwindSafe,
R: RefUnwindSafe,
impl<R, Offset> Send for UnitHeader<R, Offset>
impl<R, Offset> Sync for UnitHeader<R, Offset>
impl<R, Offset> Unpin for UnitHeader<R, Offset>
impl<R, Offset> UnwindSafe for UnitHeader<R, Offset>where
Offset: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.