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: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


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