2 # Free Software Foundation, Inc.
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.
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.
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/>.
17 # This only works with native configurations
22 load_lib mi-support.exp
33 set testfile "non-stop-exit"
34 set srcfile "$testfile.c"
35 set binfile "$objdir/$subdir/mi-$testfile"
37 set options [list debug incdir=$objdir]
38 if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
42 mi_gdb_reinitialize_dir $srcdir/$subdir
46 send_gdb "-gdb-show non-stop\n"
48 -re ".*\\^done,value=\"off\",supported=\"(\[^\"\]+)\"\r\n$mi_gdb_prompt$" {
49 if { $expect_out(1,string) == "1" } {
53 -re ".$mi_gdb_prompt$" {
57 mi_gdb_test "-gdb-set non-stop 1" ".*"
58 mi_gdb_test "-gdb-set target-async 1" ".*"
61 mi_gdb_test "200-break-insert -t main" ".*"
63 set created "=thread-created,id=\"$decimal\"\r\n"
64 set running "\\*running,thread-id=\"$decimal\"\r\n"
66 set notifs "($created)*($running)*($library_loaded_re)*"
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.
71 send_gdb "-exec-run\n"
73 -re "\\^running\r\n$notifs$mi_gdb_prompt" {
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"
79 -re "\r\n$mi_gdb_prompt" {
80 perror "Cannot start target (unknown output after running)"
84 perror "Cannot start target (timeout)"
88 mi_expect_stop "breakpoint-hit" main ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "run to main"
90 mi_send_resuming_command "exec-continue" "continue"
92 mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue"
94 # Run the program again.
96 mi_gdb_test "200-break-insert -t main" ".*"
98 mi_send_resuming_command "exec-run" "run (2)"
100 mi_expect_stop "breakpoint-hit" main ".*" ".*" "\[0-9\]+" { "" "disp=\"del\"" } "run to main (2)"
102 mi_send_resuming_command "exec-continue" "continue (2)"
104 mi_expect_stop "exited-normally" "" "" "" "" "" "finished exec continue (2)"