1 2007-07-07 Jan Kratochvil <jan.kratochvil@redhat.com>
3 * gdb.threads/leader-exit.c, gdb.threads/leader-exit.exp: New files.
5 --- /dev/null 1 Jan 1970 00:00:00 -0000
6 +++ ./gdb/testsuite/gdb.threads/leader-exit.c 7 Jul 2007 15:21:57 -0000
8 +/* Clean exit of the thread group leader should not break GDB.
10 + Copyright 2007 Free Software Foundation, Inc.
12 + This file is part of GDB.
14 + This program is free software; you can redistribute it and/or modify
15 + it under the terms of the GNU General Public License as published by
16 + the Free Software Foundation; either version 2 of the License, or
17 + (at your option) any later version.
19 + This program is distributed in the hope that it will be useful,
20 + but WITHOUT ANY WARRANTY; without even the implied warranty of
21 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 + GNU General Public License for more details.
24 + You should have received a copy of the GNU General Public License
25 + along with this program; if not, write to the Free Software
26 + Foundation, Inc., 59 Temple Place - Suite 330,
27 + Boston, MA 02111-1307, USA. */
33 +static void *start (void *arg)
47 + i = pthread_create (&thread, NULL, start, NULL); /* create1 */
50 + pthread_exit (NULL);
55 --- /dev/null 1 Jan 1970 00:00:00 -0000
56 +++ ./gdb/testsuite/gdb.threads/leader-exit.exp 7 Jul 2007 15:21:57 -0000
58 +# Copyright (C) 2007 Free Software Foundation, Inc.
60 +# This program is free software; you can redistribute it and/or modify
61 +# it under the terms of the GNU General Public License as published by
62 +# the Free Software Foundation; either version 2 of the License, or
63 +# (at your option) any later version.
65 +# This program is distributed in the hope that it will be useful,
66 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
67 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 +# GNU General Public License for more details.
70 +# You should have received a copy of the GNU General Public License
71 +# along with this program; if not, write to the Free Software
72 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
74 +# Exit of the thread group leader should not break GDB.
76 +# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>.
78 +if $tracelevel then {
82 +set testfile "leader-exit"
83 +set srcfile ${testfile}.c
84 +set binfile ${objdir}/${subdir}/${testfile}
86 +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
92 +gdb_reinitialize_dir $srcdir/$subdir
96 +proc stop_process { description } {
99 + # For this to work we must be sure to consume the "Continuing."
100 + # message first, or GDB's signal handler may not be in place.
101 + after 1000 {send_gdb "\003"}
103 + -re "Program received signal SIGINT.*$gdb_prompt $"
109 + fail "$description (timeout)"
117 +stop_process "Threads could be stopped"
119 +gdb_test "info threads" \
120 + "\\* 2 Thread \[^\r\n\]* in \[^\r\n\]*" \
121 + "Single thread has been left"