Fix for PR gdb/1543.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-pthreads.exp
1 # Copyright 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
2
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 3 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.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # This file tests MI thread commands.
17 # Specifically, we are testing the MI command set and the console (in MI)
18 # command set ("interpreter-exec") and that the commands that are executed
19 # via these command pathways are properly executed. Console commands
20 # executed via MI should use MI output wrappers, MI event handlers, etc.
21
22 # This only works with native configurations
23 if {![isnative]} {
24 return
25 }
26
27 load_lib mi-support.exp
28 set MIFLAGS "-i=mi2"
29
30 gdb_exit
31 if {[mi_gdb_start]} {
32 continue
33 }
34
35 # This procedure tests the various thread commands in MI.
36 proc check_mi_thread_command_set {} {
37
38 mi_runto done_making_threads
39
40 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
41
42 mi_gdb_test "-thread-select" \
43 {\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \
44 "check_mi_thread_command_set: -thread-select"
45
46 mi_gdb_test "-thread-select 123456789" \
47 {&.*\^error,msg="Thread ID 123456789 not known\."} \
48 "check_mi_thread_command_set: -thread-select 123456789"
49
50 foreach thread $thread_list {
51 # line and file are optional.
52 # many of the threads are blocked in libc calls,
53 # and many people have libc's with no symbols.
54 mi_gdb_test "-thread-select $thread" \
55 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
56 "check_mi_thread_command_set: -thread-select $thread"
57 }
58 }
59
60 #
61 # Start here
62 #
63 set testfile "pthreads"
64 set srcfile "$testfile.c"
65 set binfile "$objdir/$subdir/mi2-$testfile"
66
67 set options [list debug incdir=$objdir]
68 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
69 return -1
70 }
71
72 mi_gdb_reinitialize_dir $srcdir/$subdir
73 mi_gdb_load $binfile
74
75 check_mi_thread_command_set
76
77 mi_gdb_exit
78
This page took 0.031175 seconds and 4 git commands to generate.