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: Andrew Cagney <ac131313 at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com,Michael Elizabeth Chastain <mec at shout dot net>
- Date: Sun, 5 Jan 2003 10:42:34 -0500
- Subject: Re: RFC: gdb_test_multiple
- References: <20030104201600.GA26779@nevyn.them.org> <3E18501D.8050601@redhat.com>
On Sun, Jan 05, 2003 at 10:32:45AM -0500, Andrew Cagney wrote:
> >gdb_test_multiple "break Foo::Bar" "breakpoint on Foo::Bar" {
> > -re "Breakpoint at .*\[\r\n\]$gdb_prompt $" {
> > pass "$_gdb_message"
> > }
> > -re "Explode!" {
> > fail "$_gdb_message (gdb/90210)"
> > }
> > -re "Bang." {
> > kfail "gdb/90211" "$_gdb_message"
> > }
> >}
>
> Why not just use:
>
> set msg "breakpoint on Foo::Bar"
> gdb_test_multiple "break Foo::Bar" {
> ... fail "$msg ...
> }
>
> I don't think the ``$_gdb_message'' is right. It certainly isn't
> exactly intuative.
No, it certainly isn't. The problem is that the other cases internally
need to know the msg; the only way to do it as above would be to
document a _required_ variable named $msg. This works, of course:
set msg "breakpoint on Foo::Bar"
gdb_test_multiple "break Foo::Bar" "breakpoint on Foo::Bar" {
... fail "$msg ...
}
I want to think about this a little more anyway; as Michael mentioned,
I don't think it's recursion safe. I can't fix this syntax due to TCL
limitations, so it might become:
gdb_test_multiple "break Foo::Bar" "breakpoint on Foo::Bar" \
"Breakpoint at .*\[\r\n\]$gdb_prompt $" { pass $msg } \
"Bang." { kfail "gdb/90211" $msg }
Which isn't so bad, after all. I had some reason not to do it that way
but I can't remember what it was, now. What do you think of this
change?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer