1 Test various forms of threads tracking across exec(2).
3 diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c
4 --- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 17:05:19.000000000 -0400
5 +++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.c 2008-04-16 14:43:50.000000000 -0400
7 Boston, MA 02111-1307, USA. */
18 +# include <pthread.h>
31 +main (int argc, char **argv)
33 + char *exec_nothreads, *exec_threads, *cmd;
37 + setbuf (stdout, NULL);
41 + fprintf (stderr, "%s <non-threaded> <threaded> <phase>\n", argv[0]);
46 + puts ("THREADS: Y");
48 + puts ("THREADS: N");
50 + exec_nothreads = argv[1];
51 + printf ("exec_nothreads: %s\n", exec_nothreads);
52 + exec_threads = argv[2];
53 + printf ("exec_threads: %s\n", exec_threads);
54 + phase = atoi (argv[3]);
55 + printf ("phase: %d\n", phase);
57 + /* Phases: threading
70 + cmd = exec_nothreads;
76 + fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
80 + fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0],
92 + fprintf (stderr, "%s: We should not have threads for phase %d!\n",
96 + fprintf (stderr, "%s: We should not have threads for phase %d!\n",
100 + cmd = exec_threads;
105 @@ -40,7 +114,34 @@ main (void)
107 i = pthread_join (t1, NULL);
112 + cmd = exec_nothreads;
117 + i = pthread_create (&t1, NULL, threader, (void *) NULL);
119 + i = pthread_join (t1, NULL);
124 + fprintf (stderr, "%s: We should not have threads for phase %d!\n",
130 +#endif /* THREADS */
132 + assert (cmd != NULL);
135 + snprintf (phase_s, sizeof phase_s, "%d", phase);
137 - execl ("/bin/true", "/bin/true", NULL);
139 + execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL);
142 diff -up -u -X /root/jkratoch/.diffi.list -rup gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp
143 --- gdb-6.8/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 17:05:19.000000000 -0400
144 +++ gdb-6.8-patched/gdb/testsuite/gdb.threads/threaded-exec.exp 2008-04-16 14:42:49.000000000 -0400
147 set testfile threaded-exec
148 set srcfile ${testfile}.c
149 -set binfile ${objdir}/${subdir}/${testfile}
150 +set binfile_nothreads ${objdir}/${subdir}/${testfile}N
151 +set binfile_threads ${objdir}/${subdir}/${testfile}Y
153 -if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } {
154 +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } {
158 +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } {
162 @@ -30,9 +35,9 @@ gdb_exit
164 gdb_reinitialize_dir $srcdir/$subdir
167 +gdb_load ${binfile_nothreads}
170 +gdb_run_cmd ${binfile_nothreads} ${binfile_threads} 0
172 gdb_test_multiple {} "Program exited" {
173 -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" {