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

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