from .constants import *
-def describe_attr_value(attrname, attr, die, section_offset):
- """ Given an attribute (attrname is the name, attr is the AttributeValue),
- return the textual representation of its value, suitable for tools like
- readelf.
+def describe_attr_value(attr, die, section_offset):
+ """ Given an attribute attr, return the textual representation of its
+ value, suitable for tools like readelf.
To cover all cases, this function needs some extra arguments:
val_description = descr_func(attr, die, section_offset)
# For some attributes we can display further information
- extra_info_func = _EXTRA_INFO_DESCRIPTION_MAP[attrname]
+ extra_info_func = _EXTRA_INFO_DESCRIPTION_MAP[attr.name]
extra_info = extra_info_func(attr, die, section_offset)
return str(val_description) + '\t' + extra_info
return s
return extra
+
+def location_list_extra(attr, die, section_offset):
+ pass
_location_list_extra = _make_extra_string('(location list)')
# AttributeValue - describes an attribute value in the DIE:
#
+# name:
+# The name (DW_AT_*) of this attribute
+#
# form:
# The DW_FORM_* name of this attribute
#
# Offset of this attribute's value in the stream
#
AttributeValue = namedtuple(
- 'AttributeValue', 'form value raw_value offset')
+ 'AttributeValue', 'name form value raw_value offset')
class DIE(object):
raw_value = struct_parse(structs.Dwarf_dw_form[form], self.stream)
value = self._translate_attr_value(form, raw_value)
self.attributes[name] = AttributeValue(
+ name=name,
form=form,
value=value,
raw_value=raw_value,
attr.offset - section_offset,
attrname,
describe_attr_value(
- attrname, attr, die, section_offset)))
+ attr, die, section_offset)))
if die.has_children:
die_depth += 1