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>
impl<'a, R: Reader> UnitRef<'a, R>
sourcepub fn new(dwarf: &'a Dwarf<R>, unit: &'a Unit<R>) -> Self
pub fn new(dwarf: &'a Dwarf<R>, unit: &'a Unit<R>) -> Self
Construct a new UnitRef
from a Dwarf
and a Unit
.
sourcepub fn string_offset(
&self,
index: DebugStrOffsetsIndex<R::Offset>,
) -> Result<DebugStrOffset<R::Offset>>
pub fn string_offset( &self, index: DebugStrOffsetsIndex<R::Offset>, ) -> Result<DebugStrOffset<R::Offset>>
Return the string offset at the given index.
sourcepub fn string(&self, offset: DebugStrOffset<R::Offset>) -> Result<R>
pub fn string(&self, offset: DebugStrOffset<R::Offset>) -> Result<R>
Return the string at the given offset in .debug_str
.
sourcepub fn line_string(&self, offset: DebugLineStrOffset<R::Offset>) -> Result<R>
pub fn line_string(&self, offset: DebugLineStrOffset<R::Offset>) -> Result<R>
Return the string at the given offset in .debug_line_str
.
sourcepub fn sup_string(&self, offset: DebugStrOffset<R::Offset>) -> Result<R>
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.
sourcepub fn attr_string(&self, attr: AttributeValue<R>) -> Result<R>
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.
sourcepub fn address(&self, index: DebugAddrIndex<R::Offset>) -> Result<u64>
pub fn address(&self, index: DebugAddrIndex<R::Offset>) -> Result<u64>
Return the address at the given index.
sourcepub fn attr_address(&self, attr: AttributeValue<R>) -> Result<Option<u64>>
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.
sourcepub fn ranges_offset_from_raw(
&self,
offset: RawRangeListsOffset<R::Offset>,
) -> RangeListsOffset<R::Offset>
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.
sourcepub fn ranges_offset(
&self,
index: DebugRngListsIndex<R::Offset>,
) -> Result<RangeListsOffset<R::Offset>>
pub fn ranges_offset( &self, index: DebugRngListsIndex<R::Offset>, ) -> Result<RangeListsOffset<R::Offset>>
Return the range list offset at the given index.
sourcepub fn ranges(
&self,
offset: RangeListsOffset<R::Offset>,
) -> Result<RngListIter<R>>
pub fn ranges( &self, offset: RangeListsOffset<R::Offset>, ) -> Result<RngListIter<R>>
Iterate over the RangeListEntry
s starting at the given offset.
sourcepub fn raw_ranges(
&self,
offset: RangeListsOffset<R::Offset>,
) -> Result<RawRngListIter<R>>
pub fn raw_ranges( &self, offset: RangeListsOffset<R::Offset>, ) -> Result<RawRngListIter<R>>
Iterate over the RawRngListEntry
ies starting at the given offset.
sourcepub fn attr_ranges_offset(
&self,
attr: AttributeValue<R>,
) -> Result<Option<RangeListsOffset<R::Offset>>>
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.
sourcepub fn attr_ranges(
&self,
attr: AttributeValue<R>,
) -> Result<Option<RngListIter<R>>>
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.
sourcepub fn die_ranges(
&self,
entry: &DebuggingInformationEntry<'_, '_, R>,
) -> Result<RangeIter<R>>
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
.
sourcepub fn unit_ranges(&self) -> Result<RangeIter<R>>
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
.
sourcepub fn locations_offset(
&self,
index: DebugLocListsIndex<R::Offset>,
) -> Result<LocationListsOffset<R::Offset>>
pub fn locations_offset( &self, index: DebugLocListsIndex<R::Offset>, ) -> Result<LocationListsOffset<R::Offset>>
Return the location list offset at the given index.
sourcepub fn locations(
&self,
offset: LocationListsOffset<R::Offset>,
) -> Result<LocListIter<R>>
pub fn locations( &self, offset: LocationListsOffset<R::Offset>, ) -> Result<LocListIter<R>>
Iterate over the LocationListEntry
s starting at the given offset.
sourcepub fn raw_locations(
&self,
offset: LocationListsOffset<R::Offset>,
) -> Result<RawLocListIter<R>>
pub fn raw_locations( &self, offset: LocationListsOffset<R::Offset>, ) -> Result<RawLocListIter<R>>
Iterate over the raw LocationListEntry
s starting at the given offset.
sourcepub fn attr_locations_offset(
&self,
attr: AttributeValue<R>,
) -> Result<Option<LocationListsOffset<R::Offset>>>
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.
sourcepub fn attr_locations(
&self,
attr: AttributeValue<R>,
) -> Result<Option<LocListIter<R>>>
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>>§
sourcepub fn unit_ref<'a>(&'a self, dwarf: &'a Dwarf<R>) -> UnitRef<'a, R>
pub fn unit_ref<'a>(&'a self, dwarf: &'a Dwarf<R>) -> UnitRef<'a, R>
Return a reference to this unit and its associated Dwarf
.
sourcepub fn entry(
&self,
offset: UnitOffset<R::Offset>,
) -> Result<DebuggingInformationEntry<'_, '_, R>>
pub fn entry( &self, offset: UnitOffset<R::Offset>, ) -> Result<DebuggingInformationEntry<'_, '_, R>>
Read the DebuggingInformationEntry
at the given offset.
sourcepub fn entries(&self) -> EntriesCursor<'_, '_, R>
pub fn entries(&self) -> EntriesCursor<'_, '_, R>
Navigate this unit’s DebuggingInformationEntry
s.
sourcepub fn entries_at_offset(
&self,
offset: UnitOffset<R::Offset>,
) -> Result<EntriesCursor<'_, '_, R>>
pub fn entries_at_offset( &self, offset: UnitOffset<R::Offset>, ) -> Result<EntriesCursor<'_, '_, R>>
Navigate this unit’s DebuggingInformationEntry
s
starting at the given offset.
sourcepub fn entries_tree(
&self,
offset: Option<UnitOffset<R::Offset>>,
) -> Result<EntriesTree<'_, '_, R>>
pub fn entries_tree( &self, offset: Option<UnitOffset<R::Offset>>, ) -> Result<EntriesTree<'_, '_, R>>
Navigate this unit’s DebuggingInformationEntry
s as a tree
starting at the given offset.
sourcepub fn entries_raw(
&self,
offset: Option<UnitOffset<R::Offset>>,
) -> Result<EntriesRaw<'_, '_, R>>
pub fn entries_raw( &self, offset: Option<UnitOffset<R::Offset>>, ) -> Result<EntriesRaw<'_, '_, R>>
Read the raw data that defines the Debugging Information Entries.
sourcepub fn dwo_name(&self) -> Result<Option<AttributeValue<R>>>
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§
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>
impl<'a, R> Sync for UnitRef<'a, R>
impl<'a, R> Unpin for UnitRef<'a, R>
impl<'a, R> UnwindSafe for UnitRef<'a, R>
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)