|
|
ed07ac |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
ed07ac |
From: Fedora GDB patches <invalid@email.com>
|
|
|
ed07ac |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
ed07ac |
Subject: gdb-physname-pr12273-test.patch
|
|
|
ed07ac |
|
|
|
ed07ac |
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
|
|
ed07ac |
;;=fedoratest
|
|
|
ed07ac |
|
|
|
ed07ac |
http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html
|
|
|
ed07ac |
|
|
|
ed07ac |
diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc
|
|
|
ed07ac |
new file mode 100644
|
|
|
ed07ac |
--- /dev/null
|
|
|
ed07ac |
+++ b/gdb/testsuite/gdb.cp/pr12273.cc
|
|
|
ed07ac |
@@ -0,0 +1,37 @@
|
|
|
ed07ac |
+/* This test case is part of GDB, the GNU debugger.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+ Copyright 2010 Free Software Foundation, Inc.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+ This program is free software; you can redistribute it and/or modify
|
|
|
ed07ac |
+ it under the terms of the GNU General Public License as published by
|
|
|
ed07ac |
+ the Free Software Foundation; either version 3 of the License, or
|
|
|
ed07ac |
+ (at your option) any later version.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+ This program is distributed in the hope that it will be useful,
|
|
|
ed07ac |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ed07ac |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ed07ac |
+ GNU General Public License for more details.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+ You should have received a copy of the GNU General Public License
|
|
|
ed07ac |
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+template <typename T>
|
|
|
ed07ac |
+class GDB
|
|
|
ed07ac |
+{
|
|
|
ed07ac |
+ public:
|
|
|
ed07ac |
+ static int simple (void) { return 0; }
|
|
|
ed07ac |
+ static int harder (T a) { return 1; }
|
|
|
ed07ac |
+ template <typename X>
|
|
|
ed07ac |
+ static X even_harder (T a) { return static_cast<X> (a); }
|
|
|
ed07ac |
+ int operator == (GDB const& other)
|
|
|
ed07ac |
+ { return 1; }
|
|
|
ed07ac |
+};
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+int main(int argc, char **argv)
|
|
|
ed07ac |
+{
|
|
|
ed07ac |
+ GDB<int> a, b;
|
|
|
ed07ac |
+ if (a == b)
|
|
|
ed07ac |
+ return GDB<char>::harder('a') + GDB<int>::harder(3)
|
|
|
ed07ac |
+ + GDB<char>::even_harder<int> ('a');
|
|
|
ed07ac |
+ return GDB<int>::simple ();
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
diff --git a/gdb/testsuite/gdb.cp/pr12273.exp b/gdb/testsuite/gdb.cp/pr12273.exp
|
|
|
ed07ac |
new file mode 100644
|
|
|
ed07ac |
--- /dev/null
|
|
|
ed07ac |
+++ b/gdb/testsuite/gdb.cp/pr12273.exp
|
|
|
ed07ac |
@@ -0,0 +1,46 @@
|
|
|
ed07ac |
+# Copyright 2010 Free Software Foundation, Inc.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# Contributed by Red Hat, originally written by Keith Seitz.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ed07ac |
+# it under the terms of the GNU General Public License as published by
|
|
|
ed07ac |
+# the Free Software Foundation; either version 3 of the License, or
|
|
|
ed07ac |
+# (at your option) any later version.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# This program is distributed in the hope that it will be useful,
|
|
|
ed07ac |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ed07ac |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ed07ac |
+# GNU General Public License for more details.
|
|
|
ed07ac |
+#
|
|
|
ed07ac |
+# You should have received a copy of the GNU General Public License
|
|
|
ed07ac |
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# This file is part of the gdb testsuite.
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+if {[skip_cplus_tests]} { continue }
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+set testfile "pr12273"
|
|
|
ed07ac |
+# Do NOT compile with debug flag.
|
|
|
ed07ac |
+prepare_for_testing pr12273 $testfile $testfile.cc {c++}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_test_no_output "set language c++"
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+# A list of minimal symbol names to check.
|
|
|
ed07ac |
+# Note that GDB<char>::even_harder<int>(char) is quoted and includes
|
|
|
ed07ac |
+# the return type. This is necessary because this is the demangled name
|
|
|
ed07ac |
+# of the minimal symbol.
|
|
|
ed07ac |
+set min_syms [list \
|
|
|
ed07ac |
+ "GDB<int>::operator ==" \
|
|
|
ed07ac |
+ "GDB<int>::operator==(GDB<int> const&)" \
|
|
|
ed07ac |
+ "GDB<char>::harder(char)" \
|
|
|
ed07ac |
+ "GDB<int>::harder(int)" \
|
|
|
ed07ac |
+ {"int GDB<char>::even_harder<int>(char)"} \
|
|
|
ed07ac |
+ "GDB<int>::simple()"]
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+foreach sym $min_syms {
|
|
|
ed07ac |
+ if {[gdb_breakpoint $sym]} {
|
|
|
ed07ac |
+ pass "setting breakpoint at $sym"
|
|
|
ed07ac |
+ }
|
|
|
ed07ac |
+}
|
|
|
ed07ac |
+
|
|
|
ed07ac |
+gdb_exit
|