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

a8223e
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
a8223e
From: Fedora GDB patches <invalid@email.com>
a8223e
Date: Fri, 27 Oct 2017 21:07:50 +0200
a8223e
Subject: gdb-physname-pr11734-test.patch
a8223e
a8223e
;; Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
a8223e
;;=fedoratest
a8223e
a8223e
http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html
a8223e
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734-1.cc
a8223e
@@ -0,0 +1,29 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2010 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+   Please email any bugs, comments, and/or additions to this file to:
a8223e
+   bug-gdb@gnu.org  */
a8223e
+
a8223e
+#include "pr11734.h"
a8223e
+
a8223e
+int
a8223e
+main ()
a8223e
+{
a8223e
+  pr11734 *p = new pr11734;
a8223e
+  p->foo ();
a8223e
+  return 0;
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734-2.cc b/gdb/testsuite/gdb.cp/pr11734-2.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734-2.cc
a8223e
@@ -0,0 +1,26 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2010 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+   Please email any bugs, comments, and/or additions to this file to:
a8223e
+   bug-gdb@gnu.org  */
a8223e
+
a8223e
+#include "pr11734.h"
a8223e
+
a8223e
+void
a8223e
+pr11734::foo(void)
a8223e
+{
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734-3.cc b/gdb/testsuite/gdb.cp/pr11734-3.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734-3.cc
a8223e
@@ -0,0 +1,26 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2010 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+   Please email any bugs, comments, and/or additions to this file to:
a8223e
+   bug-gdb@gnu.org  */
a8223e
+
a8223e
+#include "pr11734.h"
a8223e
+
a8223e
+void
a8223e
+pr11734::foo (int a)
a8223e
+{
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734-4.cc b/gdb/testsuite/gdb.cp/pr11734-4.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734-4.cc
a8223e
@@ -0,0 +1,26 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2010 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+   Please email any bugs, comments, and/or additions to this file to:
a8223e
+   bug-gdb@gnu.org  */
a8223e
+
a8223e
+#include "pr11734.h"
a8223e
+
a8223e
+void
a8223e
+pr11734::foo (char *a)
a8223e
+{
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734.exp b/gdb/testsuite/gdb.cp/pr11734.exp
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734.exp
a8223e
@@ -0,0 +1,55 @@
a8223e
+# Copyright 2010 Free Software Foundation, Inc.
a8223e
+#
a8223e
+# Contributed by Red Hat, originally written by Keith Seitz.
a8223e
+#
a8223e
+# This program is free software; you can redistribute it and/or modify
a8223e
+# it under the terms of the GNU General Public License as published by
a8223e
+# the Free Software Foundation; either version 3 of the License, or
a8223e
+# (at your option) any later version.
a8223e
+#
a8223e
+# This program is distributed in the hope that it will be useful,
a8223e
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+# GNU General Public License for more details.
a8223e
+#
a8223e
+# You should have received a copy of the GNU General Public License
a8223e
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+# This file is part of the gdb testsuite.
a8223e
+
a8223e
+if { [skip_cplus_tests] } { continue }
a8223e
+
a8223e
+set testfile "pr11734"
a8223e
+set class $testfile
a8223e
+
a8223e
+set srcfiles {}
a8223e
+for {set i 1} {$i < 5} {incr i} {
a8223e
+    lappend srcfiles $testfile-$i.cc
a8223e
+}
a8223e
+
a8223e
+prepare_for_testing pr11734 $testfile $srcfiles {c++ debug}
a8223e
+
a8223e
+if {![runto_main]} {
a8223e
+    perror "couldn't run to breakpoint"
a8223e
+    continue
a8223e
+}
a8223e
+
a8223e
+# An array holding the overload types for the method pr11734::foo.  The
a8223e
+# first element is the overloaded method parameter.  The second element
a8223e
+# is the expected source file number, e.g. "pr11734-?.cc".
a8223e
+array set tests {
a8223e
+    "char*"  4
a8223e
+    "int"    3
a8223e
+    ""       2
a8223e
+}
a8223e
+
a8223e
+# Test each overload instance twice: once quoted, once unquoted
a8223e
+foreach ovld [array names tests] {
a8223e
+    set method "${class}::foo\($ovld\)"
a8223e
+    set result "Breakpoint (\[0-9\]).*file .*/$class-$tests($ovld).*"
a8223e
+    gdb_test "break $method" $result
a8223e
+    gdb_test "break '$method'" $result
a8223e
+}
a8223e
+
a8223e
+gdb_exit
a8223e
+return 0
a8223e
diff --git a/gdb/testsuite/gdb.cp/pr11734.h b/gdb/testsuite/gdb.cp/pr11734.h
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/pr11734.h
a8223e
@@ -0,0 +1,27 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2010 Free Software Foundation, Inc.
a8223e
+
a8223e
+   This program is free software; you can redistribute it and/or modify
a8223e
+   it under the terms of the GNU General Public License as published by
a8223e
+   the Free Software Foundation; either version 3 of the License, or
a8223e
+   (at your option) any later version.
a8223e
+
a8223e
+   This program is distributed in the hope that it will be useful,
a8223e
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
a8223e
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a8223e
+   GNU General Public License for more details.
a8223e
+
a8223e
+   You should have received a copy of the GNU General Public License
a8223e
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
a8223e
+
a8223e
+   Please email any bugs, comments, and/or additions to this file to:
a8223e
+   bug-gdb@gnu.org  */
a8223e
+
a8223e
+class pr11734
a8223e
+{
a8223e
+ public:
a8223e
+  void foo ();
a8223e
+  void foo (int);
a8223e
+  void foo (char *);
a8223e
+};