Struct gimli::read::EntriesRaw[][src]

pub struct EntriesRaw<'abbrev, 'unit, R> where
    R: Reader
{ /* fields omitted */ }

A raw reader of the data that defines the Debugging Information Entries.

EntriesRaw provides primitives to read the components of Debugging Information Entries (DIEs). A DIE consists of an abbreviation code (read with read_abbreviation) followed by a number of attributes (read with read_attribute). The user must provide the control flow to read these correctly. In particular, all attributes must always be read before reading another abbreviation code.

EntriesRaw lacks some features of EntriesCursor, such as the ability to skip to the next sibling DIE. However, this also allows it to optimize better, since it does not need to perform the extra bookkeeping required to support these features, and thus it is suitable for cases where performance is important.

Example Usage

let unit = get_some_unit();
let abbrevs = get_abbrevs_for_unit(&unit);

let mut entries = unit.entries_raw(&abbrevs, None)?;
while !entries.is_empty() {
    let abbrev = if let Some(abbrev) = entries.read_abbreviation()? {
        abbrev
    } else {
        // Null entry with no attributes.
        continue
    };
    match abbrev.tag() {
        gimli::DW_TAG_subprogram => {
            // Loop over attributes for DIEs we care about.
            for spec in abbrev.attributes() {
                let attr = entries.read_attribute(*spec)?;
                match attr.name() {
                    // Handle attributes.
                    _ => {}
                }
            }
        }
        _ => {
            // Skip attributes for DIEs we don't care about.
            for spec in abbrev.attributes() {
                entries.read_attribute(*spec)?;
            }
        }
    }
}

Implementations

impl<'abbrev, 'unit, R: Reader> EntriesRaw<'abbrev, 'unit, R>[src]

pub fn is_empty(&self) -> bool[src]

Return true if there is no more input.

pub fn next_offset(&self) -> UnitOffset<R::Offset>[src]

Return the unit offset at which the reader will read next.

If you want the offset of the next entry, then this must be called prior to reading the next entry.

pub fn next_depth(&self) -> isize[src]

Return the depth of the next entry.

This depth is updated when read_abbreviation is called, and is updated based on null entries and the has_children field in the abbreviation.

pub fn read_abbreviation(&mut self) -> Result<Option<&'abbrev Abbreviation>>[src]

Read an abbreviation code and lookup the corresponding Abbreviation.

Returns Ok(None) for null entries.

pub fn read_attribute(
    &mut self,
    spec: AttributeSpecification
) -> Result<Attribute<R>>
[src]

Read an attribute.

Trait Implementations

impl<'abbrev, 'unit, R: Clone> Clone for EntriesRaw<'abbrev, 'unit, R> where
    R: Reader
[src]

impl<'abbrev, 'unit, R: Debug> Debug for EntriesRaw<'abbrev, 'unit, R> where
    R: Reader
[src]

Auto Trait Implementations

impl<'abbrev, 'unit, R> Send for EntriesRaw<'abbrev, 'unit, R> where
    R: Send + Sync,
    <R as Reader>::Offset: Sync

impl<'abbrev, 'unit, R> Sync for EntriesRaw<'abbrev, 'unit, R> where
    R: Sync,
    <R as Reader>::Offset: Sync

impl<'abbrev, 'unit, R> Unpin for EntriesRaw<'abbrev, 'unit, R> where
    R: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.