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

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