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