]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | 2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com> |
2 | ||
3 | * gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files. | |
4 | ||
5 | ||
6 | --- /dev/null 1 Jan 1970 00:00:00 -0000 | |
7 | +++ ./gdb/testsuite/gdb.threads/threaded-exec.c 17 Jan 2007 23:10:22 -0000 | |
8 | @@ -0,0 +1,46 @@ | |
9 | +/* This testcase is part of GDB, the GNU debugger. | |
10 | + | |
11 | + Copyright 2007 Free Software Foundation, Inc. | |
12 | + | |
13 | + This program is free software; you can redistribute it and/or modify | |
14 | + it under the terms of the GNU General Public License as published by | |
15 | + the Free Software Foundation; either version 2 of the License, or | |
16 | + (at your option) any later version. | |
17 | + | |
18 | + This program is distributed in the hope that it will be useful, | |
19 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | + GNU General Public License for more details. | |
22 | + | |
23 | + You should have received a copy of the GNU General Public License | |
24 | + along with this program; if not, write to the Free Software | |
25 | + Foundation, Inc., 59 Temple Place - Suite 330, | |
26 | + Boston, MA 02111-1307, USA. */ | |
27 | + | |
28 | +#include <stddef.h> | |
29 | +#include <pthread.h> | |
30 | +#include <assert.h> | |
31 | +#include <stdlib.h> | |
32 | +#include <unistd.h> | |
33 | + | |
34 | + | |
35 | +static void * | |
36 | +threader (void *arg) | |
37 | +{ | |
38 | + return NULL; | |
39 | +} | |
40 | + | |
41 | +int | |
42 | +main (void) | |
43 | +{ | |
44 | + pthread_t t1; | |
45 | + int i; | |
46 | + | |
47 | + i = pthread_create (&t1, NULL, threader, (void *) NULL); | |
48 | + assert (i == 0); | |
49 | + i = pthread_join (t1, NULL); | |
50 | + assert (i == 0); | |
51 | + | |
52 | + execl ("/bin/true", "/bin/true", NULL); | |
53 | + abort (); | |
54 | +} | |
55 | --- /dev/null 1 Jan 1970 00:00:00 -0000 | |
56 | +++ ./gdb/testsuite/gdb.threads/threaded-exec.exp 17 Jan 2007 23:10:22 -0000 | |
57 | @@ -0,0 +1,41 @@ | |
58 | +# threaded-exec.exp -- Check reset of the tracked threads on exec*(2) | |
59 | +# Copyright (C) 2007 Free Software Foundation, Inc. | |
60 | + | |
61 | +# This program is free software; you can redistribute it and/or modify | |
62 | +# it under the terms of the GNU General Public License as published by | |
63 | +# the Free Software Foundation; either version 2 of the License, or | |
64 | +# (at your option) any later version. | |
65 | +# | |
66 | +# This program is distributed in the hope that it will be useful, | |
67 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
68 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
69 | +# GNU General Public License for more details. | |
70 | +# | |
71 | +# You should have received a copy of the GNU General Public License | |
72 | +# along with this program; if not, write to the Free Software | |
73 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
74 | + | |
75 | +# Please email any bugs, comments, and/or additions to this file to: | |
76 | +# bug-gdb@prep.ai.mit.edu | |
77 | + | |
78 | +set testfile threaded-exec | |
79 | +set srcfile ${testfile}.c | |
80 | +set binfile ${objdir}/${subdir}/${testfile} | |
81 | + | |
82 | +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } { | |
83 | + return -1 | |
84 | +} | |
85 | + | |
86 | +gdb_exit | |
87 | +gdb_start | |
88 | +gdb_reinitialize_dir $srcdir/$subdir | |
89 | + | |
90 | +gdb_load ${binfile} | |
91 | + | |
92 | +gdb_run_cmd | |
93 | + | |
94 | +gdb_test_multiple {} "Program exited" { | |
6ed6bacf | 95 | + -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { |
3a58abaf AM |
96 | + pass "Program exited" |
97 | + } | |
98 | +} |