This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Another board file for remote host


Actually I've been spending more time with this today, I know I owe
you a response.
I have an emacs buffer with a reply in progress.
Good timing ... :-)

On Sun, Sep 14, 2014 at 9:41 PM, Yao Qi <yao@codesourcery.com> wrote:
> Yao Qi <yao@codesourcery.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.
>>
>>> +# 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.
>
> Hi, Doug,
> How do you think of the updated patch?
> https://sourceware.org/ml/gdb-patches/2014-09/msg00117.html
>
> --
> Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]