From: Daniel Jacobowitz <drow@mvista.com>
To: Michael Elizabeth Chastain <mec@shout.net>
Cc: ac131313@redhat.com, gdb-patches@sources.redhat.com
Subject: Re: RFC: gdb_test_multiple
Date: Sun, 05 Jan 2003 17:38:00 -0000 [thread overview]
Message-ID: <20030105173848.GB2779@nevyn.them.org> (raw)
In-Reply-To: <200301051653.h05Grvd19105@duracef.shout.net>
On Sun, Jan 05, 2003 at 10:53:57AM -0600, Michael Elizabeth Chastain wrote:
> Hi Daniel,
>
> > 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.
>
> I don't understand. Are you saying that:
>
> set msg "breakpoint on Foo::Bar"
> gdb_test_multiple "break Foo::Bar" $msg {
> -re "foo" {
> ... fail $msg ...
> }
> }
>
> requires something gross in gdb_test_multiple in order to work?
No, but this similar construct:
set teststr "foo"
gdb_test_multiple "break Foo::Bar" $msg {
-re "$teststr" {
... fail $msg ...
}
}
does. And that idiom is all over the testsuite, for readability
purposes; see $hex, etc.
> I guess my question is: when does the "$msg" in "fail $msg" get
> expanded. If the caller expands it before calling gdb_test_multiple
> then I don't see the problem. If the caller passes "{ ... fail $msg ... }"
> without expanding $msg then I do see the problem.
{ } quoting in TCL completely disables expansion. Variables inside a
"proc name { args } { vars $here } are not expanded until the procedure
is called; similarly for the {} construct above.
If you think about it, this is logical. Consider
$expect_out(0,string), which is based on the regular expression match.
Its value isn't known when gdb_test_multiple is called, so it can't be
expanded until after the matching is done.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-01-05 17:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-05 16:54 Michael Elizabeth Chastain
2003-01-05 17:38 ` Daniel Jacobowitz [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-01-07 4:33 Michael Elizabeth Chastain
2003-01-05 17:45 Michael Elizabeth Chastain
2003-01-05 16:33 Michael Elizabeth Chastain
2003-01-05 16:46 ` Daniel Jacobowitz
2003-01-05 5:25 Michael Elizabeth Chastain
2003-01-04 20:16 Daniel Jacobowitz
2003-01-05 15:32 ` Andrew Cagney
2003-01-05 15:42 ` Daniel Jacobowitz
2003-01-06 21:12 ` Andrew Cagney
2003-01-07 3:25 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030105173848.GB2779@nevyn.them.org \
--to=drow@mvista.com \
--cc=ac131313@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=mec@shout.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox