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

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