From 8961f33e2a72a9430455cbb0368c71d22574dc3d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 26 Nov 2017 17:51:11 +0100 Subject: 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 --- libdw/dwarf_getattrs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libdw/dwarf_getattrs.c') 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 */ -- cgit v1.2.3