aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2001-11-11 20:11:03 +0000
committerDaniel Jacobowitz <drow@false.org>2001-11-11 20:11:03 +0000
commitdcf95b472160a58c37afe705549371f3c84d57c0 (patch)
treede89af80813aafef0d0a210b4ae60131aa63095b /gdb/testsuite/lib
parent84826df144915b2e80b6265288ed4f9e153d996b (diff)
downloadgdb-dcf95b472160a58c37afe705549371f3c84d57c0.zip
gdb-dcf95b472160a58c37afe705549371f3c84d57c0.tar.gz
gdb-dcf95b472160a58c37afe705549371f3c84d57c0.tar.bz2
* lib/mi-support.exp: (mi_run_to_helper, mi_run_to,
mi_step_to, mi_next_to, mi_continue_to, mi_finish_to, mi0_step_to, mi0_next_to, mi0_continue_to, mi0_finish_to, mi0_run_to): New functions. * gdb.mi/mi-simplerun.exp: Use them. * gdb.mi/mi0-simplerun.exp: Likewise. * gdb.mi/mi-var-cmd.exp: Likewise. * gdb.mi/mi0-var-cmd.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/mi-support.exp96
1 files changed, 94 insertions, 2 deletions
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 8727ae5..09801d4 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -665,7 +665,7 @@ proc mi_next { test } {
global mi_gdb_prompt
send_gdb "220-exec-next\n"
gdb_expect {
- -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{].*[\\\]\}\],,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
+ -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{].*[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
pass "$test"
return 0
}
@@ -687,7 +687,7 @@ proc mi_step { test } {
global mi_gdb_prompt
send_gdb "220-exec-step\n"
gdb_expect {
- -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],,file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
+ -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
pass "$test"
return 0
}
@@ -697,3 +697,95 @@ proc mi_step { test } {
}
}
}
+
+# cmd should not include the number or newline (i.e. "exec-step 3", not
+# "220-exec-step 3\n"
+
+proc mi_run_to_helper { cmd reason func args file line extra test } {
+ global suppress_flag
+ if { $suppress_flag } {
+ return -1
+ }
+ global mi_gdb_prompt
+ global hex
+ global decimal
+ send_gdb "220-$cmd\n"
+ gdb_expect {
+ -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" {
+ pass "$test"
+ return 0
+ }
+ -re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" {
+ fail "$test (stopped at wrong place)"
+ return -1
+ }
+ -re "220\\^running\r\n${mi_gdb_prompt}.*\r\n${mi_gdb_prompt}$" {
+ fail "$test (unknown output after running)"
+ return -1
+ }
+# Can not check for this, because of false positives after half of a running
+# prompt.
+# -re ".*\r\n${mi_gdb_prompt}" {
+# fail "$test (unknown output)"
+# return -1
+# }
+ timeout {
+ fail "$test (timeout)"
+ return -1
+ }
+ }
+}
+
+proc mi_run_to { cmd reason func args file line extra test } {
+ mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
+ "$file" "$line" "$extra" "$test"
+}
+
+proc mi_next_to { func args file line test } {
+ mi_run_to "exec-next" "end-stepping-range" "$func" "$args" \
+ "$file" "$line" "" "$test"
+}
+
+proc mi_step_to { func args file line test } {
+ mi_run_to "exec-step" "end-stepping-range" "$func" "$args" \
+ "$file" "$line" "" "$test"
+}
+
+proc mi_finish_to { func args file line result ret test } {
+ mi_run_to "exec-finish" "function-finished" "$func" "$args" \
+ "$file" "$line" \
+ ",gdb-result-var=\"$result\",return-value=\"$ret\"" \
+ "$test"
+}
+
+proc mi_continue_to { bkptno func args file line test } {
+ mi_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
+ "$func" "$args" "$file" "$line" "" "$test"
+}
+
+proc mi0_run_to { cmd reason func args file line extra test } {
+ mi_run_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
+ "$file" "$line" "$extra" "$test"
+}
+
+proc mi0_next_to { func args file line test } {
+ mi0_run_to "exec-next" "end-stepping-range" "$func" "$args" \
+ "$file" "$line" "" "$test"
+}
+
+proc mi0_step_to { func args file line test } {
+ mi0_run_to "exec-step" "end-stepping-range" "$func" "$args" \
+ "$file" "$line" "" "$test"
+}
+
+proc mi0_finish_to { func args file line result ret test } {
+ mi0_run_to "exec-finish" "function-finished" "$func" "$args" \
+ "$file" "$line" \
+ ",gdb-result-var=\"$result\",return-value=\"$ret\"" \
+ "$test"
+}
+
+proc mi0_continue_to { bkptno func args file line test } {
+ mi0_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
+ "$func" "$args" "$file" "$line" "" "$test"
+}