diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-06-25 14:32:34 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-06-25 14:32:34 +0000 |
commit | a2840c355960fdc116b12bd02abba2c5b9a9a653 (patch) | |
tree | 2b8b55099387c6e59328a04b599bb02d6f5f7ab3 /gdb/testsuite | |
parent | 7413f23fb41cf2a09614c4db4703074ae878ee89 (diff) | |
download | gdb-a2840c355960fdc116b12bd02abba2c5b9a9a653.zip gdb-a2840c355960fdc116b12bd02abba2c5b9a9a653.tar.gz gdb-a2840c355960fdc116b12bd02abba2c5b9a9a653.tar.bz2 |
Emit ^running via observer.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Do no print
^running here.
(mi_on_resume): Print ^running if not previously output.
* mi/mi-main.c (running_result_record_printed): New.
(captured_mi_execute_command): Reset
running_result_record_printed. Use running_result_record_printed
to decide if we should skip ^done.
(mi_execute_async_cli_command): Don't print ^running here.
* mi/mi-main.h (current_token, running_result_record_printed):
Declare.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.mi/mi-async.exp | 68 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 42 |
3 files changed, 40 insertions, 81 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 65a6335..91fc47b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2008-06-25 Vladimir Prus <vladimir@codesourcery.com> + + * gdb.mi/mi-async.exp: Use mi_sending_resuming_command_raw and + mi_expect_stop. + * gdb.mi/mi-support.exp (mi_run_cmd, mi_send_resuming_command): + Demand that *running is output. + (detect_async): Perform checking every time. + (mi_send_resuming_command): Extract everything into... + (mi_send_resuming_command_raw): ...this. + (mi_expect_stop): Don't accept any output before *stopped. + 2008-06-13 Vladimir Prus <vladimir@codesourcery.com> Robustify mi-simplerun. diff --git a/gdb/testsuite/gdb.mi/mi-async.exp b/gdb/testsuite/gdb.mi/mi-async.exp index d2e3b47..9ac91fd 100644 --- a/gdb/testsuite/gdb.mi/mi-async.exp +++ b/gdb/testsuite/gdb.mi/mi-async.exp @@ -59,72 +59,18 @@ proc linux_async_tests {} { set line_main_body [expr $line_main_head + 2] set line_main_next [expr $line_main_head + 3] - send_gdb "start\n" - gdb_expect { - -re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\\*stopped,thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" { - pass "Asynchronous response after start command" - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after start command (2)" - } - timeout { - fail "Asynchronous response after start command (timeout 2)" - } - } - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after start command (1)" - } - timeout {fail "Asynchronous response after start command (timeout 1)"} - } - - send_gdb "next\n" - gdb_expect { - -re "\\^running\r\n\\^done\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\\*stopped,reason=\"end-stepping-range\",thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_next\"\}\r\n$mi_gdb_prompt$" { - pass "Asynchronous response after next command" - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after next command (2)" - } - timeout { - fail "Asynchronous response after next command (timeout 2)" - } - } - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after next command (1)" - } - timeout {fail "Asynchronous response after next command (timeout 1)"} - } + mi_send_resuming_command_raw "start" "start: send" + mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "start: stop" + + mi_send_resuming_command_raw "next" "CLI next: send" + mi_expect_stop "end-stepping-range" "main" "" ".*basics.c" "$line_main_next" "" "CLI next: stop" mi_gdb_test "-exec-interrupt" \ "" \ "" - send_gdb "start\n" - gdb_expect { - -re ".*\\^running\r\n\\^done\r\n$mi_gdb_prompt" { - gdb_expect { - -re "\\*stopped,thread-id=\"0|1\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" { - pass "Asynchronous response after (re) start" - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after (re) start (2)" - } - timeout { - fail "Asynchronous response after (re) start (timeout 2)" - } - } - } - -re ".*$mi_gdb_prompt$" { - fail "Asynchronous response after (re) start (1)" - } - timeout {fail "Asynchronous response after (re) start (timeout 1)"} - } + mi_send_resuming_command_raw "start" "restart: send" + mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" "$line_main_body" { "" "disp=\"del\"" } "restart: stop" } diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 7a821b8..2acfa6c 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -802,7 +802,7 @@ proc mi_run_cmd {args} { if [target_info exists gdb,do_reload_on_run] { send_gdb "220-exec-continue\n"; gdb_expect 60 { - -re "220\\^running\[\r\n\]+(\\*running,thread-id=\"\[^\"\]+\"\r\n)?$mi_gdb_prompt$" {} + -re "220\\^running\[\r\n\]+\\*running,thread-id=\"\[^\"\]+\"\r\n$mi_gdb_prompt$" {} default {} } return; @@ -919,19 +919,17 @@ proc detect_async {} { global async global mi_gdb_prompt - if { $async == "unknown" } { - send_gdb "maint show linux-async\n" + send_gdb "maint show linux-async\n" - gdb_expect { - -re ".*Controlling the GNU/Linux inferior in asynchronous mode is on...*$mi_gdb_prompt$" { - set async 1 - } - -re ".*$mi_gdb_prompt$" { - set async 0 - } - timeout { - set async 0 - } + gdb_expect { + -re ".*Controlling the GNU/Linux inferior in asynchronous mode is on...*$mi_gdb_prompt$" { + set async 1 + } + -re ".*$mi_gdb_prompt$" { + set async 0 + } + timeout { + set async 0 } } return $async @@ -1018,13 +1016,13 @@ proc mi_expect_stop { reason func args file line extra test } { set a $after_reason - verbose -log "mi_expect_stop: expecting: .*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped\r\n$prompt_re$" + verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped\r\n$prompt_re$" gdb_expect { - -re ".*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n$prompt_re$" { + -re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped\r\n$prompt_re$" { pass "$test" return $expect_out(2,string) } - -re ".*\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$prompt_re$" { + -re "\\*stopped,${r}${a}${bn}thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$prompt_re$" { fail "$test (stopped at wrong place)" return -1 } @@ -1393,18 +1391,18 @@ proc mi_tbreak {location} { # Send COMMAND that must be a command that resumes # the inferiour (run/continue/next/etc) and consumes # the "^running" output from it. -proc mi_send_resuming_command {command test} { +proc mi_send_resuming_command_raw {command test} { global mi_gdb_prompt - send_gdb "220-$command\n" + send_gdb "$command\n" gdb_expect { - -re "220\\^running\r\n(\\*running,thread-id=\"\[^\"\]+\"\r\n)?${mi_gdb_prompt}" { + -re "\\^running\r\n\\*running,thread-id=\"\[^\"\]+\"\r\n${mi_gdb_prompt}" { } -re ".*${mi_gdb_prompt}" { fail "$test (failed to resume)" } - -re "220\\^error,msg=.*" { + -re "\\^error,msg=.*" { fail "$test (MI error)" return -1 } @@ -1415,6 +1413,10 @@ proc mi_send_resuming_command {command test} { } } +proc mi_send_resuming_command {command test} { + mi_send_resuming_command_raw -$command $test +} + # Helper to mi_run_inline_test below. # Sets a temporary breakpoint at LOCATION and runs # the program using COMMAND. When the program is stopped |