Struct gimli::write::UnitTable

source ·
pub struct UnitTable { /* private fields */ }
Expand description

A table of units that will be stored in the .debug_info section.

Implementations§

source§

impl UnitTable

source

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

source

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.

source

pub fn count(&self) -> usize

Return the number of units.

source

pub fn id(&self, index: usize) -> UnitId

Return the id of a unit.

§Panics

Panics if index >= self.count().

source

pub fn get(&self, id: UnitId) -> &Unit

Get a reference to a unit.

§Panics

Panics if id is invalid.

source

pub fn get_mut(&mut self, id: UnitId) -> &mut Unit

Get a mutable reference to a unit.

§Panics

Panics if id is invalid.

source

pub fn iter(&self) -> impl Iterator<Item = (UnitId, &Unit)>

Get an iterator for the units.

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (UnitId, &mut Unit)>

Get a mutable iterator for the units.

source

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.

Trait Implementations§

source§

impl Debug for UnitTable

source§

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

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

impl Default for UnitTable

source§

fn default() -> UnitTable

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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, 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.