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

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