summaryrefslogtreecommitdiff
path: root/libdw/dwarf_getattrs.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2017-11-26 17:51:11 +0100
committerMark Wielaard <mark@klomp.org>2018-02-21 17:19:33 +0100
commit8961f33e2a72a9430455cbb0368c71d22574dc3d (patch)
treec9b7a9a9a5301f66a6b4c058ce7dddaef6488616 /libdw/dwarf_getattrs.c
parenteb11b0f15c0fd06aa8fcc59feba36b6b091f30f7 (diff)
downloadelfutils-8961f33e2a72a9430455cbb0368c71d22574dc3d.tar.gz
libdw: Handle DWARF5 DW_FORM_implicit_const. Add dwarf_getabbrevattr_data.
Handle the new DW_FORM_implicit_const. The value of this form is embedded in the abbrev data (as sleb128) and not in the info DIE data. This also adds a new function dwarf_getabbrevattr_data which allows getting any data/value associated with a form. eu-readelf will use this new function to show the DW_FORM_implicit_const value. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw/dwarf_getattrs.c')
-rw-r--r--libdw/dwarf_getattrs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libdw/dwarf_getattrs.c b/libdw/dwarf_getattrs.c
index 7f55fafc..50faf988 100644
--- a/libdw/dwarf_getattrs.c
+++ b/libdw/dwarf_getattrs.c
@@ -83,7 +83,10 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
if (remembered_attrp >= offset_attrp)
{
/* Fill in the rest. */
- attr.valp = (unsigned char *) die_addr;
+ if (attr.form == DW_FORM_implicit_const)
+ attr.valp = (unsigned char *) attrp;
+ else
+ attr.valp = (unsigned char *) die_addr;
attr.cu = die->cu;
/* Now call the callback function. */
@@ -104,6 +107,12 @@ dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *),
// __libdw_form_val_len will have done a bounds check.
die_addr += len;
+
+ if (attr.form == DW_FORM_implicit_const)
+ {
+ int64_t attr_value __attribute__((__unused__));
+ get_sleb128_unchecked (attr_value, attrp);
+ }
}
}
/* NOTREACHED */