From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18934 invoked by alias); 15 Sep 2014 05:35:22 -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 18919 invoked by uid 89); 15 Sep 2014 05:35:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f47.google.com Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 15 Sep 2014 05:35:19 +0000 Received: by mail-pa0-f47.google.com with SMTP id ey11so5583097pad.20 for ; Sun, 14 Sep 2014 22:35:17 -0700 (PDT) X-Received: by 10.68.135.2 with SMTP id po2mr36123680pbb.6.1410759317614; Sun, 14 Sep 2014 22:35:17 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id im1sm10219728pbb.29.2014.09.14.22.35.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2014 22:35:16 -0700 (PDT) From: Doug Evans To: Yao Qi 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 05:35:00 -0000 In-Reply-To: <87d2bbcyn8.fsf@codesourcery.com> (Yao Qi's message of "Thu, 4 Sep 2014 21:18:19 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00491.txt.bz2 Yao Qi writes: > Doug Evans 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" [transform gdb]] > } else { > set GDB [transform gdb] > } > } > > so we can't do the check here. I deleted the setting of GDB in this file and was able to run tests by passing GDB=/usr/bin/gdb on the command line. I then tried not passing GDB= on the command line and I see /usr/bin/gdb still being run (it's invoked as "gdb" without any path). Bleah. It would really be nice to make this work, but it's not critical for this first checkin. OTOH, I think this is way too subtle an issue and requires a comment. Something like: +# We have to explicitly specify GDB with the path to the copy in +# in the build directory because otherwise it will be set to the +# result of "transform GDB" since the harness thinks we're using +# a remote host. See lib/gdb.exp. +set GDB [file join [pwd] "../gdb"] +verbose -log "Overriding setting of GDB to $GDB" There's no need for "global GDB" 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 > foo > > The code above is right to me but unnecessary. Use dest as a string in > the updated patch. Besides the issue of setting GDB I have one more nit. I found this useful while diagnosing failures: proc ${board}_download { board src dest } { global HOST_DIR if { ![file exists $HOST_DIR] } { file mkdir $HOST_DIR } set destfile [file join $HOST_DIR $dest] + verbose -log "${board}_download: file copy -force $src $destfile" file copy -force $src $destfile return $destfile } With those two issues addressed I'm happy. [I'm sure more issues will arise as I'm seeing failures I wouldn't have expected. I didn't spend much time on them and at any rate I think we can get this checked in so that we can start addressing them collectively.]