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

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