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

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