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

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