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