aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2017-09-22 17:05:51 -0300
committerAlexandre Oliva <aoliva@redhat.com>2017-09-22 17:05:51 -0300
commit9f272209118972864b2c3799ddf2b39683c1a7b7 (patch)
treed58a44a74397bb6499ee83ea011bf156c66b9cff /binutils/testsuite
parent43573013c9836f2b91b74b9b29dac35fdb41e06b (diff)
downloadgdb-9f272209118972864b2c3799ddf2b39683c1a7b7.zip
gdb-9f272209118972864b2c3799ddf2b39683c1a7b7.tar.gz
gdb-9f272209118972864b2c3799ddf2b39683c1a7b7.tar.bz2
LVU: dump loclists with locviews
When dumping location lists, also dump locview lists that may be interspersed with them, and bring view pairs next to the corresponding location list entries. This patch supports DW_AT_GNU_locviews as a separate attribute for DWARF4- loc_lists and split (dwo) loclists, as well as DWARF5 loclists. It also supports, in DWARF5 loclists, the proposed DW_LLE_GNU_view_pair loclist entry type proposed for DWARF6. The tests use 32-bit DWARF, even on 64-bit targets, resolving offsets to constants so as to reduce the risk that relocations be created for them, or that the offsets be rejected as nonconstants. The patch also adds an xfail to an unrelated test, namely dw5, so that no unexpected fails remain on nds32*-elf, one of the tested targets. Reviewed-by: Alan Modra <amodra@gmail.com> for include/ChangeLog * dwarf2.def (DW_AT_GNU_locviews): New. * dwarf2.h (enum dwarf_location_list_entry_type): Add DW_LLE_GNU_view_pair. (DW_LLE_view_pair): Define. for binutils/ChangeLog * dwarf.h (debug_info): Add loc_views and num_loc_views. * dwarf.c (vm1): New constant. (print_dwarf_view): New function. (read_and_display_attr_value): Support DW_AT_GNU_locviews. (process_debug_info): Keep num_loc_offsets and num_loc_views in sync. (display_view_pair_list): New function. (display_loc_list_dwo): Take vstart_ptr; update it. Dump location view pairs before the range they apply to, when a viewlist augments the loc list. (display_loc_list): Likewise. Check view numbers in range tests. (display_loclists_list): Likewise. Handle view pair entries, and warn on trailing ones. (loc_views): New variable. (loc_offsets_compar): Compare loc_views if loc_offsets are the same. (display_debug_loc): Check and sort loc_views too. Accept loc_view as expected_start. Skip if lists and views are the same. Dump locview list separately in order, and pass the locview list base to each list dump function. Warn and skip overlap and hole checking if we find loclists and locviews to not be adjacent. * testsuite/binutils-all/locview-1.s: New. * testsuite/binutils-all/readelf.locview-1: New. * testsuite/binutils-all/locview-2.s: New. * testsuite/binutils-all/readelf.locview-2: New. * testsuite/binutils-all/readelf.exp: Run new tests. Fix option spelling in pr18374 fail message. XFAIL dw5 test on nds32*-elf.
Diffstat (limited to 'binutils/testsuite')
-rw-r--r--binutils/testsuite/binutils-all/locview-1.s270
-rw-r--r--binutils/testsuite/binutils-all/locview-2.s335
-rw-r--r--binutils/testsuite/binutils-all/readelf.exp29
-rw-r--r--binutils/testsuite/binutils-all/readelf.locview-135
-rw-r--r--binutils/testsuite/binutils-all/readelf.locview-246
5 files changed, 714 insertions, 1 deletions
diff --git a/binutils/testsuite/binutils-all/locview-1.s b/binutils/testsuite/binutils-all/locview-1.s
new file mode 100644
index 0000000..d9d9b5b
--- /dev/null
+++ b/binutils/testsuite/binutils-all/locview-1.s
@@ -0,0 +1,270 @@
+ .text
+.Ltext0:
+.LFB0:
+ /* locview.c:1 */
+.LM1:
+ /* view -0 */
+ /* locview.c:2 */
+.LM2:
+ /* view 1 */
+.LVL0:
+ /* DEBUG i => 0 */
+ /* locview.c:3 */
+.LM3:
+ /* view 2 */
+ /* DEBUG j => 0x1 */
+ /* locview.c:4 */
+.LM4:
+ /* view 3 */
+ /* DEBUG i => 0x2 */
+ /* locview.c:5 */
+.LM5:
+ /* view 4 */
+ /* DEBUG j => 0x3 */
+ /* locview.c:6 */
+.LM6:
+ /* view 5 */
+ /* DEBUG k => 0x4 */
+ /* DEBUG l => 0x4 */
+ /* locview.c:7 */
+.LM7:
+ /* view 6 */
+ /* DEBUG k => 0x5 */
+ /* DEBUG l => 0x5 */
+ /* locview.c:8 */
+.LM8:
+ /* view 7 */
+ /* DEBUG k => 0x6 */
+ /* DEBUG l => 0x6 */
+ /* locview.c:9 */
+.LM9:
+ /* view 8 */
+ .byte 0
+.LFE0:
+.Letext0:
+
+ .section .debug_info
+.Ldebug_info0:
+.LIbase:
+ .4byte .LIend - .LIstart /* Length of Compilation Unit Info */
+.LIstart:
+ .2byte 0x4 /* DWARF version number */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+ .byte 0x4 /* Pointer Size (in bytes) */
+.LIcu:
+ .uleb128 0x1 /* (DIE (cu) DW_TAG_compile_unit) */
+ .ascii "hand-crafted based on GCC output\0"
+ .byte 0xc /* DW_AT_language */
+ .ascii "locview.c\0"
+ .ascii "/tmp\0"
+ .4byte 0 /* DW_AT_low_pc */
+.LIsubf:
+ .uleb128 0x2 /* (DIE (subf) DW_TAG_subprogram) */
+ .ascii "f\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x1 /* DW_AT_decl_line */
+ .4byte .LIint-.LIbase /* DW_AT_type */
+ .4byte .LFB0 /* DW_AT_low_pc */
+ .4byte 1 /* .LFE0-.LFB0 */ /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ /* DW_AT_GNU_all_call_sites */
+ .4byte .LIint - .LIbase /* DW_AT_sibling */
+.LIvari:
+ .uleb128 0x3 /* (DIE (vari) DW_TAG_variable) */
+ .ascii "i\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x2 /* DW_AT_decl_line */
+ .4byte .LIint-.LIbase /* DW_AT_type */
+ .4byte .LLST0 /* DW_AT_location */
+ .4byte .LVUS0 /* DW_AT_GNU_locviews */
+.LIvarj:
+ .uleb128 0x3 /* (DIE (varf) DW_TAG_variable) */
+ .ascii "j\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x3 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LLST1 /* DW_AT_location */
+ .4byte .LVUS1 /* DW_AT_GNU_locviews */
+.LIvark:
+ .uleb128 0x5 /* (DIE (vark) DW_TAG_variable) */
+ .ascii "k\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x6 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LVUS2 /* DW_AT_GNU_locviews */
+ .4byte .LLST2 /* DW_AT_location */
+ .byte 0 /* end of children of subf */
+.LIvarl:
+ .uleb128 0x5 /* (DIE (varl) DW_TAG_variable) */
+ .ascii "l\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x6 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LVUS2 /* DW_AT_GNU_locviews */
+ .4byte .LLST2 /* DW_AT_location */
+ .byte 0 /* end of children of subf */
+
+.LIint:
+ .uleb128 0x4 /* (DIE (int) DW_TAG_base_type) */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 0 /* end of children of cu */
+.LIend:
+
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+.LAbrv1:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .byte 0
+ .byte 0
+.LAbrv2:
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x2117 /* (DW_AT_GNU_all_call_sites) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+.LAbrv3:
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .uleb128 0x2137 /* (DW_AT_GNU_locviews) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+.LAbrv4:
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0
+ .byte 0
+.LAbrv5:
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2137 /* (DW_AT_GNU_locviews) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+ .byte 0
+
+ .section .debug_loc
+.Ldebug_loc0:
+.LVUS0:
+ .uleb128 0x2 /* View list begin (*.LVUS0) */
+ .uleb128 0x4 /* View list end (*.LVUS0) */
+ .uleb128 0x4 /* View list begin (*.LVUS0) */
+ .uleb128 0 /* View list end (*.LVUS0) */
+.LLST0:
+ .4byte .LVL0 /* Location list begin address (*.LLST0) */
+ .4byte .LVL0 /* Location list end address (*.LLST0) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x30 /* DW_OP_lit0 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte .LVL0 /* Location list begin address (*.LLST0) */
+ .4byte .LFE0 /* Location list end address (*.LLST0) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x32 /* DW_OP_lit2 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte 0 /* Location list terminator begin (*.LLST0) */
+ .4byte 0 /* Location list terminator end (*.LLST0) */
+.LLST1:
+ .4byte .LVL0 /* Location list begin address (*.LLST1) */
+ .4byte .LVL0 /* Location list end address (*.LLST1) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x31 /* DW_OP_lit1 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte .LVL0 /* Location list begin address (*.LLST1) */
+ .4byte .LFE0 /* Location list end address (*.LLST1) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x33 /* DW_OP_lit3 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte 0 /* Location list terminator begin (*.LLST1) */
+ .4byte 0 /* Location list terminator end (*.LLST1) */
+.LVUS1:
+ .uleb128 0x3 /* View list begin (*.LVUS1) */
+ .uleb128 0x5 /* View list end (*.LVUS1) */
+ .uleb128 0x5 /* View list begin (*.LVUS1) */
+ .uleb128 0 /* View list end (*.LVUS1) */
+.LVUS2:
+ .uleb128 0x6 /* View list begin (*.LVUS2) */
+ .uleb128 0x7 /* View list end (*.LVUS2) */
+ .uleb128 0x7 /* View list begin (*.LVUS2) */
+ .uleb128 0x8 /* View list end (*.LVUS2) */
+ .uleb128 0x8 /* View list begin (*.LVUS2) */
+ .uleb128 0 /* View list end (*.LVUS2) */
+.LLST2:
+ .4byte .LVL0 /* Location list begin address (*.LLST2) */
+ .4byte .LVL0 /* Location list end address (*.LLST2) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x34 /* DW_OP_lit4 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte .LVL0 /* Location list begin address (*.LLST2) */
+ .4byte .LVL0 /* Location list end address (*.LLST2) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x35 /* DW_OP_lit5 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte .LVL0 /* Location list begin address (*.LLST2) */
+ .4byte .LFE0 /* Location list end address (*.LLST2) */
+ .2byte 0x2 /* Location expression size */
+ .byte 0x36 /* DW_OP_lit6 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .4byte 0 /* Location list terminator begin (*.LLST2) */
+ .4byte 0 /* Location list terminator end (*.LLST2) */
diff --git a/binutils/testsuite/binutils-all/locview-2.s b/binutils/testsuite/binutils-all/locview-2.s
new file mode 100644
index 0000000..d9b1d58
--- /dev/null
+++ b/binutils/testsuite/binutils-all/locview-2.s
@@ -0,0 +1,335 @@
+ .text
+.Ltext0:
+.LFB0:
+ /* locview.c:1 */
+.LM1:
+ /* view -0 */
+ /* locview.c:2 */
+.LM2:
+ /* view 1 */
+.LVL0:
+ /* DEBUG i => 0 */
+ /* locview.c:3 */
+.LM3:
+ /* view 2 */
+ /* DEBUG j => 0x1 */
+ /* locview.c:4 */
+.LM4:
+ /* view 3 */
+ /* DEBUG i => 0x2 */
+ /* locview.c:5 */
+.LM5:
+ /* view 4 */
+ /* DEBUG j => 0x3 */
+ /* locview.c:6 */
+.LM6:
+ /* view 5 */
+ /* DEBUG k => 0x4 */
+ /* DEBUG l => 0x4 */
+ /* locview.c:7 */
+.LM7:
+ /* view 6 */
+ /* DEBUG k => 0x5 */
+ /* DEBUG l => 0x5 */
+ /* locview.c:8 */
+.LM8:
+ /* view 7 */
+ /* DEBUG k => 0x6 */
+ /* DEBUG l => 0x6 */
+ /* locview.c:9 */
+.LM9:
+ /* view 8 */
+ .byte 0
+.LFE0:
+.Letext0:
+
+ .section .debug_info
+.Ldebug_info0:
+.LIbase:
+ .4byte .LIend - .LIstart /* Length of Compilation Unit Info */
+.LIstart:
+ .2byte 0x5 /* DWARF version number */
+ .byte 0x1 /* DW_UT_compile */
+ .byte 0x4 /* Pointer Size (in bytes) */
+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */
+.LIcu:
+ .uleb128 0x2 /* (DIE (cu) DW_TAG_compile_unit) */
+ .ascii "hand-crafted based on GCC output\0"
+ .byte 0x1d /* DW_AT_language */
+ .ascii "locview.c\0"
+ .ascii "/tmp\0"
+ .4byte 0 /* DW_AT_low_pc */
+.LIsubf:
+ .uleb128 0x3 /* (DIE (subf) DW_TAG_subprogram) */
+ .ascii "f\0" /* DW_AT_name */
+ .byte 0x1 /* DW_AT_decl_file (locview.c) */
+ .byte 0x1 /* DW_AT_decl_line */
+ .4byte .LIint-.LIbase /* DW_AT_type */
+ .4byte .LFB0 /* DW_AT_low_pc */
+ .4byte 1 /* .LFE0-.LFB0 */ /* DW_AT_high_pc */
+ .uleb128 0x1 /* DW_AT_frame_base */
+ .byte 0x9c /* DW_OP_call_frame_cfa */
+ /* DW_AT_call_all_calls */
+ .4byte .LIint - .LIbase /* DW_AT_sibling */
+.LIvari:
+ .uleb128 0x1 /* (DIE (vari) DW_TAG_variable) */
+ .ascii "i\0" /* DW_AT_name */
+ /* DW_AT_decl_file (1, locview.c) */
+ .byte 0x2 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LLST0 /* DW_AT_location */
+ .4byte .LVUS0 /* DW_AT_GNU_locviews */
+.LIvarj:
+ .uleb128 0x1 /* (DIE (varj) DW_TAG_variable) */
+ .ascii "j\0" /* DW_AT_name */
+ /* DW_AT_decl_file (1, locview.c) */
+ .byte 0x3 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LLST1 /* DW_AT_location */
+ .4byte .LVUS1 /* DW_AT_GNU_locviews */
+.LIvark:
+ .uleb128 0x5 /* (DIE (vark) DW_TAG_variable) */
+ .ascii "k\0" /* DW_AT_name */
+ /* DW_AT_decl_file (1, locview.c) */
+ .byte 0x6 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LVUS2 /* DW_AT_GNU_locviews */
+ .4byte .LLST2 /* DW_AT_location */
+.LIvarl:
+ .uleb128 0x6 /* (DIE (varl) DW_TAG_variable) */
+ .ascii "l\0" /* DW_AT_name */
+ /* DW_AT_decl_file (1, locview.c) */
+ .byte 0x6 /* DW_AT_decl_line */
+ .4byte .LIint - .LIbase /* DW_AT_type */
+ .4byte .LLST3 /* DW_AT_location */
+ .byte 0 /* end of children of DIE subf */
+
+.LIint:
+ .uleb128 0x4 /* (DIE (int) DW_TAG_base_type) */
+ .byte 0x4 /* DW_AT_byte_size */
+ .byte 0x5 /* DW_AT_encoding */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 0 /* end of children of DIE cu */
+.LIend:
+ .section .debug_abbrev
+.Ldebug_abbrev0:
+.LAbrv1:
+ .uleb128 0x1 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 1 /* (locview.c) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .uleb128 0x2137 /* (DW_AT_GNU_locviews) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+.LAbrv2:
+ .uleb128 0x2 /* (abbrev code) */
+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x25 /* (DW_AT_producer) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x13 /* (DW_AT_language) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x1b /* (DW_AT_comp_dir) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .byte 0
+ .byte 0
+.LAbrv3:
+ .uleb128 0x3 /* (abbrev code) */
+ .uleb128 0x2e /* (TAG: DW_TAG_subprogram) */
+ .byte 0x1 /* DW_children_yes */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x11 /* (DW_AT_low_pc) */
+ .uleb128 0x1 /* (DW_FORM_addr) */
+ .uleb128 0x12 /* (DW_AT_high_pc) */
+ .uleb128 0x6 /* (DW_FORM_data4) */
+ .uleb128 0x40 /* (DW_AT_frame_base) */
+ .uleb128 0x18 /* (DW_FORM_exprloc) */
+ .uleb128 0x7a /* (DW_AT_call_all_calls) */
+ .uleb128 0x19 /* (DW_FORM_flag_present) */
+ .uleb128 0x1 /* (DW_AT_sibling) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .byte 0
+ .byte 0
+.LAbrv4:
+ .uleb128 0x4 /* (abbrev code) */
+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0xb /* (DW_AT_byte_size) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3e /* (DW_AT_encoding) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .byte 0
+ .byte 0
+.LAbrv5:
+ .uleb128 0x5 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 1 /* (locview.c) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2137 /* (DW_AT_GNU_locviews) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+.LAbrv6:
+ .uleb128 0x6 /* (abbrev code) */
+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */
+ .byte 0 /* DW_children_no */
+ .uleb128 0x3 /* (DW_AT_name) */
+ .uleb128 0x8 /* (DW_FORM_string) */
+ .uleb128 0x3a /* (DW_AT_decl_file) */
+ .uleb128 0x21 /* (DW_FORM_implicit_const) */
+ .sleb128 1 /* (locview.c) */
+ .uleb128 0x3b /* (DW_AT_decl_line) */
+ .uleb128 0xb /* (DW_FORM_data1) */
+ .uleb128 0x49 /* (DW_AT_type) */
+ .uleb128 0x13 /* (DW_FORM_ref4) */
+ .uleb128 0x2 /* (DW_AT_location) */
+ .uleb128 0x17 /* (DW_FORM_sec_offset) */
+ .byte 0
+ .byte 0
+ .byte 0
+
+ .section .debug_loclists
+ .4byte .Ldebug_loc2-.Ldebug_loc1 /* Length of Location Lists */
+.Ldebug_loc1:
+ .2byte 0x5 /* DWARF version number */
+ .byte 0x4 /* Address Size */
+ .byte 0 /* Segment Size */
+ .4byte 0 /* Offset Entry Count */
+.Ldebug_loc0:
+.LVUS0:
+ .uleb128 0x2 /* View list begin (*.LVUS0) */
+ .uleb128 0x4 /* View list end (*.LVUS0) */
+ .uleb128 0x4 /* View list begin (*.LVUS0) */
+ .uleb128 0 /* View list end (*.LVUS0) */
+.LLST0:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST0) */
+ .4byte .LVL0 /* Base address (*.LLST0) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST0) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST0) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST0) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x30 /* DW_OP_lit0 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST0) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST0) */
+ .uleb128 1 /* .LFE0-.LVL0 */ /* Location list end address (*.LLST0) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x32 /* DW_OP_lit2 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST0) */
+.LLST1:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST1) */
+ .4byte .LVL0 /* Base address (*.LLST1) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST1) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST1) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST1) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x31 /* DW_OP_lit1 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST1) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST1) */
+ .uleb128 1 /* .LFE0-.LVL0 */ /* Location list end address (*.LLST1) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x33 /* DW_OP_lit3 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST1) */
+.LVUS1:
+ .uleb128 0x3 /* View list begin (*.LVUS1) */
+ .uleb128 0x5 /* View list end (*.LVUS1) */
+ .uleb128 0x5 /* View list begin (*.LVUS1) */
+ .uleb128 0 /* View list end (*.LVUS1) */
+.LVUS2:
+ .uleb128 0x6 /* View list begin (*.LVUS2) */
+ .uleb128 0x7 /* View list end (*.LVUS2) */
+ .uleb128 0x7 /* View list begin (*.LVUS2) */
+ .uleb128 0x8 /* View list end (*.LVUS2) */
+ .uleb128 0x8 /* View list begin (*.LVUS2) */
+ .uleb128 0 /* View list end (*.LVUS2) */
+.LLST2:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST2) */
+ .4byte .LVL0 /* Base address (*.LLST2) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST2) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST2) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST2) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x34 /* DW_OP_lit4 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST2) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST2) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST2) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x35 /* DW_OP_lit5 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST2) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST2) */
+ .uleb128 1 /* .LFE0-.LVL0 */ /* Location list end address (*.LLST2) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x36 /* DW_OP_lit6 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST2) */
+.LLST3:
+ .byte 0x6 /* DW_LLE_base_address (*.LLST3) */
+ .4byte .LVL0 /* Base address (*.LLST3) */
+ .byte 0x9 /* DW_LLE_view_pair (extension proposed for DWARF6) */
+ .uleb128 0x6 /* View list begin (*.LLST3) */
+ .uleb128 0x7 /* View list end (*.LVUS3) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST3) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST3) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST3) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x34 /* DW_OP_lit4 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x9 /* DW_LLE_view_pair */
+ .uleb128 0x7 /* View list begin (*.LLST3) */
+ .uleb128 0x8 /* View list end (*.LVUS3) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST3) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST3) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list end address (*.LLST3) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x35 /* DW_OP_lit5 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0x9 /* DW_LLE_view_pair */
+ .uleb128 0x8 /* View list begin (*.LLST3) */
+ .uleb128 0x0 /* View list end (*.LVUS3) */
+ .byte 0x4 /* DW_LLE_offset_pair (*.LLST3) */
+ .uleb128 0 /* .LVL0-.LVL0 */ /* Location list begin address (*.LLST3) */
+ .uleb128 1 /* .LFE0-.LVL0 */ /* Location list end address (*.LLST3) */
+ .uleb128 0x2 /* Location expression size */
+ .byte 0x36 /* DW_OP_lit6 */
+ .byte 0x9f /* DW_OP_stack_value */
+ .byte 0 /* DW_LLE_end_of_list (*.LLST3) */
+.Ldebug_loc2:
diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp
index 6a7b562..81d1809 100644
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -379,6 +379,33 @@ if {![binutils_assemble $srcdir/$subdir/pr18374.s tmpdir/pr18374.o]} then {
}
+# locview - Check dumping of location lists with location views.
+if {![binutils_assemble $srcdir/$subdir/locview-1.s tmpdir/locview-1.o]} then {
+ unresolved "readelf --debug-dump=loc locview-1 (failed to assemble)"
+} else {
+
+ if ![is_remote host] {
+ set tempfile tmpdir/locview-1.o
+ } else {
+ set tempfile [remote_download host tmpdir/locview-1.o]
+ }
+
+ readelf_test --debug-dump=loc $tempfile readelf.locview-1 {}
+}
+if {![binutils_assemble $srcdir/$subdir/locview-2.s tmpdir/locview-2.o]} then {
+ unresolved "readelf --debug-dump=loc locview-2 (failed to assemble)"
+} else {
+
+ if ![is_remote host] {
+ set tempfile tmpdir/locview-2.o
+ } else {
+ set tempfile [remote_download host tmpdir/locview-2.o]
+ }
+
+ readelf_test --debug-dump=loc $tempfile readelf.locview-2 {}
+}
+
+
# Check that decompressed dumps work.
if {![binutils_assemble $srcdir/$subdir/z.s tmpdir/z.o]} then {
unresolved "readelf --decompress --hex-dump .debug_loc z (failed to assemble)"
@@ -417,6 +444,6 @@ if ![istarget "riscv*-*-*"] then {
readelf_find_size $tempfile
# Make sure that readelf can decode the contents.
- readelf_test -wiaoRlL $tempfile dw5.W {}
+ readelf_test -wiaoRlL $tempfile dw5.W { nds32*-elf }
}
}
diff --git a/binutils/testsuite/binutils-all/readelf.locview-1 b/binutils/testsuite/binutils-all/readelf.locview-1
new file mode 100644
index 0000000..6148520
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.locview-1
@@ -0,0 +1,35 @@
+Contents of the .*ebug_loc section:
+
+ Offset Begin End Expression
+
+ 00000000 v0000002 v0000004 location view pair
+ 00000002 v0000004 v0000000 location view pair
+
+ 00000004 v0000002 v0000004 views at 00000000 for:
+ 00000000 00000000 \(DW_OP_lit0; DW_OP_stack_value\)
+ 00000010 v0000004 v0000000 views at 00000002 for:
+ 00000000 00000001 \(DW_OP_lit2; DW_OP_stack_value\)
+ 0000001c <End of list>
+ 00000024 v0000003 v0000005 views at 00000044 for:
+ 00000000 00000000 \(DW_OP_lit1; DW_OP_stack_value\)
+ 00000030 v0000005 v0000000 views at 00000046 for:
+ 00000000 00000001 \(DW_OP_lit3; DW_OP_stack_value\)
+ 0000003c <End of list>
+
+ 00000044 v0000003 v0000005 location view pair
+ 00000046 v0000005 v0000000 location view pair
+
+
+ 00000048 v0000006 v0000007 location view pair
+ 0000004a v0000007 v0000008 location view pair
+ 0000004c v0000008 v0000000 location view pair
+
+ 0000004e v0000006 v0000007 views at 00000048 for:
+ 00000000 00000000 \(DW_OP_lit4; DW_OP_stack_value\)
+ 0000005a v0000007 v0000008 views at 0000004a for:
+ 00000000 00000000 \(DW_OP_lit5; DW_OP_stack_value\)
+ 00000066 v0000008 v0000000 views at 0000004c for:
+ 00000000 00000001 \(DW_OP_lit6; DW_OP_stack_value\)
+ 00000072 <End of list>
+
+#pass
diff --git a/binutils/testsuite/binutils-all/readelf.locview-2 b/binutils/testsuite/binutils-all/readelf.locview-2
new file mode 100644
index 0000000..f064ad7
--- /dev/null
+++ b/binutils/testsuite/binutils-all/readelf.locview-2
@@ -0,0 +1,46 @@
+Contents of the .*ebug_loclists section:
+#...
+ Offset Begin End Expression
+
+ 0000000c v0000002 v0000004 location view pair
+ 0000000e v0000004 v0000000 location view pair
+
+ 00000010 00000000 \(base address\)
+ 00000015 v0000002 v0000004 views at 0000000c for:
+ 00000000 00000000 \(DW_OP_lit0; DW_OP_stack_value\)
+ 0000001b v0000004 v0000000 views at 0000000e for:
+ 00000000 00000001 \(DW_OP_lit2; DW_OP_stack_value\)
+ 00000021 <End of list>
+ 00000022 00000000 \(base address\)
+ 00000027 v0000003 v0000005 views at 00000034 for:
+ 00000000 00000000 \(DW_OP_lit1; DW_OP_stack_value\)
+ 0000002d v0000005 v0000000 views at 00000036 for:
+ 00000000 00000001 \(DW_OP_lit3; DW_OP_stack_value\)
+ 00000033 <End of list>
+
+ 00000034 v0000003 v0000005 location view pair
+ 00000036 v0000005 v0000000 location view pair
+
+
+ 00000038 v0000006 v0000007 location view pair
+ 0000003a v0000007 v0000008 location view pair
+ 0000003c v0000008 v0000000 location view pair
+
+ 0000003e 00000000 \(base address\)
+ 00000043 v0000006 v0000007 views at 00000038 for:
+ 00000000 00000000 \(DW_OP_lit4; DW_OP_stack_value\)
+ 00000049 v0000007 v0000008 views at 0000003a for:
+ 00000000 00000000 \(DW_OP_lit5; DW_OP_stack_value\)
+ 0000004f v0000008 v0000000 views at 0000003c for:
+ 00000000 00000001 \(DW_OP_lit6; DW_OP_stack_value\)
+ 00000055 <End of list>
+ 00000056 00000000 \(base address\)
+ 0000005b v0000006 v0000007 views for:
+ 0000005e 00000000 00000000 \(DW_OP_lit4; DW_OP_stack_value\)
+ 00000064 v0000007 v0000008 views for:
+ 00000067 00000000 00000000 \(DW_OP_lit5; DW_OP_stack_value\)
+ 0000006d v0000008 v0000000 views for:
+ 00000070 00000000 00000001 \(DW_OP_lit6; DW_OP_stack_value\)
+ 00000076 <End of list>
+
+#pass