binutils-gdb/binutils/testsuite/binutils-all/readelf.locview-2
Alexandre Oliva 9f27220911 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.
2017-09-22 17:05:51 -03:00

47 lines
1.8 KiB
Plaintext

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