Struct gimli::read::DebuggingInformationEntry
source · [−]pub struct DebuggingInformationEntry<'abbrev, 'unit, R, Offset = <R as Reader>::Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset, { /* private fields */ }
Expand description
A Debugging Information Entry (DIE).
DIEs have a set of attributes and optionally have children DIEs as well.
Implementations
sourceimpl<'abbrev, 'unit, R, Offset> DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<'abbrev, 'unit, R, Offset> DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
sourcepub fn new(
offset: UnitOffset<Offset>,
attrs_slice: R,
abbrev: &'abbrev Abbreviation,
unit: &'unit UnitHeader<R, Offset>
) -> Self
pub fn new(
offset: UnitOffset<Offset>,
attrs_slice: R,
abbrev: &'abbrev Abbreviation,
unit: &'unit UnitHeader<R, Offset>
) -> Self
Construct a new DebuggingInformationEntry
.
sourcepub fn offset(&self) -> UnitOffset<Offset>
pub fn offset(&self) -> UnitOffset<Offset>
Get this entry’s offset.
sourcepub fn tag(&self) -> DwTag
pub fn tag(&self) -> DwTag
Get this entry’s DW_TAG_whatever
tag.
let entry = get_some_entry();
match entry.tag() {
gimli::DW_TAG_subprogram =>
println!("this entry contains debug info about a function"),
gimli::DW_TAG_inlined_subroutine =>
println!("this entry contains debug info about a particular instance of inlining"),
gimli::DW_TAG_variable =>
println!("this entry contains debug info about a local variable"),
gimli::DW_TAG_formal_parameter =>
println!("this entry contains debug info about a function parameter"),
otherwise =>
println!("this entry is some other kind of data: {:?}", otherwise),
};
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Return true if this entry’s type can have children, false otherwise.
sourcepub fn attrs<'me>(&'me self) -> AttrsIter<'abbrev, 'me, 'unit, R>
pub fn attrs<'me>(&'me self) -> AttrsIter<'abbrev, 'me, 'unit, R>
Iterate over this entry’s set of attributes.
use gimli::{DebugAbbrev, DebugInfo, LittleEndian};
// Read the `.debug_info` section.
let debug_info = DebugInfo::new(read_debug_info_section_somehow(), LittleEndian);
// Get the data about the first compilation unit out of the `.debug_info`.
let unit = debug_info.units().next()
.expect("Should have at least one compilation unit")
.expect("and it should parse ok");
// Read the `.debug_abbrev` section and parse the
// abbreviations for our compilation unit.
let debug_abbrev = DebugAbbrev::new(read_debug_abbrev_section_somehow(), LittleEndian);
let abbrevs = unit.abbreviations(&debug_abbrev).unwrap();
// Get the first entry from that compilation unit.
let mut cursor = unit.entries(&abbrevs);
let (_, entry) = cursor.next_dfs()
.expect("Should parse next entry")
.expect("Should have at least one entry");
// Finally, print the first entry's attributes.
let mut attrs = entry.attrs();
while let Some(attr) = attrs.next().unwrap() {
println!("Attribute name = {:?}", attr.name());
println!("Attribute value = {:?}", attr.value());
}
Can be used with
FallibleIterator
.
sourcepub fn attr(&self, name: DwAt) -> Result<Option<Attribute<R>>>
pub fn attr(&self, name: DwAt) -> Result<Option<Attribute<R>>>
Find the first attribute in this entry which has the given name,
and return it. Returns Ok(None)
if no attribute is found.
sourcepub fn attr_value_raw(&self, name: DwAt) -> Result<Option<AttributeValue<R>>>
pub fn attr_value_raw(&self, name: DwAt) -> Result<Option<AttributeValue<R>>>
Find the first attribute in this entry which has the given name,
and return its raw value. Returns Ok(None)
if no attribute is found.
sourcepub fn attr_value(&self, name: DwAt) -> Result<Option<AttributeValue<R>>>
pub fn attr_value(&self, name: DwAt) -> Result<Option<AttributeValue<R>>>
Find the first attribute in this entry which has the given name,
and return its normalized value. Returns Ok(None)
if no
attribute is found.
Trait Implementations
sourceimpl<'abbrev, 'unit, R: Clone, Offset: Clone> Clone for DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
impl<'abbrev, 'unit, R: Clone, Offset: Clone> Clone for DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
R: Reader<Offset = Offset>,
Offset: ReaderOffset,
sourcefn clone(&self) -> DebuggingInformationEntry<'abbrev, 'unit, R, Offset>
fn clone(&self) -> DebuggingInformationEntry<'abbrev, 'unit, R, Offset>
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, Offset = <R as Reader>::Offset> !RefUnwindSafe for DebuggingInformationEntry<'abbrev, 'unit, R, Offset>
impl<'abbrev, 'unit, R, Offset> Send for DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
Offset: Send + Sync,
R: Send + Sync,
impl<'abbrev, 'unit, R, Offset = <R as Reader>::Offset> !Sync for DebuggingInformationEntry<'abbrev, 'unit, R, Offset>
impl<'abbrev, 'unit, R, Offset> Unpin for DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
Offset: Unpin,
R: Unpin,
impl<'abbrev, 'unit, R, Offset> UnwindSafe for DebuggingInformationEntry<'abbrev, 'unit, R, Offset> where
Offset: UnwindSafe + RefUnwindSafe,
R: UnwindSafe + RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more