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

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