Blame SOURCES/gdb-6.3-bz202689-exec-from-pthread-test.patch

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