Blame SOURCES/gdb-archer-next-over-throw-cxx-exec.patch

79b363
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
79b363
From: Fedora GDB patches <invalid@email.com>
79b363
Date: Fri, 27 Oct 2017 21:07:50 +0200
79b363
Subject: gdb-archer-next-over-throw-cxx-exec.patch
79b363
79b363
;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
79b363
;;=fedoratest
79b363
79b363
Archer-upstreamed:
79b363
http://sourceware.org/ml/archer/2010-q2/msg00031.html
79b363
79b363
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
79b363
new file mode 100644
79b363
--- /dev/null
79b363
+++ b/gdb/testsuite/gdb.cp/cxxexec.cc
79b363
@@ -0,0 +1,25 @@
79b363
+/* This test script is part of GDB, the GNU debugger.
79b363
+
79b363
+   Copyright 2010 Free Software Foundation, Inc.
79b363
+
79b363
+   This program is free software; you can redistribute it and/or modify
79b363
+   it under the terms of the GNU General Public License as published by
79b363
+   the Free Software Foundation; either version 3 of the License, or
79b363
+   (at your option) any later version.
79b363
+
79b363
+   This program is distributed in the hope that it will be useful,
79b363
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
79b363
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
79b363
+   GNU General Public License for more details.
79b363
+
79b363
+   You should have received a copy of the GNU General Public License
79b363
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
79b363
+
79b363
+#include <unistd.h>
79b363
+
79b363
+int
79b363
+main()
79b363
+{
79b363
+  execlp ("true", "true", NULL);
79b363
+  return 1;
79b363
+}
79b363
diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
79b363
new file mode 100644
79b363
--- /dev/null
79b363
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
79b363
@@ -0,0 +1,42 @@
79b363
+# Copyright 2010 Free Software Foundation, Inc.
79b363
+
79b363
+# This program is free software; you can redistribute it and/or modify
79b363
+# it under the terms of the GNU General Public License as published by
79b363
+# the Free Software Foundation; either version 3 of the License, or
79b363
+# (at your option) any later version.
79b363
+#
79b363
+# This program is distributed in the hope that it will be useful,
79b363
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
79b363
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
79b363
+# GNU General Public License for more details.
79b363
+#
79b363
+# You should have received a copy of the GNU General Public License
79b363
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
79b363
+
79b363
+if { [skip_cplus_tests] } { continue }
79b363
+
79b363
+set testfile cxxexec
79b363
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
79b363
+    return -1
79b363
+}
79b363
+
79b363
+runto_main
79b363
+
79b363
+# We could stop after `continue' again at `main'.
79b363
+delete_breakpoints
79b363
+
79b363
+set test "p _Unwind_DebugHook"
79b363
+gdb_test_multiple $test $test {
79b363
+    -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
79b363
+	pass $test
79b363
+    }
79b363
+    -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
79b363
+	xfail $test
79b363
+	untested ${testfile}.exp
79b363
+	return -1
79b363
+    }
79b363
+}
79b363
+
79b363
+# Run to end.  The buggy GDB failed instead with:
79b363
+#  Cannot access memory at address ADDR.
79b363
+gdb_continue_to_end "" "continue" 1