* Fully anchor mi_gdb_test expected results.
@ 2005-08-04 2:50 Bob Rossi
2005-08-04 4:11 ` Daniel Jacobowitz
0 siblings, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 2:50 UTC (permalink / raw)
To: gdb-patches
Hi,
This testsuite change simply does several simple things. First, when
creating a new pty for the inferior, this change turn's terminal
echo'ing off. This allows the expected results back from GDB/MI to not
have to have the command sent to GDB in it. The surprising thing with
this change is that even when GDB shares the terminal's PTY with the
inferior, not putting the echo'd data in the expected command still
works.
The only other notable change here is this,
- -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
+ -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
that is the change that fully anchor's the output from GDB. The reason
this is necessary is because with this change, I can grab the full
response from GDB for a command. With this response I can do syntax
checking with the parser that I wrote.
What does everyone think?
Thanks,
Bob Rossi
Index: gdb/testsuite/ChangeLog
+ * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .*
+ from test. Escape the | in mi_gdb_test call.
+ * lib/mi-support.exp: If using inferior pty, turn terminal echo off.
+ Remove arbitrary .* from test. Remove terminal echo'd data from
+ expected test results.
+ (mi_gdb_test): Fully anchor GDB/MI expected results in mi_gdb_test.
Index: gdb/testsuite/gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -u -r1.13 mi-disassemble.exp
--- gdb/testsuite/gdb.mi/mi-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.13
+++ gdb/testsuite/gdb.mi/mi-disassemble.exp 4 Aug 2005 02:44:42 -0000
@@ -163,7 +163,7 @@
# -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" \
@@ -171,7 +171,7 @@
"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" \
Index: gdb/testsuite/gdb.mi/mi2-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-disassemble.exp,v
retrieving revision 1.3
diff -u -r1.3 mi2-disassemble.exp
--- gdb/testsuite/gdb.mi/mi2-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.3
+++ gdb/testsuite/gdb.mi/mi2-disassemble.exp 4 Aug 2005 02:44:42 -0000
@@ -163,7 +163,7 @@
# -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" \
@@ -171,7 +171,7 @@
"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" \
Index: gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.29
diff -u -r1.29 mi-support.exp
--- gdb/testsuite/lib/mi-support.exp 4 Aug 2005 01:52:31 -0000 1.29
+++ gdb/testsuite/lib/mi-support.exp 4 Aug 2005 02:44:42 -0000
@@ -225,6 +225,17 @@
warning "Couldn't redirect inferior output." 2
}
}
+
+ # tell GDB not to echo
+ send_gdb "103-interpreter-exec console \"shell stty -echo\"\n"
+ gdb_expect 10 {
+ -re ".*$mi_gdb_prompt$" {
+ verbose "turning off the terminal echoing" 2
+ }
+ timeout {
+ warning "Couldn't turn off the terminal's echoing."
+ }
+ }
}
return 0;
@@ -246,7 +257,7 @@
send_gdb "y\n";
exp_continue
}
- -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
+ -re "102\\\^done\r\n$mi_gdb_prompt$" {
# This happens if there were no breakpoints
}
timeout { perror "Delete all breakpoints in mi_delete_breakpoints (timeout)" ; return }
@@ -256,9 +267,9 @@
# empty BreakpointTable. Also, a query is not acceptable with mi.
send_gdb "103-break-list\n"
gdb_expect 30 {
- -re "103-break-list\r\n103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}
- -re "103-break-list\r\n103\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[\\\]\}" {}
- -re "103-break-list\r\n103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}
+ -re "103\\\^done,BreakpointTable=\{\}\r\n$mi_gdb_prompt$" {}
+ -re "103\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[\\\]\}" {}
+ -re "103\\\^doneNo breakpoints or watchpoints.\r\n\r\n$mi_gdb_prompt$" {warning "Unexpected console text received"}
-re "$mi_gdb_prompt$" { perror "Breakpoints not deleted" ; return }
-re "Delete all breakpoints.*or n.*$" {
warning "Unexpected prompt for breakpoints deletion";
@@ -433,7 +444,7 @@
perror "($arg) No such file or directory\n"
return -1
}
- -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" {
+ -re "105\\\^done\r\n$mi_gdb_prompt$" {
# We (MI) are just giving the prompt back for now, instead of giving
# some acknowledgement.
return 0
@@ -659,7 +670,8 @@
gdb_start
set result -1
}
- -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
+ -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
+
if ![string match "" $message] then {
pass "$message"
}
@@ -917,11 +929,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
}
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 2:50 Fully anchor mi_gdb_test expected results Bob Rossi
@ 2005-08-04 4:11 ` Daniel Jacobowitz
2005-08-04 14:09 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 4:11 UTC (permalink / raw)
To: gdb-patches
On Wed, Aug 03, 2005 at 10:50:45PM -0400, Bob Rossi wrote:
> Hi,
>
> This testsuite change simply does several simple things. First, when
> creating a new pty for the inferior, this change turn's terminal
> echo'ing off. This allows the expected results back from GDB/MI to not
> have to have the command sent to GDB in it. The surprising thing with
> this change is that even when GDB shares the terminal's PTY with the
> inferior, not putting the echo'd data in the expected command still
> works.
>
> The only other notable change here is this,
>
> - -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
> + -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
>
> that is the change that fully anchor's the output from GDB. The reason
> this is necessary is because with this change, I can grab the full
> response from GDB for a command. With this response I can do syntax
> checking with the parser that I wrote.
>
> What does everyone think?
We're not using readline in this mode; we shouldn't have particularly
funny wrapping issues on the terminal, should we? Can we match the
echoing instead of having to mess with stty?
Also, formatting on your comments again, please.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 4:11 ` Daniel Jacobowitz
@ 2005-08-04 14:09 ` Bob Rossi
2005-08-04 14:18 ` Daniel Jacobowitz
0 siblings, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 14:09 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 12:11:21AM -0400, Daniel Jacobowitz wrote:
> On Wed, Aug 03, 2005 at 10:50:45PM -0400, Bob Rossi wrote:
> > Hi,
> >
> > This testsuite change simply does several simple things. First, when
> > creating a new pty for the inferior, this change turn's terminal
> > echo'ing off. This allows the expected results back from GDB/MI to not
> > have to have the command sent to GDB in it. The surprising thing with
> > this change is that even when GDB shares the terminal's PTY with the
> > inferior, not putting the echo'd data in the expected command still
> > works.
> >
> > The only other notable change here is this,
> >
> > - -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
> > + -re "^(.*$pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
> >
> > that is the change that fully anchor's the output from GDB. The reason
> > this is necessary is because with this change, I can grab the full
> > response from GDB for a command. With this response I can do syntax
> > checking with the parser that I wrote.
> >
> > What does everyone think?
>
> We're not using readline in this mode; we shouldn't have particularly
> funny wrapping issues on the terminal, should we? Can we match the
> echoing instead of having to mess with stty?
Correct, this has nothing to do with readline. There are several
problems with allowing the terminal to echo while testing the GDB/MI
output. Sorry in advance for the long Email.
- The first problem is that this is most likely not the scenario
with most front ends. I will risk making a fool of myself by stating
that I think most front end's probably communicate with GDB over a pipe,
in which case, the echo'ing is not happening, and FE's do not have to
deal with this data in the response.
- The testsuite has several ares (which I modified in patch), that have
.* at the beggining of there regex, to bypass the echo'd data. As an
example,
- ".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
+ "123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
or
- -re ".*102-break-delete\r\n102\\\^done\r\n$mi_gdb_prompt$" {
+ -re "102\\\^done\r\n$mi_gdb_prompt$" {
I'm not convinced the .* _needs_ to be in the patterns above, so this
point might be a minor point. The case below might take into account
the above case.
- Even worse, the general purpose MI "expect" pattern looks like,
-re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
which simply allows any data at the beggining of the match. So I could
easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
the first thing it outputs, and it would go unnoticed in the
testsuite. Probably the reason this could not have been done before is
because the MI input command was being echo'd back, and it would be
complicated to match that data.
- Now, my personal favorite. In order to parse the MI output command, I
need only the MI output command, not the echo'd MI input command
given. So, in order to get only the MI output command, I would have to
do 1 of several things.
- Turn terminal echo'ing off. (the safest)
- Make sure every test has the GDB expected pattern be the absolute
beginning of the MI output command. Then I could assume in the
general purpose match that the pattern was the beggining. It
would look something like this,
-re "^.*($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
I don't like this approach because it makes the testcase do
specific things in order to make sure that the syntax checking
was done properly.
What do you think of all of this?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 14:09 ` Bob Rossi
@ 2005-08-04 14:18 ` Daniel Jacobowitz
2005-08-04 14:26 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 14:18 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 10:09:37AM -0400, Bob Rossi wrote:
> Correct, this has nothing to do with readline. There are several
> problems with allowing the terminal to echo while testing the GDB/MI
> output. Sorry in advance for the long Email.
Sorry, but you seem to have missed my point...
> which simply allows any data at the beggining of the match. So I could
> easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> the first thing it outputs, and it would go unnoticed in the
> testsuite. Probably the reason this could not have been done before is
> because the MI input command was being echo'd back, and it would be
> complicated to match that data.
I am suggesting anchoring the pattern with a copy of what you expect to
be echoed. We already have code to escape a string into a regex. We
know what we sent to GDB.
If you think that's too much trouble, could you alternatively try "stty
-echo" in expect, rather than send_gdb "shell stty -echo"?
> - Make sure every test has the GDB expected pattern be the absolute
> beginning of the MI output command. Then I could assume in the
> general purpose match that the pattern was the beggining. It
> would look something like this,
> -re "^.*($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
> I don't like this approach because it makes the testcase do
> specific things in order to make sure that the syntax checking
> was done properly.
I've got no idea what you mean by this, but anchoring .* at the front
of a pattern doesn't accomplish anything!
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 14:18 ` Daniel Jacobowitz
@ 2005-08-04 14:26 ` Bob Rossi
2005-08-04 14:33 ` Daniel Jacobowitz
2005-08-04 14:34 ` Bob Rossi
0 siblings, 2 replies; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 14:26 UTC (permalink / raw)
To: gdb-patches
> > which simply allows any data at the beggining of the match. So I could
> > easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > the first thing it outputs, and it would go unnoticed in the
> > testsuite. Probably the reason this could not have been done before is
> > because the MI input command was being echo'd back, and it would be
> > complicated to match that data.
>
> I am suggesting anchoring the pattern with a copy of what you expect to
> be echoed. We already have code to escape a string into a regex. We
> know what we sent to GDB.
I originally tried this, but failed because I did *not* know how to
escape a string into a regex. Is there a function written that does
this? I'll try it.
> If you think that's too much trouble, could you alternatively try "stty
> -echo" in expect, rather than send_gdb "shell stty -echo"?
This was the original path I went down. However, I couldn't figure out
what the heck remote_spawn is. There is no documentation anywere (that I
could find). So, does remote_spawn call spawn? Does it take the same
arguments as spawn?
> > - Make sure every test has the GDB expected pattern be the absolute
> > beginning of the MI output command. Then I could assume in the
> > general purpose match that the pattern was the beggining. It
> > would look something like this,
> > -re "^.*($pattern\[\r\n\]+$mi_gdb_prompt\[ \]*)$" {
> > I don't like this approach because it makes the testcase do
> > specific things in order to make sure that the syntax checking
> > was done properly.
>
> I've got no idea what you mean by this, but anchoring .* at the front
> of a pattern doesn't accomplish anything!
It doesn't matter anyways, if you like the idea of the 2 above
approaches.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 14:26 ` Bob Rossi
@ 2005-08-04 14:33 ` Daniel Jacobowitz
2005-08-04 20:37 ` Bob Rossi
2005-08-04 14:34 ` Bob Rossi
1 sibling, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 14:33 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 10:26:01AM -0400, Bob Rossi wrote:
> > > which simply allows any data at the beggining of the match. So I could
> > > easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > > the first thing it outputs, and it would go unnoticed in the
> > > testsuite. Probably the reason this could not have been done before is
> > > because the MI input command was being echo'd back, and it would be
> > > complicated to match that data.
> >
> > I am suggesting anchoring the pattern with a copy of what you expect to
> > be echoed. We already have code to escape a string into a regex. We
> > know what we sent to GDB.
>
> I originally tried this, but failed because I did *not* know how to
> escape a string into a regex. Is there a function written that does
> this? I'll try it.
# Given an input string, adds backslashes as needed to create a
# regexp that will match the string.
proc string_to_regexp {str} {
set result $str
regsub -all {[]*+.|()^$\[]} $str {\\&} result
return $result
}
> > If you think that's too much trouble, could you alternatively try "stty
> > -echo" in expect, rather than send_gdb "shell stty -echo"?
>
> This was the original path I went down. However, I couldn't figure out
> what the heck remote_spawn is. There is no documentation anywere (that I
> could find). So, does remote_spawn call spawn? Does it take the same
> arguments as spawn?
It's part of DejaGNU.
# If the command is successfully started, a positive "spawn id" is returned.
# If the spawn fails, a negative value will be returned.
That spawn ID should suffice. I'd rather match the echoed text though.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 14:26 ` Bob Rossi
2005-08-04 14:33 ` Daniel Jacobowitz
@ 2005-08-04 14:34 ` Bob Rossi
1 sibling, 0 replies; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 14:34 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 10:26:01AM -0400, Bob Rossi wrote:
> > > which simply allows any data at the beggining of the match. So I could
> > > easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > > the first thing it outputs, and it would go unnoticed in the
> > > testsuite. Probably the reason this could not have been done before is
> > > because the MI input command was being echo'd back, and it would be
> > > complicated to match that data.
> >
> > I am suggesting anchoring the pattern with a copy of what you expect to
> > be echoed. We already have code to escape a string into a regex. We
> > know what we sent to GDB.
>
> I originally tried this, but failed because I did *not* know how to
> escape a string into a regex. Is there a function written that does
> this? I'll try it.
Is it string_to_regexp? I'll try this.
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 14:33 ` Daniel Jacobowitz
@ 2005-08-04 20:37 ` Bob Rossi
2005-08-04 20:48 ` Bob Rossi
2005-08-04 20:57 ` Daniel Jacobowitz
0 siblings, 2 replies; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 20:37 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 10:32:38AM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 04, 2005 at 10:26:01AM -0400, Bob Rossi wrote:
> > > > which simply allows any data at the beggining of the match. So I could
> > > > easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > > > the first thing it outputs, and it would go unnoticed in the
> > > > testsuite. Probably the reason this could not have been done before is
> > > > because the MI input command was being echo'd back, and it would be
> > > > complicated to match that data.
> > >
> > > I am suggesting anchoring the pattern with a copy of what you expect to
> > > be echoed. We already have code to escape a string into a regex. We
> > > know what we sent to GDB.
> >
> > I originally tried this, but failed because I did *not* know how to
> > escape a string into a regex. Is there a function written that does
> > this? I'll try it.
>
> # Given an input string, adds backslashes as needed to create a
> # regexp that will match the string.
>
> proc string_to_regexp {str} {
> set result $str
> regsub -all {[]*+.|()^$\[]} $str {\\&} result
> return $result
> }
This doesn't seem to work for the " character.
Here's the input to string_to_regexp,
555-break-insert -t "\"basics.c\":28"
Here's the output,
555-break-insert -t "\"basics\.c\":28"
Here is what I need to pass the test (which I hand wrote),
-break-insert -t \"\\\\\"basics.c\\\\\":28\"
It's a little odd. The quote needs to be escaped once, which makes
perfect sense to me. The \ char needs to be escaped with 3 back slashes,
to make a total of 4. This is a little odd to me. Is that what
string_to_regexp does?
Any ideas?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 20:37 ` Bob Rossi
@ 2005-08-04 20:48 ` Bob Rossi
2005-08-04 20:58 ` Daniel Jacobowitz
2005-08-04 20:57 ` Daniel Jacobowitz
1 sibling, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 20:48 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 04:37:04PM -0400, Bob Rossi wrote:
> On Thu, Aug 04, 2005 at 10:32:38AM -0400, Daniel Jacobowitz wrote:
> > On Thu, Aug 04, 2005 at 10:26:01AM -0400, Bob Rossi wrote:
> > > > > which simply allows any data at the beggining of the match. So I could
> > > > > easily modify an MI command to output "HAHAHA, YOU CAN'T TEST ME", as
> > > > > the first thing it outputs, and it would go unnoticed in the
> > > > > testsuite. Probably the reason this could not have been done before is
> > > > > because the MI input command was being echo'd back, and it would be
> > > > > complicated to match that data.
> > > >
> > > > I am suggesting anchoring the pattern with a copy of what you expect to
> > > > be echoed. We already have code to escape a string into a regex. We
> > > > know what we sent to GDB.
> > >
> > > I originally tried this, but failed because I did *not* know how to
> > > escape a string into a regex. Is there a function written that does
> > > this? I'll try it.
> >
> > # Given an input string, adds backslashes as needed to create a
> > # regexp that will match the string.
> >
> > proc string_to_regexp {str} {
> > set result $str
> > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > return $result
> > }
>
> This doesn't seem to work for the " character.
>
> Here's the input to string_to_regexp,
> 555-break-insert -t "\"basics.c\":28"
>
> Here's the output,
> 555-break-insert -t "\"basics\.c\":28"
>
> Here is what I need to pass the test (which I hand wrote),
> -break-insert -t \"\\\\\"basics.c\\\\\":28\"
>
> It's a little odd. The quote needs to be escaped once, which makes
> perfect sense to me. The \ char needs to be escaped with 3 back slashes,
> to make a total of 4. This is a little odd to me. Is that what
> string_to_regexp does?
>
> Any ideas?
For instance, a change from
regsub -all {[]*+.|()^$\[]} $str {\\&} result
to
regsub -all {[]*+."|()^$\[]} $str {\\&} result
escapes the quotes. Would a change like this be OK? I'll run the
testsuite.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 20:37 ` Bob Rossi
2005-08-04 20:48 ` Bob Rossi
@ 2005-08-04 20:57 ` Daniel Jacobowitz
2005-08-04 21:18 ` Bob Rossi
1 sibling, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 20:57 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 04:37:04PM -0400, Bob Rossi wrote:
> > proc string_to_regexp {str} {
> > set result $str
> > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > return $result
> > }
>
> This doesn't seem to work for the " character.
>
> Here's the input to string_to_regexp,
> 555-break-insert -t "\"basics.c\":28"
>
> Here's the output,
> 555-break-insert -t "\"basics\.c\":28"
>
> Here is what I need to pass the test (which I hand wrote),
> -break-insert -t \"\\\\\"basics.c\\\\\":28\"
>
> It's a little odd. The quote needs to be escaped once, which makes
> perfect sense to me. The \ char needs to be escaped with 3 back slashes,
> to make a total of 4. This is a little odd to me. Is that what
> string_to_regexp does?
>
> Any ideas?
Replace this:
regsub -all {[]*+.|()^$\[]} $str {\\&} result
with this:
regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
i.e. add two backslashes before the closing break. Then does it work?
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 20:48 ` Bob Rossi
@ 2005-08-04 20:58 ` Daniel Jacobowitz
2005-08-04 21:17 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 20:58 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 04:47:56PM -0400, Bob Rossi wrote:
> For instance, a change from
> regsub -all {[]*+.|()^$\[]} $str {\\&} result
> to
> regsub -all {[]*+."|()^$\[]} $str {\\&} result
>
> escapes the quotes. Would a change like this be OK? I'll run the
> testsuite.
Note, the quotes should _not_ actually need to be escaped. They're not
regex-active.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 20:58 ` Daniel Jacobowitz
@ 2005-08-04 21:17 ` Bob Rossi
0 siblings, 0 replies; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 21:17 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 04:58:32PM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 04, 2005 at 04:47:56PM -0400, Bob Rossi wrote:
> > For instance, a change from
> > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > to
> > regsub -all {[]*+."|()^$\[]} $str {\\&} result
> >
> > escapes the quotes. Would a change like this be OK? I'll run the
> > testsuite.
>
> Note, the quotes should _not_ actually need to be escaped. They're not
> regex-active.
That's odd, for some reason, the testcase will only pass if the quotes
are escaped. I have the expression written by hand, and it's the only
way it'll work. I agree they are not a special char for regex's.
What do you think?
Is it because it's currently in a string when being matched? I think
that might be the case. Is there a work around for this?
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 20:57 ` Daniel Jacobowitz
@ 2005-08-04 21:18 ` Bob Rossi
2005-08-04 22:40 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 21:18 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 04:57:47PM -0400, Daniel Jacobowitz wrote:
> On Thu, Aug 04, 2005 at 04:37:04PM -0400, Bob Rossi wrote:
> > > proc string_to_regexp {str} {
> > > set result $str
> > > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > > return $result
> > > }
> >
> > This doesn't seem to work for the " character.
> >
> > Here's the input to string_to_regexp,
> > 555-break-insert -t "\"basics.c\":28"
> >
> > Here's the output,
> > 555-break-insert -t "\"basics\.c\":28"
> >
> > Here is what I need to pass the test (which I hand wrote),
> > -break-insert -t \"\\\\\"basics.c\\\\\":28\"
> >
> > It's a little odd. The quote needs to be escaped once, which makes
> > perfect sense to me. The \ char needs to be escaped with 3 back slashes,
> > to make a total of 4. This is a little odd to me. Is that what
> > string_to_regexp does?
> >
> > Any ideas?
>
> Replace this:
> regsub -all {[]*+.|()^$\[]} $str {\\&} result
> with this:
> regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
>
> i.e. add two backslashes before the closing break. Then does it work?
Ouch, yes it does.
Thanks very much,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 21:18 ` Bob Rossi
@ 2005-08-04 22:40 ` Bob Rossi
2005-08-04 22:43 ` Daniel Jacobowitz
0 siblings, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 22:40 UTC (permalink / raw)
To: gdb-patches
On Thu, Aug 04, 2005 at 05:18:34PM -0400, Bob Rossi wrote:
> On Thu, Aug 04, 2005 at 04:57:47PM -0400, Daniel Jacobowitz wrote:
> > On Thu, Aug 04, 2005 at 04:37:04PM -0400, Bob Rossi wrote:
> > > > proc string_to_regexp {str} {
> > > > set result $str
> > > > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > > > return $result
> > > > }
> > >
> > > This doesn't seem to work for the " character.
> > >
> > > Here's the input to string_to_regexp,
> > > 555-break-insert -t "\"basics.c\":28"
> > >
> > > Here's the output,
> > > 555-break-insert -t "\"basics\.c\":28"
> > >
> > > Here is what I need to pass the test (which I hand wrote),
> > > -break-insert -t \"\\\\\"basics.c\\\\\":28\"
> > >
> > > It's a little odd. The quote needs to be escaped once, which makes
> > > perfect sense to me. The \ char needs to be escaped with 3 back slashes,
> > > to make a total of 4. This is a little odd to me. Is that what
> > > string_to_regexp does?
> > >
> > > Any ideas?
> >
> > Replace this:
> > regsub -all {[]*+.|()^$\[]} $str {\\&} result
> > with this:
> > regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
> >
> > i.e. add two backslashes before the closing break. Then does it work?
>
> Ouch, yes it does.
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?
Thanks,
Bob Rossi
--- /home/bob/cvs/gdb/original/objdir/gdb/testsuite/gdb.sum 2005-08-04 18:26:56.000000000 -0400
+++ gdb.sum 2005-08-04 18:26:46.000000000 -0400
@@ -5887,7 +5887,7 @@
PASS: gdb.base/sizeof.exp: get valueof "(int) (char) -1" (-1)
PASS: gdb.base/sizeof.exp: get valueof "(int) (signed char) -1" (-1)
PASS: gdb.base/sizeof.exp: get valueof "(int) (unsigned char) -1" (255)
-PASS: gdb.base/sizeof.exp: check valueof "'\\377'"
+FAIL: gdb.base/sizeof.exp: check valueof "'\\377'"
PASS: gdb.base/sizeof.exp: check valueof "(int) (char) -1"
PASS: gdb.base/sizeof.exp: check valueof "(int) (signed char) -1"
PASS: gdb.base/sizeof.exp: check valueof "(int) (unsigned char) -1"
@@ -10861,8 +10861,8 @@
PASS: gdb.threads/manythreads.exp: stop threads 1
PASS: gdb.threads/manythreads.exp: info threads
PASS: gdb.threads/manythreads.exp: second continue
-FAIL: gdb.threads/manythreads.exp: stop threads 2
-FAIL: gdb.threads/manythreads.exp: GDB exits after stopping multithreaded program
+PASS: gdb.threads/manythreads.exp: stop threads 2
+PASS: gdb.threads/manythreads.exp: GDB exits after stopping multithreaded program
Running ../../../src/gdb/testsuite/gdb.threads/print-threads.exp ...
PASS: gdb.threads/print-threads.exp: successfully compiled posix threads test case
PASS: gdb.threads/print-threads.exp: set print sevenbit-strings
@@ -11109,7 +11109,7 @@
PASS: gdb.threads/tls.exp: 4 info address a_thread_local
PASS: gdb.threads/tls.exp: 4 info address another_thread_local
PASS: gdb.threads/tls.exp: selected thread: 5
-FAIL: gdb.threads/tls.exp: thread 5 up
+PASS: gdb.threads/tls.exp: thread 5 up
PASS: gdb.threads/tls.exp: 5 thread print me
FAIL: gdb.threads/tls.exp: 5 thread local storage
FAIL: gdb.threads/tls.exp: 5 another thread local storage
@@ -11277,12 +11277,12 @@
=== gdb Summary ===
-# of expected passes 10783
-# of unexpected failures 31
+# of expected passes 10785
+# of unexpected failures 29
# of unexpected successes 1
# of expected failures 41
# of known failures 59
# of untested testcases 6
# of unsupported tests 6
-/home/bob/cvs/gdb/original/objdir/gdb/testsuite/../../gdb/gdb version 6.3.50.20050804-cvs -nx
+/home/bob/cvs/gdb/gdbmi_tcl_ext/objdir/gdb/testsuite/../../gdb/gdb version 6.3.50.20050804-cvs -nx
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 22:40 ` Bob Rossi
@ 2005-08-04 22:43 ` Daniel Jacobowitz
2005-08-04 23:50 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-08-04 22:43 UTC (permalink / raw)
To: gdb-patches
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.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 22:43 ` Daniel Jacobowitz
@ 2005-08-04 23:50 ` Bob Rossi
2005-09-18 1:32 ` Daniel Jacobowitz
0 siblings, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-08-04 23:50 UTC (permalink / raw)
To: gdb-patches
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.
Thanks,
Bob Rossi
Index: gdb/testsuite/ChangeLog
+ * gdb.mi/mi-disassemble.exp, gdb.mi/mi2-disassemble.exp: Remove .*
+ from test. Escape the | in mi_gdb_test call.
+ * lib/mi-support.exp: Remove arbitrary .* from tests.
+ (mi_gdb_test): 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/testsuite/gdb.base/sizeof.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/sizeof.exp,v
retrieving revision 1.7
diff -u -r1.7 sizeof.exp
--- gdb/testsuite/gdb.base/sizeof.exp 13 Jul 2004 17:08:36 -0000 1.7
+++ gdb/testsuite/gdb.base/sizeof.exp 4 Aug 2005 23:47:58 -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/testsuite/gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -u -r1.13 mi-disassemble.exp
--- gdb/testsuite/gdb.mi/mi-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.13
+++ gdb/testsuite/gdb.mi/mi-disassemble.exp 4 Aug 2005 23:47:58 -0000
@@ -163,7 +163,7 @@
# -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" \
@@ -171,7 +171,7 @@
"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" \
Index: gdb/testsuite/gdb.mi/mi2-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi2-disassemble.exp,v
retrieving revision 1.3
diff -u -r1.3 mi2-disassemble.exp
--- gdb/testsuite/gdb.mi/mi2-disassemble.exp 15 Aug 2004 10:15:58 -0000 1.3
+++ gdb/testsuite/gdb.mi/mi2-disassemble.exp 4 Aug 2005 23:47:58 -0000
@@ -163,7 +163,7 @@
# -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" \
@@ -171,7 +171,7 @@
"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" \
Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.63
diff -u -r1.63 gdb.exp
--- gdb/testsuite/lib/gdb.exp 8 May 2005 13:42:04 -0000 1.63
+++ gdb/testsuite/lib/gdb.exp 4 Aug 2005 23:47:59 -0000
@@ -864,7 +864,7 @@
proc string_to_regexp {str} {
set result $str
- regsub -all {[]*+.|()^$\[]} $str {\\&} result
+ regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
return $result
}
Index: gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.29
diff -u -r1.29 mi-support.exp
--- gdb/testsuite/lib/mi-support.exp 4 Aug 2005 01:52:31 -0000 1.29
+++ gdb/testsuite/lib/mi-support.exp 4 Aug 2005 23:47:59 -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,10 @@
gdb_start
set result -1
}
- -re "\[\r\n\]*($pattern)\[\r\n\]+$mi_gdb_prompt\[ \]*$" {
+ -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.
+
if ![string match "" $message] then {
pass "$message"
}
@@ -917,11 +922,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
}
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-08-04 23:50 ` Bob Rossi
@ 2005-09-18 1:32 ` Daniel Jacobowitz
2005-09-18 2:10 ` Bob Rossi
2005-09-21 1:26 ` Bob Rossi
0 siblings, 2 replies; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-09-18 1:32 UTC (permalink / raw)
To: gdb-patches
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!
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-09-18 1:32 ` Daniel Jacobowitz
@ 2005-09-18 2:10 ` Bob Rossi
2005-09-21 1:26 ` Bob Rossi
1 sibling, 0 replies; 21+ messages in thread
From: Bob Rossi @ 2005-09-18 2:10 UTC (permalink / raw)
To: gdb-patches
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 still working on this patch, I should be able to post something next
week though.
> 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!
Yeah, I'll try to make sure this goes away.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-09-18 1:32 ` Daniel Jacobowitz
2005-09-18 2:10 ` Bob Rossi
@ 2005-09-21 1:26 ` Bob Rossi
2005-09-26 1:42 ` Daniel Jacobowitz
1 sibling, 1 reply; 21+ messages in thread
From: Bob Rossi @ 2005-09-21 1:26 UTC (permalink / raw)
To: gdb-patches
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
}
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-09-21 1:26 ` Bob Rossi
@ 2005-09-26 1:42 ` Daniel Jacobowitz
2005-09-27 22:41 ` Bob Rossi
0 siblings, 1 reply; 21+ messages in thread
From: Daniel Jacobowitz @ 2005-09-26 1:42 UTC (permalink / raw)
To: gdb-patches
On Tue, Sep 20, 2005 at 09:25:39PM -0400, Bob Rossi wrote:
> 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.
Looks good to me. This is OK. Could you make sure to update the
copyright years in any of these files which weren't changed in 2005?
Only one I see offhand is sizeof.exp but I did not check them all.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Fully anchor mi_gdb_test expected results.
2005-09-26 1:42 ` Daniel Jacobowitz
@ 2005-09-27 22:41 ` Bob Rossi
0 siblings, 0 replies; 21+ messages in thread
From: Bob Rossi @ 2005-09-27 22:41 UTC (permalink / raw)
To: gdb-patches
On Sun, Sep 25, 2005 at 09:42:18PM -0400, Daniel Jacobowitz wrote:
> On Tue, Sep 20, 2005 at 09:25:39PM -0400, Bob Rossi wrote:
> > 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.
>
> Looks good to me. This is OK. Could you make sure to update the
> copyright years in any of these files which weren't changed in 2005?
> Only one I see offhand is sizeof.exp but I did not check them all.
Thanks Daniel, I appreciate it. I added the copyright dates and
committed the patch. Also, I thought it might be nice to hear, the
MI is still syntactically correct!
This means I can continue nicely, without any distractions at this
point.
Thanks,
Bob Rossi
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2005-09-27 22:41 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04 2:50 Fully anchor mi_gdb_test expected results Bob Rossi
2005-08-04 4:11 ` Daniel Jacobowitz
2005-08-04 14:09 ` Bob Rossi
2005-08-04 14:18 ` Daniel Jacobowitz
2005-08-04 14:26 ` Bob Rossi
2005-08-04 14:33 ` Daniel Jacobowitz
2005-08-04 20:37 ` Bob Rossi
2005-08-04 20:48 ` Bob Rossi
2005-08-04 20:58 ` Daniel Jacobowitz
2005-08-04 21:17 ` Bob Rossi
2005-08-04 20:57 ` Daniel Jacobowitz
2005-08-04 21:18 ` Bob Rossi
2005-08-04 22:40 ` Bob Rossi
2005-08-04 22:43 ` Daniel Jacobowitz
2005-08-04 23:50 ` Bob Rossi
2005-09-18 1:32 ` Daniel Jacobowitz
2005-09-18 2:10 ` Bob Rossi
2005-09-21 1:26 ` Bob Rossi
2005-09-26 1:42 ` Daniel Jacobowitz
2005-09-27 22:41 ` Bob Rossi
2005-08-04 14:34 ` Bob Rossi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox