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