Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: Yao Qi <yao@codesourcery.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Another board file for remote host
Date: Mon, 15 Sep 2014 05:35:00 -0000	[thread overview]
Message-ID: <m3sijtphui.fsf@sspiff.org> (raw)
In-Reply-To: <87d2bbcyn8.fsf@codesourcery.com> (Yao Qi's message of "Thu, 4	Sep 2014 21:18:19 +0800")

Yao Qi <yao@codesourcery.com> writes:
> Doug Evans <xdje42@gmail.com> 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.]


  parent reply	other threads:[~2014-09-15  5:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28 13:35 Yao Qi
2014-08-28 14:27 ` Pedro Alves
2014-08-29  1:38   ` Yao Qi
2014-08-28 21:17 ` Jan Kratochvil
2014-08-29  1:55   ` Yao Qi
2014-08-29 12:30     ` Jan Kratochvil
2014-09-01  8:14       ` Yao Qi
2014-09-01  8:44         ` Jan Kratochvil
2014-08-29  3:28 ` Doug Evans
2014-09-02  2:52 ` Yao Qi
2014-09-02 14:53   ` Doug Evans
2014-09-04 13:22     ` Yao Qi
2014-09-15  4:46       ` Yao Qi
2014-09-15  4:55         ` Doug Evans
2014-09-15  5:35       ` Doug Evans [this message]
2014-09-15  7:59         ` Yao Qi

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=m3sijtphui.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /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