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

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