From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25876 invoked by alias); 5 Jan 2003 17:38:48 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 25869 invoked from network); 5 Jan 2003 17:38:48 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 209.249.29.67 with SMTP; 5 Jan 2003 17:38:48 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18VGc3-00022I-00; Sun, 05 Jan 2003 13:39:11 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18VEjY-0000kO-00; Sun, 05 Jan 2003 12:38:48 -0500 Date: Sun, 05 Jan 2003 17:38:00 -0000 From: Daniel Jacobowitz To: Michael Elizabeth Chastain Cc: ac131313@redhat.com, gdb-patches@sources.redhat.com Subject: Re: RFC: gdb_test_multiple Message-ID: <20030105173848.GB2779@nevyn.them.org> Mail-Followup-To: Michael Elizabeth Chastain , ac131313@redhat.com, gdb-patches@sources.redhat.com References: <200301051653.h05Grvd19105@duracef.shout.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200301051653.h05Grvd19105@duracef.shout.net> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-01/txt/msg00189.txt.bz2 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