Struct gimli::read::UnitRef

source ·
pub struct UnitRef<'a, R: Reader> {
    pub dwarf: &'a Dwarf<R>,
    pub unit: &'a Unit<R>,
}
Expand description

A reference to a Unit and its associated Dwarf.

These often need to be passed around together, so this struct makes that easier.

It implements Deref to Unit, so you can use it as if it were a Unit. It also implements methods that correspond to methods on Dwarf that take a Unit.

Fields§

§dwarf: &'a Dwarf<R>

The Dwarf that contains the unit.

§unit: &'a Unit<R>

The Unit being referenced.

Implementations§

source§

impl<'a, R: Reader> UnitRef<'a, R>

source

pub fn new(dwarf: &'a Dwarf<R>, unit: &'a Unit<R>) -> Self

Construct a new UnitRef from a Dwarf and a Unit.

source

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

Return the string offset at the given index.

source

pub fn string(&self, offset: DebugStrOffset<R::Offset>) -> Result<R>

Return the string at the given offset in .debug_str.

source

pub fn line_string(&self, offset: DebugLineStrOffset<R::Offset>) -> Result<R>

Return the string at the given offset in .debug_line_str.

source

pub fn sup_string(&self, offset: DebugStrOffset<R::Offset>) -> Result<R>

Return the string at the given offset in the .debug_str in the supplementary object file.

source

pub fn attr_string(&self, attr: AttributeValue<R>) -> Result<R>

Return an attribute value as a string slice.

See Dwarf::attr_string for more information.

source

pub fn address(&self, index: DebugAddrIndex<R::Offset>) -> Result<u64>

Return the address at the given index.

source

pub fn attr_address(&self, attr: AttributeValue<R>) -> Result<Option<u64>>

Try to return an attribute value as an address.

See Dwarf::attr_address for more information.

source

pub fn ranges_offset_from_raw( &self, offset: RawRangeListsOffset<R::Offset>, ) -> RangeListsOffset<R::Offset>

Return the range list offset for the given raw offset.

This handles adding DW_AT_GNU_ranges_base if required.

source

pub fn ranges_offset( &self, index: DebugRngListsIndex<R::Offset>, ) -> Result<RangeListsOffset<R::Offset>>

Return the range list offset at the given index.

source

pub fn ranges( &self, offset: RangeListsOffset<R::Offset>, ) -> Result<RngListIter<R>>

Iterate over the RangeListEntrys starting at the given offset.

source

pub fn raw_ranges( &self, offset: RangeListsOffset<R::Offset>, ) -> Result<RawRngListIter<R>>

Iterate over the RawRngListEntryies starting at the given offset.

source

pub fn attr_ranges_offset( &self, attr: AttributeValue<R>, ) -> Result<Option<RangeListsOffset<R::Offset>>>

Try to return an attribute value as a range list offset.

See Dwarf::attr_ranges_offset for more information.

source

pub fn attr_ranges( &self, attr: AttributeValue<R>, ) -> Result<Option<RngListIter<R>>>

Try to return an attribute value as a range list entry iterator.

See Dwarf::attr_ranges for more information.

source

pub fn die_ranges( &self, entry: &DebuggingInformationEntry<'_, '_, R>, ) -> Result<RangeIter<R>>

Return an iterator for the address ranges of a DebuggingInformationEntry.

This uses DW_AT_low_pc, DW_AT_high_pc and DW_AT_ranges.

source

pub fn unit_ranges(&self) -> Result<RangeIter<R>>

Return an iterator for the address ranges of the Unit.

This uses DW_AT_low_pc, DW_AT_high_pc and DW_AT_ranges of the root DebuggingInformationEntry.

source

pub fn locations_offset( &self, index: DebugLocListsIndex<R::Offset>, ) -> Result<LocationListsOffset<R::Offset>>

Return the location list offset at the given index.

source

pub fn locations( &self, offset: LocationListsOffset<R::Offset>, ) -> Result<LocListIter<R>>

Iterate over the LocationListEntrys starting at the given offset.

source

pub fn raw_locations( &self, offset: LocationListsOffset<R::Offset>, ) -> Result<RawLocListIter<R>>

Iterate over the raw LocationListEntrys starting at the given offset.

source

pub fn attr_locations_offset( &self, attr: AttributeValue<R>, ) -> Result<Option<LocationListsOffset<R::Offset>>>

Try to return an attribute value as a location list offset.

See Dwarf::attr_locations_offset for more information.

source

pub fn attr_locations( &self, attr: AttributeValue<R>, ) -> Result<Option<LocListIter<R>>>

Try to return an attribute value as a location list entry iterator.

See Dwarf::attr_locations for more information.

Methods from Deref<Target = Unit<R>>§

source

pub fn unit_ref<'a>(&'a self, dwarf: &'a Dwarf<R>) -> UnitRef<'a, R>

Return a reference to this unit and its associated Dwarf.

source

pub fn encoding(&self) -> Encoding

Return the encoding parameters for this unit.

source

pub fn entry( &self, offset: UnitOffset<R::Offset>, ) -> Result<DebuggingInformationEntry<'_, '_, R>>

Read the DebuggingInformationEntry at the given offset.

source

pub fn entries(&self) -> EntriesCursor<'_, '_, R>

Navigate this unit’s DebuggingInformationEntrys.

source

pub fn entries_at_offset( &self, offset: UnitOffset<R::Offset>, ) -> Result<EntriesCursor<'_, '_, R>>

Navigate this unit’s DebuggingInformationEntrys starting at the given offset.

source

pub fn entries_tree( &self, offset: Option<UnitOffset<R::Offset>>, ) -> Result<EntriesTree<'_, '_, R>>

Navigate this unit’s DebuggingInformationEntrys as a tree starting at the given offset.

source

pub fn entries_raw( &self, offset: Option<UnitOffset<R::Offset>>, ) -> Result<EntriesRaw<'_, '_, R>>

Read the raw data that defines the Debugging Information Entries.

source

pub fn dwo_name(&self) -> Result<Option<AttributeValue<R>>>

Find the dwo name (if any) for this unit, automatically handling the differences between the standardized DWARF 5 split DWARF format and the pre-DWARF 5 GNU extension.

The returned value is relative to this unit’s comp_dir.

Trait Implementations§

source§

impl<'a, R: Reader> Clone for UnitRef<'a, R>

source§

fn clone(&self) -> Self

Returns a copy 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<'a, R: Debug + Reader> Debug for UnitRef<'a, R>

source§

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

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

impl<'a, R: Reader> Deref for UnitRef<'a, R>

source§

type Target = Unit<R>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, R: Reader> Copy for UnitRef<'a, R>

Auto Trait Implementations§

§

impl<'a, R> Freeze for UnitRef<'a, R>

§

impl<'a, R> RefUnwindSafe for UnitRef<'a, R>

§

impl<'a, R> Send for UnitRef<'a, R>
where R: Sync + Send, <R as Reader>::Offset: Sync,

§

impl<'a, R> Sync for UnitRef<'a, R>
where R: Sync + Send, <R as Reader>::Offset: Sync,

§

impl<'a, R> Unpin for UnitRef<'a, R>

§

impl<'a, R> UnwindSafe for UnitRef<'a, R>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.