diff options
author | Keith Seitz <keiths@redhat.com> | 2002-09-10 22:28:19 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2002-09-10 22:28:19 +0000 |
commit | 08b468e0c5bf893b50aea6d59c3760fabac4bcdc (patch) | |
tree | a53e12c9f935893da1cc12cfc0bfca8dc7f2e9b0 /gdb | |
parent | dc360f582a4fa2f21c5a847ccece58de75b0e2f7 (diff) | |
download | fsf-binutils-gdb-08b468e0c5bf893b50aea6d59c3760fabac4bcdc.zip fsf-binutils-gdb-08b468e0c5bf893b50aea6d59c3760fabac4bcdc.tar.gz fsf-binutils-gdb-08b468e0c5bf893b50aea6d59c3760fabac4bcdc.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 97 |
2 files changed, 68 insertions, 36 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ad5e4c6..9ec437b 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,12 @@ 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> + * lib/mi-support.exp: (mi_run_to_main): Allow anything to precede regexp for stopping at main. Could have multiple event notifications. Don't assume that main was declared with no parameters. diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 650401a..0395afa 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -621,42 +621,67 @@ proc mi_run_to_main { } { return -1 } - global mi_gdb_prompt - global hex - global decimal global srcdir global subdir global binfile global srcfile - set test "mi run-to-main" mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir mi_gdb_load ${binfile} - mi_gdb_test "200-break-insert 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_runto main +} - mi_run_cmd - gdb_expect { - -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$" { - 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. The big difference here between mi_runto and mi_execute_to +# is that mi_execute_to must have the inferior running already. This +# proc will (like gdb's runto) (re)start the inferior, too. +# +# 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 + + 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 -# For return values, see mi_run_to_helper +# For return values, see mi_execute_to_helper proc mi_next { test } { return [mi_next_to {.*} {.*} {.*} {.*} $test] @@ -664,7 +689,7 @@ proc mi_next { test } { # 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 } { 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 # 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 if { $suppress_flag } { 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 } { - mi_run_to_helper "$cmd" "$reason" "$func" "\\\[$args\\\]" \ +proc mi_execute_to { cmd reason func args file line extra test } { + mi_execute_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" \ + mi_execute_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" \ + mi_execute_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" \ + mi_execute_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" \ + mi_execute_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\}" \ +proc mi0_execute_to { cmd reason func args file line extra test } { + mi_execute_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" \ + mi0_execute_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" \ + mi0_execute_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" \ + mi0_execute_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" \ + mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \ "$func" "$args" "$file" "$line" "" "$test" } |