* lib/mi-support.exp (mi_runto): New proc. Does the same as gdb's
runto proc. (mi_run_to_main): Use mi_runto. (mi_execute_to): Renamed from mi_run_to. Changed all callers.
This commit is contained in:
parent
dc360f582a
commit
08b468e0c5
2 changed files with 67 additions and 35 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2002-09-10 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.
|
||||||
|
(mi_execute_to): Renamed from mi_run_to. Changed all callers.
|
||||||
|
|
||||||
2002-09-10 Keith Seitz <keiths@redhat.com>
|
2002-09-10 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
* lib/mi-support.exp: (mi_run_to_main): Allow anything to precede
|
* lib/mi-support.exp: (mi_run_to_main): Allow anything to precede
|
||||||
|
|
|
@ -621,42 +621,67 @@ proc mi_run_to_main { } {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
global mi_gdb_prompt
|
|
||||||
global hex
|
|
||||||
global decimal
|
|
||||||
global srcdir
|
global srcdir
|
||||||
global subdir
|
global subdir
|
||||||
global binfile
|
global binfile
|
||||||
global srcfile
|
global srcfile
|
||||||
|
|
||||||
set test "mi run-to-main"
|
|
||||||
mi_delete_breakpoints
|
mi_delete_breakpoints
|
||||||
mi_gdb_reinitialize_dir $srcdir/$subdir
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
mi_gdb_load ${binfile}
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
mi_gdb_test "200-break-insert main" \
|
mi_runto main
|
||||||
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
|
}
|
||||||
"breakpoint at main"
|
|
||||||
|
|
||||||
mi_run_cmd
|
|
||||||
gdb_expect {
|
# Just like gdb's "runto" proc, it will run the target to a given
|
||||||
-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"main\",args=\(\\\[\\\]\|\{\}\),file=\".*\",line=\"\[0-9\]*\"\}\r\n$mi_gdb_prompt$" {
|
# function. The big difference here between mi_runto and mi_execute_to
|
||||||
pass "$test"
|
# is that mi_execute_to must have the inferior running already. This
|
||||||
return 0
|
# proc will (like gdb's runto) (re)start the inferior, too.
|
||||||
}
|
#
|
||||||
-re ".*$mi_gdb_prompt$" {
|
# FUNC is the linespec of the place to stop (it inserts a breakpoint here).
|
||||||
fail "$test (2)"
|
# It returns:
|
||||||
}
|
# -1 if test suppressed, failed, timedout
|
||||||
timeout {
|
# 0 if test passed
|
||||||
fail "$test (timeout)"
|
|
||||||
return -1
|
proc mi_runto {func} {
|
||||||
}
|
global suppress_flag
|
||||||
|
if { $suppress_flag } {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
global mi_gdb_prompt expect_out
|
||||||
|
global hex decimal
|
||||||
|
|
||||||
|
set test "mi runto $func"
|
||||||
|
mi_gdb_test "200-break-insert $func" \
|
||||||
|
"200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Next to the next statement
|
# Next to the next statement
|
||||||
# For return values, see mi_run_to_helper
|
# For return values, see mi_execute_to_helper
|
||||||
|
|
||||||
proc mi_next { test } {
|
proc mi_next { test } {
|
||||||
return [mi_next_to {.*} {.*} {.*} {.*} $test]
|
return [mi_next_to {.*} {.*} {.*} {.*} $test]
|
||||||
|
@ -664,7 +689,7 @@ proc mi_next { test } {
|
||||||
|
|
||||||
|
|
||||||
# Step to the next statement
|
# Step to the next statement
|
||||||
# For return values, see mi_run_to_helper
|
# For return values, see mi_execute_to_helper
|
||||||
|
|
||||||
proc mi_step { test } {
|
proc mi_step { test } {
|
||||||
return [mi_step_to {.*} {.*} {.*} {.*} $test]
|
return [mi_step_to {.*} {.*} {.*} {.*} $test]
|
||||||
|
@ -676,7 +701,7 @@ proc mi_step { test } {
|
||||||
# Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives
|
# Can not match -re ".*\r\n${mi_gdb_prompt}", because of false positives
|
||||||
# after the first prompt is printed.
|
# after the first prompt is printed.
|
||||||
|
|
||||||
proc mi_run_to_helper { cmd reason func args file line extra test } {
|
proc mi_execute_to_helper { cmd reason func args file line extra test } {
|
||||||
global suppress_flag
|
global suppress_flag
|
||||||
if { $suppress_flag } {
|
if { $suppress_flag } {
|
||||||
return -1
|
return -1
|
||||||
|
@ -705,56 +730,56 @@ proc mi_run_to_helper { cmd reason func args file line extra test } {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi_run_to { cmd reason func args file line extra test } {
|
proc mi_execute_to { cmd reason func args file line extra test } {
|
||||||
mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
|
mi_execute_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \
|
||||||
"$file" "$line" "$extra" "$test"
|
"$file" "$line" "$extra" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi_next_to { func args file line test } {
|
proc mi_next_to { func args file line test } {
|
||||||
mi_run_to "exec-next" "end-stepping-range" "$func" "$args" \
|
mi_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
|
||||||
"$file" "$line" "" "$test"
|
"$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi_step_to { func args file line test } {
|
proc mi_step_to { func args file line test } {
|
||||||
mi_run_to "exec-step" "end-stepping-range" "$func" "$args" \
|
mi_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
|
||||||
"$file" "$line" "" "$test"
|
"$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi_finish_to { func args file line result ret test } {
|
proc mi_finish_to { func args file line result ret test } {
|
||||||
mi_run_to "exec-finish" "function-finished" "$func" "$args" \
|
mi_execute_to "exec-finish" "function-finished" "$func" "$args" \
|
||||||
"$file" "$line" \
|
"$file" "$line" \
|
||||||
",gdb-result-var=\"$result\",return-value=\"$ret\"" \
|
",gdb-result-var=\"$result\",return-value=\"$ret\"" \
|
||||||
"$test"
|
"$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi_continue_to { bkptno func args file line test } {
|
proc mi_continue_to { bkptno func args file line test } {
|
||||||
mi_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
|
mi_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
|
||||||
"$func" "$args" "$file" "$line" "" "$test"
|
"$func" "$args" "$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi0_run_to { cmd reason func args file line extra test } {
|
proc mi0_execute_to { cmd reason func args file line extra test } {
|
||||||
mi_run_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
|
mi_execute_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
|
||||||
"$file" "$line" "$extra" "$test"
|
"$file" "$line" "$extra" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi0_next_to { func args file line test } {
|
proc mi0_next_to { func args file line test } {
|
||||||
mi0_run_to "exec-next" "end-stepping-range" "$func" "$args" \
|
mi0_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
|
||||||
"$file" "$line" "" "$test"
|
"$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi0_step_to { func args file line test } {
|
proc mi0_step_to { func args file line test } {
|
||||||
mi0_run_to "exec-step" "end-stepping-range" "$func" "$args" \
|
mi0_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
|
||||||
"$file" "$line" "" "$test"
|
"$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi0_finish_to { func args file line result ret test } {
|
proc mi0_finish_to { func args file line result ret test } {
|
||||||
mi0_run_to "exec-finish" "function-finished" "$func" "$args" \
|
mi0_execute_to "exec-finish" "function-finished" "$func" "$args" \
|
||||||
"$file" "$line" \
|
"$file" "$line" \
|
||||||
",gdb-result-var=\"$result\",return-value=\"$ret\"" \
|
",gdb-result-var=\"$result\",return-value=\"$ret\"" \
|
||||||
"$test"
|
"$test"
|
||||||
}
|
}
|
||||||
|
|
||||||
proc mi0_continue_to { bkptno func args file line test } {
|
proc mi0_continue_to { bkptno func args file line test } {
|
||||||
mi0_run_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
|
mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
|
||||||
"$func" "$args" "$file" "$line" "" "$test"
|
"$func" "$args" "$file" "$line" "" "$test"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue