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

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