* lib/gdb.exp (gdb_compile_test): New.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-nonstop-exit.exp
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
17 load_lib mi-support.exp
18 set MIFLAGS "-i=mi"
19
20 gdb_exit
21 if {[mi_gdb_start]} {
22 continue
23 }
24
25 #
26 # Start here
27 #
28 set testfile "non-stop-exit"
29 set srcfile "$testfile.c"
30 set binfile "$objdir/$subdir/mi-$testfile"
31
32 set options [list debug incdir=$objdir]
33 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
34 return -1
35 }
36
37 mi_gdb_reinitialize_dir $srcdir/$subdir
38 mi_gdb_load $binfile
39
40 set supported 0
41 send_gdb "-gdb-show non-stop\n"
42 gdb_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
52 mi_gdb_test "-gdb-set non-stop 1" ".*"
53 mi_gdb_test "-gdb-set target-async 1" ".*"
54 detect_async
55
56 if { [mi_run_to_main] < 0 } {
57 perror "mi-nonstop-exit.exp tests suppressed"
58 continue
59 }
60
61 mi_send_resuming_command "exec-continue" "continue"
62
63 mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
64
65 # Run the program again.
66
67 if { [mi_run_to_main] < 0 } {
68 fail "run (2)"
69 continue
70 }
71
72 mi_send_resuming_command "exec-continue" "continue (2)"
73
74 mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
75
76 mi_gdb_exit
This page took 0.031086 seconds and 4 git commands to generate.