From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3697 invoked by alias); 15 Sep 2014 04:46:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3684 invoked by uid 89); 15 Sep 2014 04:45:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_20 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, 15 Sep 2014 04:45:58 +0000 Received: from svr-orw-fem-02x.mgc.mentorg.com ([147.34.96.206] helo=SVR-ORW-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XTOAk-0005gz-VC from Yao_Qi@mentor.com ; Sun, 14 Sep 2014 21:45:54 -0700 Received: from GreenOnly (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.3.181.6; Sun, 14 Sep 2014 21:45:54 -0700 From: Yao Qi To: Doug Evans CC: Subject: Re: [PATCH] Another board file for remote host References: <1409232690-24185-1-git-send-email-yao@codesourcery.com> <87y4u2d9ic.fsf@codesourcery.com> <87d2bbcyn8.fsf@codesourcery.com> Date: Mon, 15 Sep 2014 04:46:00 -0000 In-Reply-To: <87d2bbcyn8.fsf@codesourcery.com> (Yao Qi's message of "Thu, 4 Sep 2014 21:18:19 +0800") Message-ID: <87egvd4hrx.fsf@codesourcery.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00489.txt.bz2 Yao Qi writes: >> +global GDB >> +set GDB [file join [pwd] "../gdb"] >> >> Check if GDB has been set first, allow the user to >> pass this in from the command line. > > GDB is always set in lib/gdb.exp and it is loaded earlier than the > board file. In lib/gdb.exp: > > if ![info exists GDB] { > if ![is_remote host] { > set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [tra= nsform gdb]] > } else { > set GDB [transform gdb] > } > } > > so we can't do the check here. > >> +# The directory to copy files to. In default, we choose ./remote-host,= to >> +# avoiding messing up your HOME. You can choose other directory as >> +# you like. >> +set host_dir [file join [pwd] "remote-host"] >> >> How about allowing the user to pass this in from the command line? >> By convention such variables are then uppercase. >> > > That is fine to me. In the updated patch, user can specify the > directory in command line via variable HOST_DIR. > >> + >> +proc ${board}_download { board src dest } { >> + global env board_type >> + global host_dir >> + >> + if { [llength $dest] > 0 } { >> + set destfile [lindex $dest 0] >> + } else { >> + set destfile [file tail $src] >> + } >> >> This doesn't feel right. >> I realize /usr/share/dejagnu/remote.exp:remote_download >> checks for whether the third parameter can be a list, but >> remote_download is a varargs function (the name of the last >> variable is "args") and is not a "board" function. >> Other ${foo}_download functions that are actual "board" functions, >> e.g., /usr/share/dejagnu/remote.exp:standard_download, >> or gdb/testsuite/boards/remote-stdio-gdbserver.exp, >> don't treat the third parameter as if it can be a list. > > Yes, remote_download acts as a wrapper or an adapter to "board" > functions which are defined in board files. In tcl, simple string is > also list, see, > > % llength "foo" > 1 > % lindex "foo" 0=20=20=20=20=20 > foo > > The code above is right to me but unnecessary. Use dest as a string in > the updated patch. Hi, Doug, How do you think of the updated patch? https://sourceware.org/ml/gdb-patches/2014-09/msg00117.html --=20 Yao (=E9=BD=90=E5=B0=A7)