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

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