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

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