* gdb.threads/pthreads.exp: Enable on non-native configurations.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-pthreads.exp
1 # Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 # This file tests MI thread commands.
18 # Specifically, we are testing the MI command set and the console (in MI)
19 # command set ("interpreter-exec") and that the commands that are executed
20 # via these command pathways are properly executed. Console commands
21 # executed via MI should use MI output wrappers, MI event handlers, etc.
22
23 load_lib mi-support.exp
24 set MIFLAGS "-i=mi"
25
26 gdb_exit
27 if {[mi_gdb_start]} {
28 continue
29 }
30
31 # This procedure tests the various thread commands in MI.
32 proc check_mi_thread_command_set {} {
33
34 mi_runto done_making_threads
35
36 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
37
38 mi_gdb_test "-thread-select" \
39 {\^error,msg="-thread-select: USAGE: threadnum."} \
40 "check_mi_thread_command_set: -thread-select"
41
42 mi_gdb_test "-thread-select 123456789" \
43 {&.*\^error,msg="Thread ID 123456789 not known\."} \
44 "check_mi_thread_command_set: -thread-select 123456789"
45
46 foreach thread $thread_list {
47 # line and file are optional.
48 # many of the threads are blocked in libc calls,
49 # and many people have libc's with no symbols.
50 mi_gdb_test "-thread-select $thread" \
51 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
52 "check_mi_thread_command_set: -thread-select $thread"
53 }
54
55 foreach thread $thread_list {
56 mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
57 ".*\\^done\r\n=thread-selected,id=\"$thread\"" \
58 "check =thread-selected: thread $thread"
59 }
60 }
61
62 #
63 # Start here
64 #
65 set testfile "pthreads"
66 set srcfile "$testfile.c"
67 set binfile "$objdir/$subdir/mi-$testfile"
68
69 set options [list debug incdir=$objdir]
70 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
71 return -1
72 }
73
74 mi_gdb_reinitialize_dir $srcdir/$subdir
75 mi_gdb_load $binfile
76
77 check_mi_thread_command_set
78
79 mi_gdb_exit
80
This page took 0.033895 seconds and 5 git commands to generate.