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

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