* thread.c (do_restore_current_thread_cleanup): Redo test for
[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
17# This only works with native configurations
18if {![isnative]} {
19 return
20}
21
22load_lib mi-support.exp
23set MIFLAGS "-i=mi"
24
25gdb_exit
26if {[mi_gdb_start]} {
27 continue
28}
29
30#
31# Start here
32#
33set testfile "non-stop-exit"
34set srcfile "$testfile.c"
35set binfile "$objdir/$subdir/mi-$testfile"
36
37set options [list debug incdir=$objdir]
38if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
39 return -1
40}
41
42mi_gdb_reinitialize_dir $srcdir/$subdir
43mi_gdb_load $binfile
44
45set supported 0
46send_gdb "-gdb-show non-stop\n"
47gdb_expect {
48 -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
49 if { $expect_out(1,string) == "1" } {
50 set supported 1
51 }
52 }
53 -re ".$mi_gdb_prompt$" {
54 }
55}
56
57mi_gdb_test "-gdb-set non-stop 1" ".*"
58mi_gdb_test "-gdb-set target-async 1" ".*"
59detect_async
60
61mi_gdb_test "200-break-insert -t main" ".*"
62
63set created "=thread-created,id=\"$decimal\"\r\n"
64set running "\\*running,thread-id=\"$decimal\"\r\n"
65
66set notifs "($created)*($running)*($library_loaded_re)*"
67
68# Note: presently, we skip this test on non-native targets,
69# so 'run' is OK. As soon as we start to run this on remote
70# target, the logic from mi_run_cmd will have to be refactored.
71send_gdb "-exec-run\n"
72gdb_expect {
73 -re "\\^running\r\n$notifs$mi_gdb_prompt" {
74 }
75 -re "\\^error,msg=\"The target does not support running in non-stop mode.\"" {
76 verbose -log "Non-stop mode not supported, skipping all tests"
77 return
78 }
79 -re "\r\n$mi_gdb_prompt" {
80 perror "Cannot start target (unknown output after running)"
81 return -1
82 }
83 timeout {
84 perror "Cannot start target (timeout)"
85 return -1
86 }
87}
88mi_expect_stop "breakpoint-hit" main ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "run to main"
89
90mi_send_resuming_command "exec-continue" "continue"
91
92mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
93
94# Run the program again.
95
96mi_gdb_test "200-break-insert -t main" ".*"
97
98mi_send_resuming_command "exec-run" "run (2)"
99
100mi_expect_stop "breakpoint-hit" main ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "run to main (2)"
101
102mi_send_resuming_command "exec-continue" "continue (2)"
103
104mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"
105
106mi_gdb_exit
This page took 0.027159 seconds and 4 git commands to generate.