1 # Copyright 2002-2005, 2007-2012 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 3 of the License, or
6 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
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.
22 load_lib mi-support.exp
30 # This procedure tests the various thread commands in MI.
31 proc check_mi_thread_command_set {} {
33 mi_runto done_making_threads
35 set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
37 mi_gdb_test "-thread-select" \
38 {\^error,msg="-thread-select: USAGE: threadnum."} \
39 "check_mi_thread_command_set: -thread-select"
41 mi_gdb_test "-thread-select 123456789" \
42 {&.*\^error,msg="Thread ID 123456789 not known\."} \
43 "check_mi_thread_command_set: -thread-select 123456789"
45 foreach thread $thread_list {
46 # line and file are optional.
47 # many of the threads are blocked in libc calls,
48 # and many people have libc's with no symbols.
49 mi_gdb_test "-thread-select $thread" \
50 "\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
51 "check_mi_thread_command_set: -thread-select $thread"
54 foreach thread $thread_list {
55 mi_gdb_test "-interpreter-exec console \"thread $thread\"" \
56 ".*\\^done\r\n=thread-selected,id=\"$thread\"" \
57 "check =thread-selected: thread $thread"
64 standard_testfile pthreads.c
66 set options [list debug]
67 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
71 mi_gdb_reinitialize_dir $srcdir/$subdir
74 check_mi_thread_command_set