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

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