Handle either order of name and linkage name
authorTom Tromey <tromey@adacore.com>
Thu, 20 Jun 2019 19:50:15 +0000 (13:50 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 28 Jun 2019 14:37:38 +0000 (08:37 -0600)
commit10d06d821919474afaf59fa24cb10450d2349131
treeae3a55c23d50be60d968c547cb0cd17980db8376
parent7e56c51c7932cfdb178e9457011d09d53e98937b
Handle either order of name and linkage name

We discovered that the Ada support in gdb depends on the order of the
DW_AT_name and DW_AT_linkage_name attributes in the DWARF.  In
particular, if they are emitted in the "wrong" order for some system
symbols, "catch exception" will not work.

This patch fixes this problem by arranging to always prefer the
linkage name if both exist.  This seems to be what the full symbol
reader already does -- that is, this is another bug arising from
having two different DWARF readers.

Another possible issue here is that gdb still doesn't really preserve
mangled names properly.  There's a PR open about this.  However, this
seems to be somewhat involved to fix, which is why this patch
continues to work around the bigger issue.

gdb/ChangeLog
2019-06-28  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (partial_die_info::read): Prefer the linkage name
for Ada.

gdb/testsuite/ChangeLog
2019-06-28  Tom Tromey  <tromey@adacore.com>

* gdb.dwarf2/ada-linkage-name.c: New file.
* gdb.dwarf2/ada-linkage-name.exp: New file.
gdb/ChangeLog
gdb/dwarf2read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/ada-linkage-name.c [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/ada-linkage-name.exp [new file with mode: 0644]