pub struct Attribute<R: Reader> { /* private fields */ }
Expand description
An attribute in a DebuggingInformationEntry
, consisting of a name and
associated value.
Implementations§
source§impl<R: Reader> Attribute<R>
impl<R: Reader> Attribute<R>
sourcepub fn raw_value(&self) -> AttributeValue<R>
pub fn raw_value(&self) -> AttributeValue<R>
Get this attribute’s raw value.
sourcepub fn value(&self) -> AttributeValue<R>
pub fn value(&self) -> AttributeValue<R>
Get this attribute’s normalized value.
Attribute values can potentially be encoded in multiple equivalent forms, and may have special meaning depending on the attribute name. This method converts the attribute value to a normalized form based on the attribute name.
See “Table 7.5: Attribute encodings” and “Table 7.6: Attribute form encodings”.
sourcepub fn udata_value(&self) -> Option<u64>
pub fn udata_value(&self) -> Option<u64>
Try to convert this attribute’s value to an unsigned integer.
sourcepub fn sdata_value(&self) -> Option<i64>
pub fn sdata_value(&self) -> Option<i64>
Try to convert this attribute’s value to a signed integer.
sourcepub fn offset_value(&self) -> Option<R::Offset>
pub fn offset_value(&self) -> Option<R::Offset>
Try to convert this attribute’s value to an offset.
sourcepub fn exprloc_value(&self) -> Option<Expression<R>>
pub fn exprloc_value(&self) -> Option<Expression<R>>
Try to convert this attribute’s value to an expression or location buffer.
Expressions and locations may be DW_FORM_block*
or DW_FORM_exprloc
.
The standard doesn’t mention DW_FORM_block*
as a possible form, but
it is encountered in practice.
sourcepub fn string_value(&self, debug_str: &DebugStr<R>) -> Option<R>
pub fn string_value(&self, debug_str: &DebugStr<R>) -> Option<R>
Try to return this attribute’s value as a string slice.
If this attribute’s value is either an inline DW_FORM_string
string,
or a DW_FORM_strp
reference to an offset into the .debug_str
section, return the attribute’s string value as Some
. Other attribute
value forms are returned as None
.
Warning: this function does not handle all possible string forms.
Use Dwarf::attr_string
instead.
sourcepub fn string_value_sup(
&self,
debug_str: &DebugStr<R>,
debug_str_sup: Option<&DebugStr<R>>,
) -> Option<R>
pub fn string_value_sup( &self, debug_str: &DebugStr<R>, debug_str_sup: Option<&DebugStr<R>>, ) -> Option<R>
Try to return this attribute’s value as a string slice.
If this attribute’s value is either an inline DW_FORM_string
string,
or a DW_FORM_strp
reference to an offset into the .debug_str
section, or a DW_FORM_strp_sup
reference to an offset into a supplementary
object file, return the attribute’s string value as Some
. Other attribute
value forms are returned as None
.
Warning: this function does not handle all possible string forms.
Use Dwarf::attr_string
instead.