Add ability to follow dwo links to readelf/objdump.

* dwarf.c (dwo_name, dwo_dir, dwo_id, dwo_id_len): New variables.
	(read_and_display_attr_value): Record dwo variables if requested.
	(display_augmentation_data): Rename to display_data and make
	generic.
	(load_dwo_file): New function.  Loads a separate dwarf object
	file.
	(load_separate_debug_file): Add reporting and loading of separate
	dwarf objet files.
	* readelf.c (process_section_headers): Add do_debug_links to list
	of flags requiring a debug dump.
	(display_debug_section): Tidy up code.
	* doc/debug.options.texi: Add note that dwo links will also be
	followed.
	* testsuite/binutils-all/debuglink.s: Tidy code.
	* testsuite/binutils-all/dwo.s: New test file.
	* testsuite/binutils-all/readelf.wk2: New file - expected output
	from readelf.
	* testsuite/binutils-all/readelf.exp: Run the new test.
This commit is contained in:
Nick Clifton
2017-11-21 13:12:04 +00:00
parent 0fc7642151
commit d85bf2ba86
8 changed files with 399 additions and 140 deletions

View File

@@ -45,7 +45,10 @@ output from this option can also be restricted by the use of the
@item k
@itemx =links
Displays the contents of the @samp{.gnu_debuglink} and/or
@samp{.gnu_debugaltlink} sections.
@samp{.gnu_debugaltlink} sections. Also displays the link to a
separate dwarf object file (dwo), if one is specified by the
DW_AT_GNU_dwo_name or DW_AT_dwo_name attributes in the
@samp{.debug_info} section.
@item K
@itemx =follow-links
@@ -55,9 +58,9 @@ versions of the same debug section being displayed if both the main
file and the separate debug info file contain sections with the same
name.
When displaying other debug information, if a link is encountered to
a separate debug info file, then attempt to follow the link and
display the referenced contents.
In addition, when displaying DWARF attributes, if a form is found that
references the separate debug info file, then the referenced contents
will also be displayed.
@item l
@itemx =rawline