Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.threads / pthread_cond_wait.exp
blob91b695f32e03714d3e8c34f29bac696ec3e5af03
1 # Copyright (C) 2004 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@gnu.org
20 # This file verifies that GDB is able to compute a backtrace for a thread
21 # being blocked on a call to pthread_cond_wait().
23 if $tracelevel then {
24 strace $tracelevel
27 set testfile "pthread_cond_wait"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
31 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
32 return -1
35 gdb_exit
36 gdb_start
37 gdb_reinitialize_dir $srcdir/$subdir
38 gdb_load ${binfile}
39 runto_main
41 gdb_test "break break_me" \
42 "Breakpoint 2 at .*: file .*${srcfile}, line .*" \
43 "breakpoint on break_me"
45 gdb_test "continue" \
46 ".*Breakpoint 2, break_me ().*" \
47 "run to break_me"
50 # Backtrace all threads, find the one running noreturn, and
51 # verify that we are able to get a sensible backtrace, including
52 # the frame for the pthread_cond_wait() call.
54 # The string below will only match if the functions named
55 # occur in a single thread's backtrace, in the given order.
58 global hex
59 global decimal
62 # This is a "backtrace break" ("btb"):
64 set btb "\[^\r\n\]+\[\r\n\]+\#${decimal}\[ \t\]+${hex} in "
66 # One of the threads is blocked on a call to pthread_cond_wait, and
67 # we want to verify that we are able to get a sensible backtrace for
68 # that thread. Because we don't know its thread ID, we can't switch
69 # to it before doing the backtrace. So we get a backtrace for all
70 # threads, and verify that one them returns the expected backtrace.
71 gdb_test "thread apply all backtrace" \
72 "pthread_cond_wait${btb}cond_wait${btb}noreturn${btb}forever_pthread.*" \
73 "backtrace in blocked thread"