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
aefb0e1
--- /dev/null	1 Jan 1970 00:00:00 -0000
aefb0e1
+++ ./gdb/testsuite/gdb.threads/threaded-exec.c	17 Jan 2007 23:10:22 -0000
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
+}
aefb0e1
--- /dev/null	1 Jan 1970 00:00:00 -0000
aefb0e1
+++ ./gdb/testsuite/gdb.threads/threaded-exec.exp	17 Jan 2007 23:10:22 -0000
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
aefb0e1
+set binfile ${objdir}/${subdir}/${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" {
aefb0e1
+   -re "\r\nProgram exited normally.\r\n$gdb_prompt $" {
aefb0e1
+       pass "Program exited"
aefb0e1
+   }
aefb0e1
+}