Blame SOURCES/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch

b94e32
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
b94e32
From: Fedora GDB patches <invalid@email.com>
b94e32
Date: Fri, 27 Oct 2017 21:07:50 +0200
b94e32
Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
b94e32
b94e32
;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
b94e32
;; description: 'C++ (and objc): Internal error on unqualified name
b94e32
;; re-set', PR 11657] (RH BZ 1186476).
b94e32
;;=fedoratest
b94e32
b94e32
Comments from Sergio Durigan Junior:
b94e32
b94e32
  The "proper" fix for this whole problem would be to backport the
b94e32
  "ambiguous linespec" patch series.  However, it is really not
b94e32
  recommended to do that for RHEL GDB, because the patch series is too
b94e32
  big and could introduce unwanted regressions.  Instead, what we
b94e32
  chose to do was to replace the gdb_assert call by a warning (which
b94e32
  allows the user to continue the debugging session), and tell the
b94e32
  user that, although more than one location was found for his/her
b94e32
  breakpoint, only one will be used.
b94e32
b94e32
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
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc
b94e32
@@ -0,0 +1,22 @@
b94e32
+/* This testcase is part of GDB, the GNU debugger.
b94e32
+
b94e32
+   Copyright 2015 Free Software Foundation, Inc.
b94e32
+
b94e32
+   This program is free software; you can redistribute it and/or modify
b94e32
+   it under the terms of the GNU General Public License as published by
b94e32
+   the Free Software Foundation; either version 3 of the License, or
b94e32
+   (at your option) any later version.
b94e32
+
b94e32
+   This program is distributed in the hope that it will be useful,
b94e32
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
b94e32
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b94e32
+   GNU General Public License for more details.
b94e32
+
b94e32
+   You should have received a copy of the GNU General Public License
b94e32
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
b94e32
+
b94e32
+int
b94e32
+main (int argc, char *argv[])
b94e32
+{
b94e32
+  return 0;
b94e32
+}
b94e32
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
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc
b94e32
@@ -0,0 +1,26 @@
b94e32
+/* This testcase is part of GDB, the GNU debugger.
b94e32
+
b94e32
+   Copyright 2015 Free Software Foundation, Inc.
b94e32
+
b94e32
+   This program is free software; you can redistribute it and/or modify
b94e32
+   it under the terms of the GNU General Public License as published by
b94e32
+   the Free Software Foundation; either version 3 of the License, or
b94e32
+   (at your option) any later version.
b94e32
+
b94e32
+   This program is distributed in the hope that it will be useful,
b94e32
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
b94e32
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b94e32
+   GNU General Public License for more details.
b94e32
+
b94e32
+   You should have received a copy of the GNU General Public License
b94e32
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
b94e32
+
b94e32
+class C
b94e32
+  {
b94e32
+    public:
b94e32
+      C () {}
b94e32
+      C (int x) {}
b94e32
+  };
b94e32
+
b94e32
+C a;
b94e32
+C b (1);
b94e32
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
b94e32
new file mode 100644
b94e32
--- /dev/null
b94e32
+++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp
b94e32
@@ -0,0 +1,51 @@
b94e32
+# Copyright 2015 Free Software Foundation, Inc.
b94e32
+
b94e32
+# This program is free software; you can redistribute it and/or modify
b94e32
+# it under the terms of the GNU General Public License as published by
b94e32
+# the Free Software Foundation; either version 3 of the License, or
b94e32
+# (at your option) any later version.
b94e32
+#
b94e32
+# This program is distributed in the hope that it will be useful,
b94e32
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
b94e32
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b94e32
+# GNU General Public License for more details.
b94e32
+#
b94e32
+# You should have received a copy of the GNU General Public License
b94e32
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
b94e32
+
b94e32
+if { [skip_cplus_tests] } { continue }
b94e32
+if { [skip_shlib_tests] } { continue }
b94e32
+if { [is_remote target] } { continue }
b94e32
+if { [target_info exists use_gdb_stub] } { continue }
b94e32
+
b94e32
+set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main
b94e32
+set srcfile $testfile.cc
b94e32
+set executable $testfile
b94e32
+set binfile [standard_output_file $executable]
b94e32
+
b94e32
+set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set
b94e32
+set libsrcfile $libtestfile.cc
b94e32
+set sofile [standard_output_file lib$libtestfile.so]
b94e32
+
b94e32
+# Create and source the file that provides information about the compiler
b94e32
+# used to compile the test case.
b94e32
+if [get_compiler_info "c++"] {
b94e32
+    return -1
b94e32
+}
b94e32
+
b94e32
+if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != ""
b94e32
+     || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} {
b94e32
+    untested $libtestfile.exp
b94e32
+    return -1
b94e32
+}
b94e32
+
b94e32
+clean_restart $executable
b94e32
+
b94e32
+gdb_test_no_output "set breakpoint pending on"
b94e32
+# gdb_breakpoint would print a failure because of some warning messages
b94e32
+gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending."
b94e32
+
b94e32
+#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.*"
b94e32
+gdb_test "run"
b94e32
+
b94e32
+gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*"