-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
mi_run_cmd
gdb_expect {
- -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"\[0-9\]+\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[\\\]\|\{\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
+ -re ".*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"\[0-9\]+\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
pass "$test"
return 0
}
}
+# Helper function for mi_next and mi_step
+# CMD is either "step" or "next"
+# TEST is the name of the test (passed to dejagnu's pass/fail)
+# Returns:
+# 0 if passed
+# 1 if failed/timeout
+proc mi_step_next_helper {cmd test} {
+ global suppress_flag
+ if { $suppress_flag } {
+ return 1
+ }
+
+ global mi_gdb_prompt decimal hex
+ send_gdb "220-exec-$cmd\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=\"$decimal\"\}\r\n$mi_gdb_prompt$" {
+ pass "$test"
+ return 0
+ }
+ timeout {
+ fail "$test"
+ return 1
+ }
+ }
+}
+
# Next to the next statement
+# For return values, see mi_step_next_helper
proc mi_next { test } {
- global suppress_flag
- if { $suppress_flag } {
- return -1
- }
- 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$" {
- pass "$test"
- return 0
- }
- timeout {
- fail "$test"
- return -1
- }
- }
+ return [mi_step_next_helper next $test]
}
# Step to the next statement
+# For return values, see mi_step_next_helper
proc mi_step { test } {
- global suppress_flag
- if { $suppress_flag } {
- return -1
- }
- 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$" {
- pass "$test"
- return 0
- }
- timeout {
- fail "$test"
- return -1
- }
- }
+ return [mi_step_next_helper step $test]
}
# cmd should not include the number or newline (i.e. "exec-step 3", not