summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2002-09-05 13:24:38 +0000
committerKeith Seitz <keiths@redhat.com>2002-09-05 13:24:38 +0000
commit4cc470e922dadb03b19c20a8dc34f637d9ac4e65 (patch)
treeb480cf595c5956ec1929b0ad93cd261c3dacd232
parent0e6c457613d366c89eef437ca870e0ad24846821 (diff)
downloadgdb-4cc470e922dadb03b19c20a8dc34f637d9ac4e65.tar.gz
* lib/mi-support.exp (mi_runto): New proc. Does the same as gdb's
runto proc. (mi_run_to_main): Use mi_runto.
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/lib/mi-support.exp81
2 files changed, 57 insertions, 30 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 618cbe9b235..15ae005dab8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2002-09-05 Keith Seitz <keiths@redhat.com>
+
+ * lib/mi-support.exp (mi_runto): New proc. Does the same as gdb's
+ runto proc.
+ (mi_run_to_main): Use mi_runto.
+
2002-09-04 Keith Seitz <keiths@redhat.com>
* lib/mi-support.exp (mi_run_to_main): Allow anything to precede
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 70d8a1eaf38..770ee3887e1 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -621,47 +621,68 @@ proc mi_run_to_main { } {
return -1
}
- global mi_gdb_prompt
- global hex
- global decimal
global srcdir
global subdir
global binfile
global srcfile
- global MIFLAGS
- set test "mi run-to-main"
mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
- set version 2
- scan $MIFLAGS "\-i=mi%d" version
- if {$version < 2} {
- # MI0 or MI1
- set bp_result "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}"
- } else {
- # MI2+
- set bp_result "=breakpoint-create,number=\"\[0-9\]\"\r\n200\\^done"
- }
- mi_gdb_test "200-break-insert main" \
- $bp_result \
- "breakpoint at main"
+ mi_runto main
+}
- 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$" {
- pass "$test"
- return 0
- }
- -re ".*$mi_gdb_prompt$" {
- fail "$test (2)"
- }
- timeout {
- fail "$test (timeout)"
- return -1
- }
+# Just like gdb's "runto" proc, it will run the target to a given
+# function.
+# FUNC is the linespec of the place to stop (it inserts a breakpoint here).
+# It returns:
+# -1 if test suppressed, failed, timedout
+# 0 if test passed
+
+proc mi_runto {func} {
+ global suppress_flag
+ if { $suppress_flag } {
+ return -1
+ }
+
+ global mi_gdb_prompt expect_out
+ global hex decimal
+ global MIFLAGS
+
+ set test "mi runto $func"
+ set version 2
+ scan $MIFLAGS "\-i=mi%d" version
+ if {$version < 2} {
+ # MI0 or MI1
+ set bp_result "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}"
+ } else {
+ # MI2+
+ set bp_result "=breakpoint-create,number=\"\[0-9\]\"\r\n200\\^done"
+ }
+ mi_gdb_test "200-break-insert $func" \
+ $bp_result \
+ "breakpoint at $func"
+
+ if {![regexp {number="[0-9]+"} $expect_out(buffer) str]
+ || ![scan $str {number="%d"} bkptno]} {
+ set bkptno {[0-9]+}
+ }
+
+ mi_run_cmd
+ gdb_expect {
+ -re ".*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"$bkptno\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=\(\\\[.*\\\]\|\{.*\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
+ pass "$test"
+ return 0
}
+ -re ".*$mi_gdb_prompt$" {
+ fail "$test (2)"
+ }
+ timeout {
+ fail "$test (timeout)"
+ return -1
+ }
+ }
}