This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: gdb_test_multiple
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: ac131313 at redhat dot com, gdb-patches at sources dot redhat dot com
- Date: Sun, 5 Jan 2003 11:46:36 -0500
- Subject: Re: RFC: gdb_test_multiple
- References: <200301051633.h05GX2C18873@duracef.shout.net>
On Sun, Jan 05, 2003 at 10:33:02AM -0600, Michael Elizabeth Chastain wrote:
> Daniel Jacobowitz writes:
>
> set msg "breakpoint on Foo::Bar"
> gdb_test_multiple "break Foo::Bar" "breakpoint on Foo::Bar" {
> ... fail "$msg ...
> }
>
> This can be improved to:
>
> set msg "breakpoint on Foo::Bar"
> gdb_test_multiple "break Foo::Bar" $msg {
> ... fail $msg ...
> }
>
> The grammar would still allow different messages for the explicit
> messages given by the caller versus the internal messages generated
> by gdb_test_multiple. But the normal idiom would have one $msg.
>
> gdb_test_multiple "break Foo::Bar" "breakpoint on Foo::Bar" \
> "Breakpoint at .*\[\r\n\]$gdb_prompt $" { pass $msg } \
> "Bang." { kfail "gdb/90211" $msg }
>
> Err, I like my treatment of $msg better, I dislike subroutines that
> create variables like this for little inferior blocks of code.
> But maybe I have poor taste in TCL style.
This isn't a style thing, though. Let me point out the actual
syntactic difference between the two above: the strings are
expanded/substituted at the time of the call to gdb_test_multiple
instead of at the time of the actual expect {}, down the call chain.
This means that I don't have to do the grossness with populating
variables in the caller's namespace, which violates every bit of
stylistic sense I've got left after yesterday.
Could even arrange to run the { pass $foo } block in the caller's
level, which is exactly as expected.
I like the revised proposal much more :) What do you think of it?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer