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

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