Blame SOURCES/gdb-physname-pr12273-test.patch

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