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

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