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

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