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

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