This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Fully anchor mi_gdb_test expected results.
- From: Bob Rossi <bob at brasko dot net>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 20 Sep 2005 21:25:39 -0400
- Subject: Re: Fully anchor mi_gdb_test expected results.
- References: <20050804141750.GA11536@nevyn.them.org> <20050804142601.GC4054@white> <20050804143238.GA11996@nevyn.them.org> <20050804203704.GA4472@white> <20050804205747.GA22030@nevyn.them.org> <20050804211834.GD4472@white> <20050804224044.GB4931@white> <20050804224351.GA25174@nevyn.them.org> <20050804234959.GC4931@white> <20050918013154.GR8777@nevyn.them.org>
On Sat, Sep 17, 2005 at 09:31:55PM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 04, 2005 at 07:49:59PM -0400, Bob Rossi wrote:
> > On Thu, Aug 04, 2005 at 06:43:51PM -0400, Daniel Jacobowitz wrote:
> > > On Thu, Aug 04, 2005 at 06:40:44PM -0400, Bob Rossi wrote:
> > > > Here are my testsuite results. The first one looks like a bug I
> > > > introduced, and the others look like random thread pass/failures. Is
> > > > that correct?
> > >
> > > Yes. Does removing two backslashes in sizeof.exp fix it? They
> > > shouldn't have been there at all.
> >
> > Geez Daniel, thanks for all the help. Here is the patch that plays
> > nicely with the testsuite. I captured both the MI input command and the
> > MI output command. Eventually testing can be done on the MI input
> > command also.
>
> Hi Bob,
>
> I don't remember - what's the status of this patch? I think there were
> no more problems with it.
>
> I'm a bit curious about this though:
>
> > + -re "^(.*$string_regex.*)($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.
>
> Seems like the .*'s there are really defeating the point of anchoring
> it!
This has gone away in the new patch, tell me what you think. I had to
modify several testcases, but only to get them to match the begin
anchor. This of course passes the testsuite.
With this change I think I'm only several lines away from syntax
checking the testsuite. I'll try it out to see if anything's changed
recently.
Bob Rossi
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
+2005-08-03 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.
Index: gdb.base/sizeof.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sizeof.exp,v
retrieving revision 1.7
diff -w -u -r1.7 sizeof.exp
--- gdb.base/sizeof.exp 13 Jul 2004 17:08:36 -0000 1.7
+++ gdb.base/sizeof.exp 21 Sep 2005 01:21:53 -0000
@@ -131,7 +131,7 @@
set signof_signed_char [get_valueof "/d" "(int) (signed char) -1" -1]
set signof_unsigned_char [get_valueof "/d" "(int) (unsigned char) -1" -1]
-check_valueof "'\\\\377'" ${signof_byte}
+check_valueof "'\\377'" ${signof_byte}
check_valueof "(int) (char) -1" ${signof_char}
check_valueof "(int) (signed char) -1" ${signof_signed_char}
check_valueof "(int) (unsigned char) -1" ${signof_unsigned_char}
Index: gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.11
diff -w -u -r1.11 mi-basics.exp
--- gdb.mi/mi-basics.exp 4 Aug 2005 01:52:31 -0000 1.11
+++ gdb.mi/mi-basics.exp 21 Sep 2005 01:21:53 -0000
@@ -138,7 +138,7 @@
# The all parameter is actually no parameter.
mi_gdb_test "200-break-delete" \
- "\\\^done" \
+ "200\\\^done" \
"break-delete (all) operation"
mi_gdb_test "201-break-list" \
@@ -168,7 +168,7 @@
"environment-directory empty-string operation"
mi_gdb_test "204-environment-directory -r" \
- "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
+ "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
"environment-directory operation"
}
@@ -184,11 +184,11 @@
# -environment-pwd
mi_gdb_test "205-environment-cd ${objdir}" \
- "\\\^done" \
+ "205\\\^done" \
"environment-cd arg operation"
mi_gdb_test "206-environment-pwd" \
- "\\\^done,cwd=\"${escapedobjdir}\"" \
+ "206\\\^done,cwd=\"${escapedobjdir}\"" \
"environment-pwd operation"
}
@@ -219,7 +219,7 @@
}
mi_gdb_test "207-environment-path" \
- "\\\^done,path=\"$orig_path\"" \
+ "207\\\^done,path=\"$orig_path\"" \
"environment-path no-args operation"
mi_gdb_test "208-environment-path $srcdir $objdir" \
@@ -227,11 +227,11 @@
"environment-path dir1 dir2 operation"
mi_gdb_test "209-environment-path -r $objdir" \
- "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
+ "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \
"environment-path -r dir operation"
mi_gdb_test "210-environment-path -r" \
- "\\\^done,path=\"$orig_path\"" \
+ "210\\\^done,path=\"$orig_path\"" \
"environment-path -r operation"
}
Index: gdb.mi/mi-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-cli.exp,v
retrieving revision 1.4
diff -w -u -r1.4 mi-cli.exp
--- gdb.mi/mi-cli.exp 18 May 2005 03:41:58 -0000 1.4
+++ gdb.mi/mi-cli.exp 21 Sep 2005 01:21:53 -0000
@@ -59,7 +59,7 @@
# {(=.*)+\^done} \
# "-interpreter-exec console \"file \$binfile\""
mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
- {\^done} \
+ {~"Reading symbols from .*basics...".*done} \
"-interpreter-exec console \"file \$binfile\""
mi_run_to_main
@@ -125,7 +125,7 @@
# {.*=selected-frame-level-changed,level="1".*\^done} \
# "-interpreter-exec console \"up\""
mi_gdb_test "200-interpreter-exec console \"up\"" \
- {200\^done} \
+ {~"#.*".*200\^done} \
"-interpreter-exec console \"up\""
# NOTE: cagney/2003-02-03: Not yet.
@@ -133,7 +133,7 @@
# {.*=selected-frame-level-changed,level="0".*\^done} \
# "-interpreter-exec console \"down\""
mi_gdb_test "300-interpreter-exec console \"down\"" \
- {300\^done} \
+ {~"#.*".*300\^done} \
"-interpreter-exec console \"down\""
# NOTE: cagney/2003-02-03: Not yet.
@@ -141,7 +141,7 @@
# {.*=selected-frame-level-changed,level="2".*\^done} \
# "-interpreter-exec console \"frame 2\""
mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
- {400\^done} \
+ {~"#.*".*400\^done} \
"-interpreter-exec console \"frame 2\""
# NOTE: cagney/2003-02-03: Not yet.
Index: gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -w -u -r1.13 mi-disassemble.exp
--- gdb.mi/mi-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.13
+++ gdb.mi/mi-disassemble.exp 21 Sep 2005 01:21:53 -0000
@@ -163,19 +163,19 @@
# -data-disassembly -f basics.c -l 32 -- 9
mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"
mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
- "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+ "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
"data-disassemble bogus address"
mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
- "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+ "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"
}
Index: gdb.mi/mi-pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-pthreads.exp,v
retrieving revision 1.7
diff -w -u -r1.7 mi-pthreads.exp
--- gdb.mi/mi-pthreads.exp 13 Jan 2004 17:08:03 -0000 1.7
+++ gdb.mi/mi-pthreads.exp 21 Sep 2005 01:21:53 -0000
@@ -187,7 +187,7 @@
"check_mi_thread_command_set: -thread-select"
mi_gdb_test "-thread-select 123456789" \
- {\^error,msg="Thread ID 123456789 not known\."} \
+ {&.*\^error,msg="Thread ID 123456789 not known\."} \
"check_mi_thread_command_set: -thread-select 123456789"
foreach thread $thread_list {
Index: gdb.mi/mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.18
diff -w -u -r1.18 mi-stack.exp
--- gdb.mi/mi-stack.exp 31 Jul 2005 21:24:25 -0000 1.18
+++ gdb.mi/mi-stack.exp 21 Sep 2005 01:21:53 -0000
@@ -68,7 +68,7 @@
"stack frame listing 1 3"
mi_gdb_test "234-stack-list-frames 1" \
- "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
"stack frame listing wrong"
mi_gdb_test "235-stack-info-frame" \
@@ -115,7 +115,7 @@
"stack args listing 1 1 3"
mi_gdb_test "234-stack-list-arguments" \
- "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
"stack args listing wrong"
}
@@ -142,7 +142,7 @@
"stack info-depth 99"
mi_gdb_test "231-stack-info-depth 99 99" \
- "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+ "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
"stack info-depth wrong usage"
}
@@ -181,7 +181,7 @@
"stack locals listing, simple types: names and values, complex type: names and types"
mi_gdb_test "234-stack-list-locals" \
- "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"
mi_gdb_test "232-stack-select-frame 1" \
Index: gdb.mi/mi2-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-basics.exp,v
retrieving revision 1.3
diff -w -u -r1.3 mi2-basics.exp
--- gdb.mi/mi2-basics.exp 9 Aug 2004 22:21:54 -0000 1.3
+++ gdb.mi/mi2-basics.exp 21 Sep 2005 01:21:53 -0000
@@ -139,7 +139,7 @@
# The all parameter is actually no parameter.
mi_gdb_test "200-break-delete" \
- "\\\^done" \
+ "200\\\^done" \
"break-delete (all) operation"
mi_gdb_test "201-break-list" \
@@ -169,7 +169,7 @@
"environment-directory empty-string operation"
mi_gdb_test "204-environment-directory -r" \
- "\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
+ "204\\\^done,source-path=\"\\\$cdir.\\\$cwd\"" \
"environment-directory operation"
#exp_internal 0
@@ -187,11 +187,11 @@
# -environment-pwd
mi_gdb_test "205-environment-cd ${objdir}" \
- "\\\^done" \
+ "205\\\^done" \
"environment-cd arg operation"
mi_gdb_test "206-environment-pwd" \
- "\\\^done,cwd=\"${escapedobjdir}\"" \
+ "206\\\^done,cwd=\"${escapedobjdir}\"" \
"environment-pwd operation"
}
@@ -222,7 +222,7 @@
}
mi_gdb_test "207-environment-path" \
- "\\\^done,path=\"$orig_path\"" \
+ "207\\\^done,path=\"$orig_path\"" \
"environment-path no-args operation"
mi_gdb_test "208-environment-path $srcdir $objdir" \
@@ -230,11 +230,11 @@
"environment-path dir1 dir2 operation"
mi_gdb_test "209-environment-path -r $objdir" \
- "\\\^done,path=\"$escapedobjdir.$orig_path\"" \
+ "209\\\^done,path=\"$escapedobjdir.$orig_path\"" \
"environment-path -r dir operation"
mi_gdb_test "210-environment-path -r" \
- "\\\^done,path=\"$orig_path\"" \
+ "210\\\^done,path=\"$orig_path\"" \
"environment-path -r operation"
}
Index: gdb.mi/mi2-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-cli.exp,v
retrieving revision 1.3
diff -w -u -r1.3 mi2-cli.exp
--- gdb.mi/mi2-cli.exp 18 May 2005 03:41:59 -0000 1.3
+++ gdb.mi/mi2-cli.exp 21 Sep 2005 01:21:53 -0000
@@ -59,7 +59,7 @@
# {(=.*)+\^done} \
# "-interpreter-exec console \"file \$binfile\""
mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
- {\^done} \
+ {~"Reading symbols from .*basics...".*\^done} \
"-interpreter-exec console \"file \$binfile\""
mi_run_to_main
@@ -125,7 +125,7 @@
# {.*=selected-frame-level-changed,level="1".*\^done} \
# "-interpreter-exec console \"up\""
mi_gdb_test "200-interpreter-exec console \"up\"" \
- {200\^done} \
+ {~"#.*".*200\^done} \
"-interpreter-exec console \"up\""
# NOTE: cagney/2003-02-03: Not yet.
@@ -133,7 +133,7 @@
# {.*=selected-frame-level-changed,level="0".*\^done} \
# "-interpreter-exec console \"down\""
mi_gdb_test "300-interpreter-exec console \"down\"" \
- {300\^done} \
+ {~"#.*".*300\^done} \
"-interpreter-exec console \"down\""
# NOTE: cagney/2003-02-03: Not yet.
@@ -141,7 +141,7 @@
# {.*=selected-frame-level-changed,level="2".*\^done} \
# "-interpreter-exec console \"frame 2\""
mi_gdb_test "400-interpreter-exec console \"frame 2\"" \
- {400\^done} \
+ {~"#.*".*400\^done} \
"-interpreter-exec console \"frame 2\""
# NOTE: cagney/2003-02-03: Not yet.
Index: gdb.mi/mi2-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-disassemble.exp,v
retrieving revision 1.3
diff -w -u -r1.3 mi2-disassemble.exp
--- gdb.mi/mi2-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.3
+++ gdb.mi/mi2-disassemble.exp 21 Sep 2005 01:21:53 -0000
@@ -163,19 +163,19 @@
# -data-disassembly -f basics.c -l 32 -- 9
mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
- ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "&.*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
"data-disassemble bogus filename"
mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
- "321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
+ "&.*321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
"data-disassemble bogus address"
mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
- "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
+ "&.*456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. \\| .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
- "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
+ "&.*789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"
}
Index: gdb.mi/mi2-pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-pthreads.exp,v
retrieving revision 1.2
diff -w -u -r1.2 mi2-pthreads.exp
--- gdb.mi/mi2-pthreads.exp 13 Jan 2004 17:08:03 -0000 1.2
+++ gdb.mi/mi2-pthreads.exp 21 Sep 2005 01:21:53 -0000
@@ -187,7 +187,7 @@
"check_mi_thread_command_set: -thread-select"
mi_gdb_test "-thread-select 123456789" \
- {\^error,msg="Thread ID 123456789 not known\."} \
+ {&.*\^error,msg="Thread ID 123456789 not known\."} \
"check_mi_thread_command_set: -thread-select 123456789"
foreach thread $thread_list {
Index: gdb.mi/mi2-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-stack.exp,v
retrieving revision 1.5
diff -w -u -r1.5 mi2-stack.exp
--- gdb.mi/mi2-stack.exp 10 Jul 2005 20:49:38 -0000 1.5
+++ gdb.mi/mi2-stack.exp 21 Sep 2005 01:21:53 -0000
@@ -68,7 +68,7 @@
"stack frame listing 1 3"
mi_gdb_test "234-stack-list-frames 1" \
- "234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
"stack frame listing wrong"
mi_gdb_test "235-stack-info-frame" \
@@ -115,7 +115,7 @@
"stack args listing 1 1 3"
mi_gdb_test "234-stack-list-arguments" \
- "234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
"stack args listing wrong"
}
@@ -142,7 +142,7 @@
"stack info-depth 99"
mi_gdb_test "231-stack-info-depth 99 99" \
- "231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
+ "&.*231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
"stack info-depth wrong usage"
}
@@ -176,7 +176,7 @@
"stack locals listing 1"
mi_gdb_test "234-stack-list-locals" \
- "234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
+ "&.*234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
"stack locals listing wrong"
mi_gdb_test "232-stack-select-frame 1" \
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.63
diff -w -u -r1.63 gdb.exp
--- lib/gdb.exp 8 May 2005 13:42:04 -0000 1.63
+++ lib/gdb.exp 21 Sep 2005 01:21:53 -0000
@@ -864,7 +864,7 @@
proc string_to_regexp {str} {
set result $str
- regsub -all {[]*+.|()^$\[]} $str {\\&} result
+ regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
return $result
}
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.31
diff -w -u -r1.31 mi-support.exp
--- lib/mi-support.exp 11 Sep 2005 20:24:54 -0000 1.31
+++ lib/mi-support.exp 21 Sep 2005 01:21:53 -0000
@@ -246,7 +246,7 @@
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 @@
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 @@
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 @@
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
}