continue
}
-proc myreverse { list } {
- if { [llength $list] <= 1 } {
- return $list
- }
- set tail [lrange $list 1 [llength $list]]
- set rtail [myreverse $tail]
- lappend rtail [lindex $list 0]
- return $rtail
-}
-
-proc check_thread_states { xstates test } {
- global expect_out
- set states [myreverse $xstates]
- set pattern "\\^done,threads=\\\["
- foreach s $states {
- set pattern "${pattern}(.*)state=\"$s\""
- }
- set pattern "$pattern\\\}\\\].*"
-
- verbose -log "expecting: $pattern"
- mi_gdb_test "-thread-info" $pattern $test
-}
-
#
# Start here
#
detect_async
mi_gdb_test "200-break-insert -t main" ".*"
+
+set created "=thread-created,id=\"$decimal\"\r\n"
+set running "\\*running,thread-id=\"$decimal\"\r\n"
+
+set notifs "($created)*($running)*"
+
# Note: presently, we skip this test on non-native targets,
# so 'run' is OK. As soon as we start to run this on remote
# target, the logic from mi_run_cmd will have to be refactored.
send_gdb "-exec-run\n"
gdb_expect {
- -re ".*\\^running.*$mi_gdb_prompt$" {
+ -re "\\^running\r\n$notifs$mi_gdb_prompt" {
}
-re "\\^error,msg=\"The target does not support running in non-stop mode.\"" {
verbose -log "Non-stop mode not supported, skipping all tests"
return
}
- -re ".*\r\n$mi_gdb_prompt$" {
+ -re "\r\n$mi_gdb_prompt" {
perror "Cannot start target (unknown output after running)"
return -1
}
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w0,i0 stop"
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w1,i0 stop"
-check_thread_states {"running" "stopped" "stopped"} "thread state, stop 1"
+mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 1"
mi_gdb_test "-thread-select 2" "\\^done.*" "select thread 2"
mi_create_varobj I_W0 "i" "create varobj in first thread"
mi_create_varobj I_W1 "i" "create varobj in second thread"
mi_send_resuming_command "exec-continue --thread 2" "resume 1"
-check_thread_states {"running" "running" "stopped"} "thread state, resume 1"
+mi_check_thread_states {"running" "running" "stopped"} "thread state, resume 1"
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w0,i1 stop"
-check_thread_states {"running" "stopped" "stopped"} "thread state, stop 2"
+mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 2"
mi_send_resuming_command "exec-continue --thread 3" "resume 2"
-check_thread_states {"running" "stopped" "running"} "thread state, resume 2"
+mi_check_thread_states {"running" "stopped" "running"} "thread state, resume 2"
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w1,i1 stop"
-check_thread_states {"running" "stopped" "stopped"} "thread state, stop 3"
+mi_check_thread_states {"running" "stopped" "stopped"} "thread state, stop 3"
mi_varobj_update * {I_W1 I_W0} "update varobj, 1"
mi_check_varobj_value I_W0 1 "check varobj, w0, 1"
# thread might not be stopped immediately when we return from the target.
# So, wait a bit
sleep 1
-check_thread_states {"stopped" "stopped" "stopped"} "thread state, stop 4"
+mi_check_thread_states {"stopped" "stopped" "stopped"} "thread state, stop 4"
send_gdb "-exec-continue --all\n"
gdb_expect {
sleep 2
mi_expect_stop "breakpoint-hit" "break_at_me" ".*" "non-stop.c" ".*" {"" "disp=\"keep\""} "w0,i3 stop"
-check_thread_states {"running" "running" "stopped"} "thread state, stop on cond breakpoint"
+mi_check_thread_states {"running" "running" "stopped"} "thread state, stop on cond breakpoint"
# Check that when we update all varobj, we don't get no error about varobj
# bound to running thread.