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

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