From patchwork Mon May 19 03:37:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 1006 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 7367C3600B4 for ; Sun, 18 May 2014 20:40:29 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 2719963C409D2; Sun, 18 May 2014 20:40:29 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id E982E63C40987 for ; Sun, 18 May 2014 20:40:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=CkG6K5OOS1gCk7Cr wHBbB0Lvaoz7/x2k6ETEDwTaaplJ+aRrEM0zHZRO2ks79z12fwAB248t5M9wpv90 c9G/FBtmrUX7QQQR1iy+DDzxrwPlxbSTnOpMCgKP+b7nJuKcaflh8uFy3V/CLlZk h0UEnkGlx9teUUnSnjJvPtq/FH8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=mqtPU6gR9bVxZ3XKcuZobG PHFTE=; b=llQcbAVpYdUty/cBMLCq16Qlox5797dB8YzelMAOkfg19wMDhQKyHY GuzQKyoC5xj1Eyvh/GMMqsCJIQ3QjeWJqVSsxMwiFHyeGXYHrGAc7D6icyAds+w4 h7JDE3AM424NMJpkXRpChVMWct5bmBQt8ZaSgogPgHK/C+8OJqqKY= Received: (qmail 1660 invoked by alias); 19 May 2014 03:40:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1642 invoked by uid 89); 19 May 2014 03:40:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 May 2014 03:40:22 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WmER0-0004Hq-E4 from Yao_Qi@mentor.com ; Sun, 18 May 2014 20:40:18 -0700 Received: from SVR-ORW-FEM-06.mgc.mentorg.com ([147.34.97.120]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 18 May 2014 20:40:18 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.2.247.3; Sun, 18 May 2014 20:40:17 -0700 Message-ID: <53797C8A.5080902@codesourcery.com> Date: Mon, 19 May 2014 11:37:46 +0800 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Tom Tromey CC: Subject: Re: [PATCH] gdb_init argument ARGS is a string rather than a list References: <1399626515-29231-1-git-send-email-yao@codesourcery.com> <87fvkaaoup.fsf@fleche.redhat.com> In-Reply-To: <87fvkaaoup.fsf@fleche.redhat.com> X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in On 05/16/2014 02:17 AM, Tom Tromey wrote: > The "args" parameter is special in Tcl. It signals a "rest" parameter > and so causes a single argument to be list-ified by the interpreter: > > % proc l {args} { return [llength $args] } > % l {a b c} > 1 > % proc r {a} { return [llength $a] } > % r {a b c} > 3 > > So while the current code is a bit odd, I think it is also > correct-enough. Tom, I didn't realize "args" is a special one. Thanks for pointing this out. The code is correct, but using "args" isn't necessary, because caller (proc runtest) only passes one string to it. > > Yao> - return [eval default_gdb_init $args] > Yao> + return [eval default_gdb_init $test_file_name] > > If you want to proceed with this you will need to remove the "eval" > here. I want to proceed with this since it simplifies code in default_gdb_init. "eval" is removed in the updated patch. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3125e7a..a34ab3a 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3519,17 +3519,18 @@ proc gdb_continue { function } { return [gdb_test "continue" ".*Breakpoint $decimal, $function .*" "continue to $function"] } -proc default_gdb_init { args } { +proc default_gdb_init { test_file_name } { global gdb_wrapper_initialized global gdb_wrapper_target global gdb_test_file_name global cleanfiles + global pf_prefix set cleanfiles {} gdb_clear_suppressed - set gdb_test_file_name [file rootname [file tail [lindex $args 0]]] + set gdb_test_file_name [file rootname [file tail $test_file_name]] # Make sure that the wrapper is rebuilt # with the appropriate multilib option. @@ -3545,13 +3546,8 @@ proc default_gdb_init { args } { match_max [match_max -d] # We want to add the name of the TCL testcase to the PASS/FAIL messages. - if { [llength $args] > 0 } { - global pf_prefix + set pf_prefix "[file tail [file dirname $test_file_name]]/[file tail $test_file_name]:" - set file [lindex $args 0] - - set pf_prefix "[file tail [file dirname $file]]/[file tail $file]:" - } global gdb_prompt if [target_info exists gdb_prompt] { set gdb_prompt [target_info gdb_prompt] @@ -3687,7 +3683,7 @@ set banned_procedures { strace } # if the banned variables and procedures are already traced. set banned_traced 0 -proc gdb_init { args } { +proc gdb_init { test_file_name } { # Reset the timeout value to the default. This way, any testcase # that changes the timeout value without resetting it cannot affect # the timeout used in subsequent testcases. @@ -3766,7 +3762,7 @@ proc gdb_init { args } { set gdbserver_reconnect_p 1 unset gdbserver_reconnect_p - return [eval default_gdb_init $args] + return [default_gdb_init $test_file_name] } proc gdb_finish { } {