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