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