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

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