Blame SOURCES/gdb-rhbz1186476-internal-error-unqualified-name-re-set-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-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
a8223e
a8223e
;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
a8223e
;; description: 'C++ (and objc): Internal error on unqualified name
a8223e
;; re-set', PR 11657] (RH BZ 1186476).
a8223e
;;=fedoratest
a8223e
a8223e
Comments from Sergio Durigan Junior:
a8223e
a8223e
  The "proper" fix for this whole problem would be to backport the
a8223e
  "ambiguous linespec" patch series.  However, it is really not
a8223e
  recommended to do that for RHEL GDB, because the patch series is too
a8223e
  big and could introduce unwanted regressions.  Instead, what we
a8223e
  chose to do was to replace the gdb_assert call by a warning (which
a8223e
  allows the user to continue the debugging session), and tell the
a8223e
  user that, although more than one location was found for his/her
a8223e
  breakpoint, only one will be used.
a8223e
a8223e
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
a8223e
@@ -0,0 +1,22 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2015 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
+int
a8223e
+main (int argc, char *argv[])
a8223e
+{
a8223e
+  return 0;
a8223e
+}
a8223e
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
a8223e
@@ -0,0 +1,26 @@
a8223e
+/* This testcase is part of GDB, the GNU debugger.
a8223e
+
a8223e
+   Copyright 2015 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
+class C
a8223e
+  {
a8223e
+    public:
a8223e
+      C () {}
a8223e
+      C (int x) {}
a8223e
+  };
a8223e
+
a8223e
+C a;
a8223e
+C b (1);
a8223e
diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
a8223e
new file mode 100644
a8223e
--- /dev/null
a8223e
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
a8223e
@@ -0,0 +1,51 @@
a8223e
+# Copyright 2015 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
+if { [skip_cplus_tests] } { continue }
a8223e
+if { [skip_shlib_tests] } { continue }
a8223e
+if { [is_remote target] } { continue }
a8223e
+if { [target_info exists use_gdb_stub] } { continue }
a8223e
+
a8223e
+set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main
a8223e
+set srcfile $testfile.cc
a8223e
+set executable $testfile
a8223e
+set binfile [standard_output_file $executable]
a8223e
+
a8223e
+set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set
a8223e
+set libsrcfile $libtestfile.cc
a8223e
+set sofile [standard_output_file lib$libtestfile.so]
a8223e
+
a8223e
+# Create and source the file that provides information about the compiler
a8223e
+# used to compile the test case.
a8223e
+if [get_compiler_info "c++"] {
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != ""
a8223e
+     || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} {
a8223e
+    untested $libtestfile.exp
a8223e
+    return -1
a8223e
+}
a8223e
+
a8223e
+clean_restart $executable
a8223e
+
a8223e
+gdb_test_no_output "set breakpoint pending on"
a8223e
+# gdb_breakpoint would print a failure because of some warning messages
a8223e
+gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending."
a8223e
+
a8223e
+#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*"
a8223e
+gdb_test "run"
a8223e
+
a8223e
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"