|
|
132741 |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
132741 |
From: Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
132741 |
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
132741 |
Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
|
|
132741 |
|
|
|
132741 |
;; Testcase for exec() from threaded program (BZ 202689).
|
|
|
132741 |
;;=fedoratest
|
|
|
132741 |
|
|
|
132741 |
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
132741 |
|
|
|
132741 |
* gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files.
|
|
|
132741 |
|
|
|
132741 |
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c
|
|
|
132741 |
new file mode 100644
|
|
|
132741 |
--- /dev/null
|
|
|
132741 |
+++ b/gdb/testsuite/gdb.threads/threaded-exec.c
|
|
|
132741 |
@@ -0,0 +1,46 @@
|
|
|
132741 |
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
132741 |
+
|
|
|
132741 |
+ Copyright 2007 Free Software Foundation, Inc.
|
|
|
132741 |
+
|
|
|
132741 |
+ This program is free software; you can redistribute it and/or modify
|
|
|
132741 |
+ it under the terms of the GNU General Public License as published by
|
|
|
132741 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
132741 |
+ (at your option) any later version.
|
|
|
132741 |
+
|
|
|
132741 |
+ This program is distributed in the hope that it will be useful,
|
|
|
132741 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
132741 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
132741 |
+ GNU General Public License for more details.
|
|
|
132741 |
+
|
|
|
132741 |
+ You should have received a copy of the GNU General Public License
|
|
|
132741 |
+ along with this program; if not, write to the Free Software
|
|
|
132741 |
+ Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
132741 |
+ Boston, MA 02111-1307, USA. */
|
|
|
132741 |
+
|
|
|
132741 |
+#include <stddef.h>
|
|
|
132741 |
+#include <pthread.h>
|
|
|
132741 |
+#include <assert.h>
|
|
|
132741 |
+#include <stdlib.h>
|
|
|
132741 |
+#include <unistd.h>
|
|
|
132741 |
+
|
|
|
132741 |
+
|
|
|
132741 |
+static void *
|
|
|
132741 |
+threader (void *arg)
|
|
|
132741 |
+{
|
|
|
132741 |
+ return NULL;
|
|
|
132741 |
+}
|
|
|
132741 |
+
|
|
|
132741 |
+int
|
|
|
132741 |
+main (void)
|
|
|
132741 |
+{
|
|
|
132741 |
+ pthread_t t1;
|
|
|
132741 |
+ int i;
|
|
|
132741 |
+
|
|
|
132741 |
+ i = pthread_create (&t1, NULL, threader, (void *) NULL);
|
|
|
132741 |
+ assert (i == 0);
|
|
|
132741 |
+ i = pthread_join (t1, NULL);
|
|
|
132741 |
+ assert (i == 0);
|
|
|
132741 |
+
|
|
|
132741 |
+ execl ("/bin/true", "/bin/true", NULL);
|
|
|
132741 |
+ abort ();
|
|
|
132741 |
+}
|
|
|
132741 |
diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
|
|
132741 |
new file mode 100644
|
|
|
132741 |
--- /dev/null
|
|
|
132741 |
+++ b/gdb/testsuite/gdb.threads/threaded-exec.exp
|
|
|
132741 |
@@ -0,0 +1,41 @@
|
|
|
132741 |
+# threaded-exec.exp -- Check reset of the tracked threads on exec*(2)
|
|
|
132741 |
+# Copyright (C) 2007 Free Software Foundation, Inc.
|
|
|
132741 |
+
|
|
|
132741 |
+# This program is free software; you can redistribute it and/or modify
|
|
|
132741 |
+# it under the terms of the GNU General Public License as published by
|
|
|
132741 |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
132741 |
+# (at your option) any later version.
|
|
|
132741 |
+#
|
|
|
132741 |
+# This program is distributed in the hope that it will be useful,
|
|
|
132741 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
132741 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
132741 |
+# GNU General Public License for more details.
|
|
|
132741 |
+#
|
|
|
132741 |
+# You should have received a copy of the GNU General Public License
|
|
|
132741 |
+# along with this program; if not, write to the Free Software
|
|
|
132741 |
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
132741 |
+
|
|
|
132741 |
+# Please email any bugs, comments, and/or additions to this file to:
|
|
|
132741 |
+# bug-gdb@prep.ai.mit.edu
|
|
|
132741 |
+
|
|
|
132741 |
+set testfile threaded-exec
|
|
|
132741 |
+set srcfile ${testfile}.c
|
|
|
132741 |
+set binfile [standard_output_file ${testfile}]
|
|
|
132741 |
+
|
|
|
132741 |
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
|
|
|
132741 |
+ return -1
|
|
|
132741 |
+}
|
|
|
132741 |
+
|
|
|
132741 |
+gdb_exit
|
|
|
132741 |
+gdb_start
|
|
|
132741 |
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
132741 |
+
|
|
|
132741 |
+gdb_load ${binfile}
|
|
|
132741 |
+
|
|
|
132741 |
+gdb_run_cmd
|
|
|
132741 |
+
|
|
|
132741 |
+gdb_test_multiple {} "Program exited" {
|
|
|
132741 |
+ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {
|
|
|
132741 |
+ pass "Program exited"
|
|
|
132741 |
+ }
|
|
|
132741 |
+}
|