[PATCH] Display entry offset for .debug_names

Jan Beulich jbeulich@suse.com
Wed Feb 26 15:00:18 GMT 2025


On 20.02.2025 19:36, Tom Tromey wrote:
> 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: <0x0><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=0
> 
> Here you can see that DW_IDX_parent=0 refers to "circular1: <0x0>".

Which doesn't match up - it's two different forms of zero. Apparently because ...

> @@ -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<0x%" PRIx64 "><%" PRIu64 ">",

... you don't use %#"PRIx64 here, whereas read_and_display_attr_value() looks
to be doing so quite consistently.

Okay with a respective adjustment.

Jan


More information about the Binutils mailing list