aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-06-20 13:50:15 -0600
committerTom Tromey <tromey@adacore.com>2019-06-28 08:37:38 -0600
commit10d06d821919474afaf59fa24cb10450d2349131 (patch)
treeae3a55c23d50be60d968c547cb0cd17980db8376 /gdb/dwarf2read.c
parent7e56c51c7932cfdb178e9457011d09d53e98937b (diff)
downloadgdb-10d06d821919474afaf59fa24cb10450d2349131.zip
gdb-10d06d821919474afaf59fa24cb10450d2349131.tar.gz
gdb-10d06d821919474afaf59fa24cb10450d2349131.tar.bz2
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 85f2b1d..d004863 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -18653,8 +18653,6 @@ partial_die_info::read (const struct die_reader_specs *reader,
/* Note that both forms of linkage name might appear. We
assume they will be the same, and we only store the last
one we see. */
- if (cu->language == language_ada)
- name = DW_STRING (&attr);
linkage_name = DW_STRING (&attr);
break;
case DW_AT_low_pc:
@@ -18787,6 +18785,14 @@ partial_die_info::read (const struct die_reader_specs *reader,
}
}
+ /* For Ada, if both the name and the linkage name appear, we prefer
+ the latter. This lets "catch exception" work better, regardless
+ of the order in which the name and linkage name were emitted.
+ Really, though, this is just a workaround for the fact that gdb
+ doesn't store both the name and the linkage name. */
+ if (cu->language == language_ada && linkage_name != nullptr)
+ name = linkage_name;
+
if (high_pc_relative)
highpc += lowpc;