[binutils-gdb] Display entry offset for .debug_names
Tom Tromey
tromey@sourceware.org
Tue Mar 4 04:05:12 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef8975b494c8c9bca73cda76c33244bb5fd1677f
commit ef8975b494c8c9bca73cda76c33244bb5fd1677f
Author: Tom Tromey <tom@tromey.com>
Date: Thu Feb 13 17:47:23 2025 -0700
Display entry offset for .debug_names
Since commit ad6dde5aaae ("gdb/dwarf: write offset to parent entry for
DW_IDX_parent"), gdb now emits a .debug_names where the DW_IDX_parent
attribute refers to the parent entry's offset -- previously, due to
some confusion in the standard, gdb used the index of the parent's
name table entry.
This patch changes the .debug_names display code to display each
entry's offset. This makes it easy to refer from a DW_IDX_parent to
the correct entry.
The new output looks like this:
[...]
Symbol table:
[ 1] circular1: <0><1> DW_TAG_module DW_IDX_compile_unit=1 DW_IDX_die_offset=<0x19> DW_IDX_GNU_language=19
[...]
[ 6] found: <0x28><2> DW_TAG_subprogram DW_IDX_compile_unit=1 DW_IDX_die_offset=<0x38> DW_IDX_GNU_language=19 DW_IDX_parent=<0x0>
Here you can see that DW_IDX_parent=0 refers to "circular1: <0>".
Diff:
---
binutils/dwarf.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index fcf32ec6703..08bb623e405 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -10828,6 +10828,7 @@ display_debug_names (struct dwarf_section *section, void *file)
uint64_t abbrev_tag;
uint64_t dwarf_tag;
const struct abbrev_lookup_entry *entry;
+ uint64_t this_entry = entryptr - entry_pool;
READ_ULEB (abbrev_tag, entryptr, unit_end);
if (tagno == -1)
@@ -10840,9 +10841,9 @@ display_debug_names (struct dwarf_section *section, void *file)
if (abbrev_tag == 0)
break;
if (tagno >= 0)
- printf ("%s<%" PRIu64 ">",
+ printf ("%s<%#" PRIx64 "><%" PRIu64 ">",
(tagno == 0 && second_abbrev_tag == 0 ? " " : "\n\t"),
- abbrev_tag);
+ this_entry, abbrev_tag);
for (entry = abbrev_lookup;
entry < abbrev_lookup + abbrev_lookup_used;
More information about the Binutils-cvs
mailing list