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

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