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