aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-04-22 11:46:47 -0600
committerTom Tromey <tromey@adacore.com>2019-04-30 07:25:03 -0600
commita776957c8c3a9177345ee7ca91077234ed7f508e (patch)
tree2673729d55c956fc2059b1c71470104b6fbc98e0 /gdb/testsuite
parent066f4018ae7822d81cb6747fd9494e5dd63bfecf (diff)
downloadgdb-a776957c8c3a9177345ee7ca91077234ed7f508e.zip
gdb-a776957c8c3a9177345ee7ca91077234ed7f508e.tar.gz
gdb-a776957c8c3a9177345ee7ca91077234ed7f508e.tar.bz2
Fix crash in dwarf2read.c with template parameters
PR c++/24470 concerns a crash in dwarf2read.c that occurs with a particular test case. The issue turns out to be that process_structure_scope will pass NULL to symbol_symtab. This happens because new_symbol decided not to create a symbol for the particular DIE. This patch fixes the problem by finding another reasonably-appropriate symtab to use instead; issuing a complaint if one cannot be found for some reason. As mentioned in the bug, I think there are other bugs here. For example, when using "ptype" on the "l" object in the test case, I think I would expect to see the template parameter. I didn't research this too closely, since it seemed more important to fix the crash. Tested on x86-64 Fedora 29. I'd like to check this in to the 8.3 branch as well. 2019-04-30 Tom Tromey <tromey@adacore.com> PR c++/24470: * dwarf2read.c (process_structure_scope): Handle case where type has template parameters but no symbol was created. gdb/testsuite/ChangeLog 2019-04-30 Tom Tromey <tromey@adacore.com> PR c++/24470: * gdb.cp/temargs.cc: Add test code from PR.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.cp/temargs.cc23
2 files changed, 28 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d3be74d..41aae07 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-30 Tom Tromey <tromey@adacore.com>
+
+ PR c++/24470:
+ * gdb.cp/temargs.cc: Add test code from PR.
+
2019-04-30 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.fortran/vla-datatypes.exp: Update expected results.
diff --git a/gdb/testsuite/gdb.cp/temargs.cc b/gdb/testsuite/gdb.cp/temargs.cc
index dc06165..d2a85f9 100644
--- a/gdb/testsuite/gdb.cp/temargs.cc
+++ b/gdb/testsuite/gdb.cp/temargs.cc
@@ -80,6 +80,29 @@ struct K3
}
};
+namespace pr24470
+{
+// From PR c++/24470
+// This caused a gdb crash during startup.
+
+template <int a> struct b {};
+template <typename, typename> struct c {
+ template <long d> using e = b<d>;
+ void k(e<0>);
+};
+template <typename, template <typename, typename> class, unsigned long...>
+struct m;
+template <typename g, template <typename, typename> class h, unsigned long i>
+struct m<g, h, i> {
+ using j = b<i>;
+};
+struct n {
+ template <typename g> using f = typename m<g, c, 0>::j;
+};
+
+n::f<int> l;
+}
+
int main ()
{
Base<double, 23, &a_global, &S::f> base;