This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: MI testsuite to use PTY for inferior
On Sun, Jul 31, 2005 at 10:27:59AM +1200, Nick Roberts wrote:
> That seems to imply that if IPATTERN is present, MESSAGE can't be omitted.
Yes. If this bugs you, you could make a message of "" be handled like
an omitted message.
> How about:
>
> # mi_gdb_test COMMAND PATTERN-LIST [MESSAGE]
> ...
> # PATTERN-LIST is the list {PATTERN [IPATTERN]} where:
> # PATTERN is the pattern to match for a PASS, and must NOT include
> # the \r\n sequence immediately before the gdb prompt.
> # IPATTERN is the pattern to match for the inferior's output. This will not
> # produce a PASS if successfull, but will produce a FAIL if unsuccessful.
>
> if {[llength $PATTERN-LIST] == 1} {
> ...
> } elseif {[llength $PATTERN-LIST] == 2} {
> ...
>
> This seems to be compatible with existing arguments as scalars seem to be
> considered as lists of length 1. But perhaps you can't have lists within
> argument lists in TCL.
No, that won't work correctly. TCL quoting is funny. Look at this:
% set a "a"
a
% llength $a
1
% set a "a b"
a b
% llength $a
2
It reparses the string, textually, as a list. Most patterns will be
more than one "item". This would be easy in Python, but is a bit of a
bear in TCL.
--
Daniel Jacobowitz
CodeSourcery, LLC