Fix readelf's and objdump's dislplay of DWO links when multiple links are present.

PR 26829
 * dwarf.c (struct dwo_info): Add cu_offset field.
 (add_dwo_info): Add cu_offset parameter.  Record in new dwo_info
 struct.
 (add_dwo_name): Add cu_offset field.
 (add_dwo_dir): Add cu_offset field.
 (add_dwo_id): Add cu_offset field.
 (read_and_display_attr_value): Pass cu_offset to dwo recording
 functions.
 (load_separate_debug_files): Accumulate name, dir and id values
 and display once for each CU.
 * testsuite/binutils-all/dwo.sL Use a separate CU for the second
 dwo link.
 * testsuite/binutils-all/readelf.k2: Update expected output.
This commit is contained in:
Nick Clifton
2020-11-13 16:02:39 +00:00
parent 5a7cf52794
commit 50ea087755
4 changed files with 87 additions and 40 deletions

View File

@@ -34,8 +34,8 @@ string_end:
/* Create a .debug_info section that contains the dwo links. */
.section .debug_info,"",%progbits
.4byte debugE - debugS ;# Length of Compilation Unit Info
debugS:
.4byte debugE1 - debugS1 ;# Length of Compilation Unit Info
debugS1:
.short 0x4 ;# DWARF version number.
.4byte 0x0 ;# Offset into .debug_abbrev section.
.byte 0x4 ;# Pointer Size (in bytes).
@@ -43,6 +43,13 @@ debugS:
.uleb128 0x1 ;# Use abbrev #1. This needs strings from the .debug_str section.
.4byte string1
.4byte string2
debugE1:
.4byte debugE2 - debugS2 ;# Length of Compilation Unit Info
debugS2:
.short 0x4 ;# DWARF version number.
.4byte 0x0 ;# Offset into .debug_abbrev section.
.byte 0x4 ;# Pointer Size (in bytes).
.uleb128 0x2 ;# Use abbrev #2.
.asciz "file.dwo"
@@ -52,7 +59,7 @@ debugS:
;# Minimal section alignment on alpha-* is 2, so ensure no new invalid CU
;# will be started.
.balign 2, 0
debugE:
debugE2:
.section .debug_abbrev,"",%progbits

View File

@@ -6,4 +6,4 @@ The \.debug_info section contains link\(s\) to dwo file\(s\):
Name: debugfile\.dwo
Directory: /path/to/dwo/files
ID: (12|dd) (34|cc) (56|bb) (78|aa) (78|aa) (56|bb) (34|cc) (12|dd)
ID: <not specified>