binutils-gdb/binutils/testsuite/binutils-all/readelf.locview-1
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

36 lines
1.3 KiB
Plaintext

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