Refactor reading of commands
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-nonstop-exit.exp
CommitLineData
88fc996f
DE
1# Copyright 2009
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
88fc996f
DE
17load_lib mi-support.exp
18set MIFLAGS "-i=mi"
19
20gdb_exit
21if {[mi_gdb_start]} {
22 continue
23}
24
25#
26# Start here
27#
28set testfile "non-stop-exit"
29set srcfile "$testfile.c"
30set binfile "$objdir/$subdir/mi-$testfile"
31
32set options [list debug incdir=$objdir]
33if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
34 return -1
35}
36
37mi_gdb_reinitialize_dir $srcdir/$subdir
38mi_gdb_load $binfile
39
40set supported 0
41send_gdb "-gdb-show non-stop\n"
42gdb_expect {
43 -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
44 if { $expect_out(1,string) == "1" } {
45 set supported 1
46 }
47 }
48 -re ".$mi_gdb_prompt$" {
49 }
50}
51
52mi_gdb_test "-gdb-set non-stop 1" ".*"
53mi_gdb_test "-gdb-set target-async 1" ".*"
54detect_async
55
2ae101a4
PA
56if { [mi_run_to_main] < 0 } {
57 perror "mi-nonstop-exit.exp tests suppressed"
58 continue
88fc996f 59}
88fc996f
DE
60
61mi_send_resuming_command "exec-continue" "continue"
62
63mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
64
65# Run the program again.
66
2ae101a4
PA
67if { [mi_run_to_main] < 0 } {
68 fail "run (2)"
69 continue
70}
88fc996f
DE
71
72mi_send_resuming_command "exec-continue" "continue (2)"
73
74mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
75
76mi_gdb_exit
This page took 0.062973 seconds and 4 git commands to generate.