This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: gdb_test_multiple


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]