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

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