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

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