pub struct Unit<R, Offset = <R as Reader>::Offset>where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,{
pub header: UnitHeader<R, Offset>,
pub abbreviations: Arc<Abbreviations>,
pub name: Option<R>,
pub comp_dir: Option<R>,
pub low_pc: u64,
pub str_offsets_base: DebugStrOffsetsBase<Offset>,
pub addr_base: DebugAddrBase<Offset>,
pub loclists_base: DebugLocListsBase<Offset>,
pub rnglists_base: DebugRngListsBase<Offset>,
pub line_program: Option<IncompleteLineProgram<R, Offset>>,
pub dwo_id: Option<DwoId>,
}
Expand description
All of the commonly used information for a unit in the .debug_info
or .debug_types
sections.
Fields§
§header: UnitHeader<R, Offset>
The header of the unit.
abbreviations: Arc<Abbreviations>
The parsed abbreviations for the unit.
name: Option<R>
The DW_AT_name
attribute of the unit.
comp_dir: Option<R>
The DW_AT_comp_dir
attribute of the unit.
low_pc: u64
The DW_AT_low_pc
attribute of the unit. Defaults to 0.
str_offsets_base: DebugStrOffsetsBase<Offset>
The DW_AT_str_offsets_base
attribute of the unit. Defaults to 0.
addr_base: DebugAddrBase<Offset>
The DW_AT_addr_base
attribute of the unit. Defaults to 0.
loclists_base: DebugLocListsBase<Offset>
The DW_AT_loclists_base
attribute of the unit. Defaults to 0.
rnglists_base: DebugRngListsBase<Offset>
The DW_AT_rnglists_base
attribute of the unit. Defaults to 0.
line_program: Option<IncompleteLineProgram<R, Offset>>
The line number program of the unit.
dwo_id: Option<DwoId>
The DWO ID of a skeleton unit or split compilation unit.
Implementations§
source§impl<R: Reader> Unit<R>
impl<R: Reader> Unit<R>
sourcepub fn new(dwarf: &Dwarf<R>, header: UnitHeader<R>) -> Result<Self>
pub fn new(dwarf: &Dwarf<R>, header: UnitHeader<R>) -> Result<Self>
Construct a new Unit
from the given unit header.
sourcepub fn new_with_abbreviations(
dwarf: &Dwarf<R>,
header: UnitHeader<R>,
abbreviations: Arc<Abbreviations>,
) -> Result<Self>
pub fn new_with_abbreviations( dwarf: &Dwarf<R>, header: UnitHeader<R>, abbreviations: Arc<Abbreviations>, ) -> Result<Self>
Construct a new Unit
from the given unit header and abbreviations.
The abbreviations for this call can be obtained using dwarf.abbreviations(&header)
.
The caller may implement caching to reuse the Abbreviations
across units with the
same header.debug_abbrev_offset()
value.
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 copy_relocated_attributes(&mut self, other: &Unit<R>)
pub fn copy_relocated_attributes(&mut self, other: &Unit<R>)
Copy attributes that are subject to relocation from another unit. This is intended to be used to copy attributes from a skeleton compilation unit to the corresponding split compilation unit.
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
.