Struct gimli::read::EntriesRaw
source · [−]pub struct EntriesRaw<'abbrev, 'unit, R> where
R: Reader, { /* private fields */ }
Expand description
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.
entries.skip_attributes(abbrev.attributes());
}
}
}
Implementations
sourceimpl<'abbrev, 'unit, R: Reader> EntriesRaw<'abbrev, 'unit, R>
impl<'abbrev, 'unit, R: Reader> EntriesRaw<'abbrev, 'unit, R>
sourcepub fn next_offset(&self) -> UnitOffset<R::Offset>
pub fn next_offset(&self) -> UnitOffset<R::Offset>
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.
sourcepub fn next_depth(&self) -> isize
pub fn next_depth(&self) -> isize
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.
sourcepub fn read_abbreviation(&mut self) -> Result<Option<&'abbrev Abbreviation>>
pub fn read_abbreviation(&mut self) -> Result<Option<&'abbrev Abbreviation>>
Read an abbreviation code and lookup the corresponding Abbreviation
.
Returns Ok(None)
for null entries.
sourcepub fn read_attribute(
&mut self,
spec: AttributeSpecification
) -> Result<Attribute<R>>
pub fn read_attribute(
&mut self,
spec: AttributeSpecification
) -> Result<Attribute<R>>
Read an attribute.
sourcepub fn skip_attributes(
&mut self,
specs: &[AttributeSpecification]
) -> Result<()>
pub fn skip_attributes(
&mut self,
specs: &[AttributeSpecification]
) -> Result<()>
Skip all the attributes of an abbreviation.
Trait Implementations
sourceimpl<'abbrev, 'unit, R: Clone> Clone for EntriesRaw<'abbrev, 'unit, R> where
R: Reader,
impl<'abbrev, 'unit, R: Clone> Clone for EntriesRaw<'abbrev, 'unit, R> where
R: Reader,
sourcefn clone(&self) -> EntriesRaw<'abbrev, 'unit, R>
fn clone(&self) -> EntriesRaw<'abbrev, 'unit, R>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<'abbrev, 'unit, R> RefUnwindSafe for EntriesRaw<'abbrev, 'unit, R> where
R: RefUnwindSafe,
<R as Reader>::Offset: RefUnwindSafe,
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,
impl<'abbrev, 'unit, R> UnwindSafe for EntriesRaw<'abbrev, 'unit, R> where
R: UnwindSafe + RefUnwindSafe,
<R as Reader>::Offset: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more