diff options
author | Keith Seitz <keiths@redhat.com> | 2002-09-04 20:17:13 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2002-09-04 20:17:13 +0000 |
commit | b444fbcff44c9c550c715e42f205532775a3ed41 (patch) | |
tree | 7971a91f6fae705d698ffb877855cf8c8a4dcfe8 | |
parent | 9a08a9058664d60b7b0a1ba8c67496f9b3897995 (diff) | |
download | gdb-b444fbcff44c9c550c715e42f205532775a3ed41.tar.gz |
* 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.
(mi_step_next_helper): New procedure to do step/next.
(mi_next): Use mi_step_next_helper.
(mi_step): Ditto.
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 66 |
2 files changed, 41 insertions, 34 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6811f099b24..618cbe9b235 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2002-09-04 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. + (mi_step_next_helper): New procedure to do step/next. + (mi_next): Use mi_step_next_helper. + (mi_step): Ditto. + +2002-09-04 Keith Seitz <keiths@redhat.com> + * lib/gdb.exp (gdb_compile_pthreads): Fix "build_bin" typo. Use integer comparison instead of string comparison for testing whether binary was built. diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 4f0bb080d7c..70d8a1eaf38 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1,4 +1,4 @@ -# 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 @@ -650,7 +650,7 @@ proc mi_run_to_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$" { + -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 } @@ -665,47 +665,45 @@ proc mi_run_to_main { } { } +# 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 |