pub struct UnitTable { /* private fields */ }
Expand description
A table of units that will be stored in the .debug_info
section.
Implementations§
source§impl UnitTable
impl UnitTable
sourcepub fn from<R: Reader<Offset = usize>>(
dwarf: &Dwarf<R>,
line_strings: &mut LineStringTable,
strings: &mut StringTable,
convert_address: &dyn Fn(u64) -> Option<Address>,
) -> ConvertResult<UnitTable>
pub fn from<R: Reader<Offset = usize>>( dwarf: &Dwarf<R>, line_strings: &mut LineStringTable, strings: &mut StringTable, convert_address: &dyn Fn(u64) -> Option<Address>, ) -> ConvertResult<UnitTable>
Create a unit table by reading the data in the given sections.
This also updates the given tables with the values that are referenced from attributes in this section.
convert_address
is a function to convert read addresses into the Address
type. For non-relocatable addresses, this function may simply return
Address::Constant(address)
. For relocatable addresses, it is the caller’s
responsibility to determine the symbol and addend corresponding to the address
and return Address::Symbol { symbol, addend }
.
source§impl UnitTable
impl UnitTable
sourcepub fn add(&mut self, unit: Unit) -> UnitId
pub fn add(&mut self, unit: Unit) -> UnitId
Create a new unit and add it to the table.
address_size
must be in bytes.
Returns the UnitId
of the new unit.
sourcepub fn write<W: Writer>(
&mut self,
sections: &mut Sections<W>,
line_strings: &DebugLineStrOffsets,
strings: &DebugStrOffsets,
) -> Result<DebugInfoOffsets>
pub fn write<W: Writer>( &mut self, sections: &mut Sections<W>, line_strings: &DebugLineStrOffsets, strings: &DebugStrOffsets, ) -> Result<DebugInfoOffsets>
Write the units to the given sections.
strings
must contain the .debug_str
offsets of the corresponding
StringTable
.