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

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