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

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