Skip to main content

Unit

Struct Unit 

Source
pub struct Unit {
    pub line_program: LineProgram,
    pub ranges: RangeListTable,
    pub locations: LocationListTable,
    /* private fields */
}
Expand description

A unit’s debugging information.

Fields§

§line_program: LineProgram

The line number program for this unit.

§ranges: RangeListTable

A table of range lists used by this unit.

§locations: LocationListTable

A table of location lists used by this unit.

Implementations§

Source§

impl Unit

Source

pub fn new(encoding: Encoding, line_program: LineProgram) -> Self

Create a new Unit.

Source

pub fn set_encoding(&mut self, encoding: Encoding)

Set the encoding parameters for this unit.

Source

pub fn encoding(&self) -> Encoding

Return the encoding parameters for this unit.

Source

pub fn version(&self) -> u16

Return the DWARF version for this unit.

Source

pub fn address_size(&self) -> u8

Return the address size in bytes for this unit.

Source

pub fn format(&self) -> Format

Return the DWARF format for this unit.

Source

pub fn count(&self) -> usize

Return the number of DebuggingInformationEntrys created for this unit.

This includes entries that no longer have a parent.

Source

pub fn root(&self) -> UnitEntryId

Return the id of the root entry.

Source

pub fn reserve(&mut self) -> UnitEntryId

Reserve a DebuggingInformationEntry in this unit and return its id.

This method is useful when you need an id to construct a DebugInfoRef before the DIE has been added to the unit.

If the id is used in a reference, it must later be passed to Self::add_reserved. Until then, the ID must not be used with any other methods of this unit.

It is valid to reserve an id but never use or add it.

Source

pub fn add_reserved( &mut self, child: UnitEntryId, parent: UnitEntryId, tag: DwTag, )

Set the parent and tag of a previously reserved DebuggingInformationEntry.

The parent must be within the same unit.

§Panics

Panics if child or parent is invalid, or if child is not a reserved entry.

Source

pub fn add(&mut self, parent: UnitEntryId, tag: DwTag) -> UnitEntryId

Add a new DebuggingInformationEntry to this unit and return its id.

The parent must be within the same unit.

§Panics

Panics if parent is invalid.

Source

pub fn get(&self, id: UnitEntryId) -> &DebuggingInformationEntry

Get a reference to an entry.

§Panics

Panics if id is invalid.

Source

pub fn get_mut(&mut self, id: UnitEntryId) -> &mut DebuggingInformationEntry

Get a mutable reference to an entry.

§Panics

Panics if id is invalid.

Trait Implementations§

Source§

impl Debug for Unit

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Unit

§

impl RefUnwindSafe for Unit

§

impl Send for Unit

§

impl Sync for Unit

§

impl Unpin for Unit

§

impl UnsafeUnpin for Unit

§

impl UnwindSafe for Unit

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.