aboutsummaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2018-03-01 00:14:52 +0100
committerMark Wielaard <mark@klomp.org>2018-03-05 15:30:22 +0100
commitfd0cee63fb02455a5021ca298da8dadb4df63a9a (patch)
treebc8c9b63a31cf1a8c4b9e96b9f8013e8ea3ef149 /libdw
parent22e282071021fc5ada2b9294bfa7e25fbd62a9d6 (diff)
downloadelfutils-fd0cee63fb02455a5021ca298da8dadb4df63a9a.tar.gz
readelf: Add some support for locviews.
This adds minimal support for locviews as output by GCC8. It changes readelf to keep track of loclistptrs from DW_AT_GNU_locviews and prints the locview pairs for those. Since there is no terminator we have to keep track of where the next loclist entry starts. The --debug-dump=loc output looks as follows: CU [ 714] base: +0x0000000000003020 <elf_hash> [ b4] view pair 1, 2 [ b6] range 4, 7f +0x0000000000003024 <elf_hash+0x4>.. +0x000000000000309e <elf_hash+0x7e> [ 0] reg5 [ d9] view pair 3, 1 view pair 1, 2 [ dd] range 4, 4c +0x0000000000003024 <elf_hash+0x4>.. +0x000000000000306b <elf_hash+0x4b> [ 0] reg5 range 4c, 7f +0x000000000000306c <elf_hash+0x4c>.. +0x000000000000309e <elf_hash+0x7e> [ 0] reg2 Note that in the above output the view pairs correspond to the ranges immediately following in the loc list. This is how GCC8 currently outputs the locview pairs and ranges, but this is not guaranteed and you'll need to look at the location and GNU_locviews attributes of the DIE to know which really match up together. We might want to adjust the output to make this more clear. This does not yet add an locview accessor to libdw. It just recognizes the DW_AT_GNU_locviews attribute as a loclistptr when encoded as a sec_offset form. Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog6
-rw-r--r--libdw/dwarf.h2
-rw-r--r--libdw/dwarf_formudata.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index b86fb13f..4c3587b4 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-01 Mark Wielaard <mark@klomp.org>
+
+ * dwarf.h: Add DW_AT_GNU_locviews and DW_AT_GNU_entry_view.
+ * dwarf_formudata.c (dwarf_formudata): Handle DW_AT_GNU_locviews
+ as a loclistptr.
+
2018-02-09 Mark Wielaard <mark@klomp.org>
* dwarf_formblock.c (dwarf_formblock): Handle DW_FORM_data16 as a
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index 4f362066..d53a30d8 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -339,6 +339,8 @@ enum
DW_AT_GNU_all_tail_call_sites = 0x2116,
DW_AT_GNU_all_call_sites = 0x2117,
DW_AT_GNU_all_source_call_sites = 0x2118,
+ DW_AT_GNU_locviews = 0x2137,
+ DW_AT_GNU_entry_view = 0x2138,
DW_AT_GNU_macros = 0x2119,
DW_AT_GNU_deleted = 0x211a,
diff --git a/libdw/dwarf_formudata.c b/libdw/dwarf_formudata.c
index 9c1644ef..95872d6b 100644
--- a/libdw/dwarf_formudata.c
+++ b/libdw/dwarf_formudata.c
@@ -141,6 +141,7 @@ dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
case DW_AT_string_length:
case DW_AT_use_location:
case DW_AT_vtable_elem_location:
+ case DW_AT_GNU_locviews:
/* loclistptr */
if (__libdw_formptr (attr, IDX_debug_loc,
DWARF_E_NO_LOCLIST, NULL,