This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/2] Make gdbserver work with filename-only binaries
On Monday, February 26 2018, I wrote:
> On Wednesday, February 21 2018, Pedro Alves wrote:
>>> +
>>> +if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
>>> + return -1
>>> +}
>>> +
>>> +set target_exec [gdbserver_download_current_prog]
>>> +set target_execname [file tail $target_exec]
>>> +# We temporarily copy the file to our current directory
>>> +file copy -force $target_exec [pwd]
>>> +set res [gdbserver_start "" $target_execname]
>>
>> Please remind me -- is the current directory here usually
>> the testcase's output dir? I.e., is it guaranteed that
>> the current directory here is not going to be the same
>> directory of another testcase running in parallel at
>> the same time?
>
> No, [pwd] is actually the gdb/testsuite/ directory, from where the
> Makefile runs. Which means that other tests running in parallel at the
> same time will have the same value for [pwd]. I copied the file to
> [pwd] because that's how I solved the problem of having the binary at
> the same directory as the one I'm starting gdbserver from.
>
> Another solution that I thought was to cd into the the dirname of
> the downloaded $target_exec, execute gdbserver from there, and the cd
> back to the original directory. WDYT?
I decided to go ahead and implement this idea. v3 is now out. Please
let me know your thoughts.
Thanks,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/