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

@@ -17,14 +17,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Create a fake .gnu_debuglink section. */
/* Create a fake .gnu_debuglink section. */
.section .gnu_debuglink,"",%progbits
.asciz "this_is_a_debuglink.debug"
.balign 4
.4byte 0x12345678
/* Create a fake .gnu_debugaltlink section. */
/* Create a fake .gnu_debugaltlink section. */
.section .gnu_debugaltlink,"",%progbits
.asciz "linkdebug.debug"
@@ -32,9 +32,9 @@
.dc.b 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
.dc.b 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef
/* Create a .debug_str section for local use. This is also to check
the ability to dump the same section twice, if it exists in
both the main file and the separate debug info file. */
/* Create a .debug_str section for local use. This is also to check
the ability to dump the same section twice, if it exists in
both the main file and the separate debug info file. */
.section .debug_str,"MS",%progbits,1
string1:
@@ -43,9 +43,9 @@ string1:
.balign 2
string_end:
/* Create a .debug_info section that contains strings references into the
separate debug info file. Plus the abbreviations are stored in the
separate file too... */
/* Create a .debug_info section that contains string references into
the separate debug info file. Plus the abbreviations are stored
in the separate file too... */
.section .debug_info,"",%progbits
.4byte debugE - debugS ;# Length of Compilation Unit Info