[readelf] Handle unknown name of main in .gdb_index section
authorTom de Vries <tdevries@suse.de>
Tue, 24 Oct 2023 10:35:08 +0000 (12:35 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 24 Oct 2023 10:35:08 +0000 (12:35 +0200)
commit07a9e709114151550177c45dbdc04641dc547189
tree7214d88cbfcb3f2d655614b6de5610840fa4c819
parentf87cf663af71e5d78c8d647fa48562102f3b0615
[readelf] Handle unknown name of main in .gdb_index section

When compiling hello world and adding a v9 .gdb-index section:
...
$ gcc -g hello.c
$ gdb-add-index a.out
...
readelf shows it as:
...
Shortcut table:
Language of main: unknown: 0
Name of main: ^A
...

The documentation of gdb says about the "Name of main" that:
...
This value must be ignored if the value for the language of main is zero.
...

Implement this approach in display_gdb_index, such that we have instead:
...
Shortcut table:
Language of main: unknown: 0
Name of main: <unknown>
...

Tested on x86_64-linux.

Approved-By: Jan Beulich <jbeulich@suse.com>
binutils/ChangeLog
binutils/dwarf.c