diff options
author | Bob Rossi <bob@brasko.net> | 2005-09-27 22:39:04 +0000 |
---|---|---|
committer | Bob Rossi <bob@brasko.net> | 2005-09-27 22:39:04 +0000 |
commit | 39fb8e9e0f5c7cb813eaa19a5f7368cb2d425f3f (patch) | |
tree | a3042d79842e089c3216cf54caefc58fdf8d0c13 /gdb/testsuite/lib | |
parent | 48e79b0a531fae383ad638cdd243c2012647451a (diff) | |
download | binutils-gdb-39fb8e9e0f5c7cb813eaa19a5f7368cb2d425f3f.tar.gz |
2005-09-27 Bob Rossi <bob@brasko.net>
* gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .*
from test. Escape the | in mi_gdb_test call.
* gdb.mi/mi-basics.exp, gdb.mi/mi-cli.exp, gdb.mi/mi-disassemble.exp,
gdb.mi/mi-pthreads.exp, gdb.mi/mi-stack.exp, gdb.mi/mi2-basics.exp,
gdb.mi/mi2-cli.exp, gdb.mi/mi2-disassemble.exp,
gdb.mi/mi2-pthreads.exp, gdb.mi/mi2-stack.exp: Add extra details to
expected regex's in mi_gdb_test calls.
* lib/mi-support.exp: Remove arbitrary .* from tests.
(mi_gdb_test): Add string_regex variable. Add anchor to main -re.
Fully anchor GDB/MI expected results in mi_gdb_test.
* lib/gdb.exp (string_to_regexp): Escape the ] character.
* gdb.base/sizeof.exp: Remove escape character. Correct test.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index c2c0b153681..cfddc99dbd7 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1,5 +1,5 @@ # Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004 +# 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -864,7 +864,7 @@ proc test_print_reject { args } { proc string_to_regexp {str} { set result $str - regsub -all {[]*+.|()^$\[]} $str {\\&} result + regsub -all {[]*+.|()^$\[\\]} $str {\\&} result return $result } diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index 4c1d5772271..fa99c53f255 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -246,7 +246,7 @@ proc mi_delete_breakpoints {} { send_gdb "y\n"; exp_continue } - -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" { + -re "102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" { # This happens if there were no breakpoints } timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return } @@ -596,6 +596,8 @@ proc mi_gdb_test { args } { set result -1 set string "${command}\n"; + set string_regex [string_to_regexp $command] + if { $command != "" } { while { "$string" != "" } { set foo [string first "\n" "$string"]; @@ -659,7 +661,11 @@ proc mi_gdb_test { args } { gdb_start set result -1 } - -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*" { + -re "^($string_regex\[\r\n\]+)?($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)" { + # At this point, $expect_out(1,string) is the MI input command. + # and $expect_out(2,string) is the MI output command. + # If $expect_out(1,string) is "", then there was no MI input command here. + # NOTE, there is no trailing anchor because with GDB/MI, # asynchronous responses can happen at any point, causing more # data to be available. Normally an anchor is used to make @@ -925,11 +931,11 @@ proc mi_execute_to_helper { cmd reason func args file line extra test } { global fullname_syntax send_gdb "220-$cmd\n" gdb_expect { - -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" { + -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\".*$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$extra\r\n$mi_gdb_prompt$" { pass "$test" return 0 } - -re ".*220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" { + -re "220\\^running\r\n${mi_gdb_prompt}.*220\\*stopped,reason=\"$reason\",thread-id=\"$decimal\",frame=\{addr=\"$hex\",func=\".*\",args=\[\\\[\{\].*\[\\\]\}\],file=\".*\",fullname=\"${fullname_syntax}.*\",line=\"\[0-9\]*\"\}.*\r\n$mi_gdb_prompt$" { fail "$test (stopped at wrong place)" return -1 } |