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 0/7] Do not require "file" commands for remote targets


On 04/01/2015 12:22 PM, Gary Benson wrote:
> Hi all,
> 
> This series builds on my 'New default sysroot "target:"' series [1]
> and makes GDB able to locate and access executable files when using
> remote targets.  This removes the need for a "file" command before
> "target *remote ...".
> 
> Patches 1-3 cause the main executable's pathname to be prefixed with
> gdb_sysroot on attach in much the same way pathnames of shared
> libraries are treated.
> 
> Patches 4-6 implement the to_pid_to_exec_file method for remote
> targets.  This removes the need for the "file" command when using
> the "attach" command with gdbserver with multiprocess extensions:
> 
>   bash$ gdb -q
>   (gdb) target extended-remote | gdbserver --multi -
>   Remote debugging using | gdbserver --multi -
>   Remote debugging using stdio
>   (gdb) attach 31979
>   Attaching to process 31979
>   Attached; pid = 31979
>   Reading symbols from target:/bin/bash...
> 
> Patch 7 causes GDB to attempt to locate and open the executable
> in remote-target cases without multiprocess extensions:

Should be "with multiprocess extensions".  Without those,
we don't know the target's pid, and thus can't use
pid-to-exec-file.

> 
>   bash$ gdb -q
>   (gdb) target remote | gdbserver - --attach 31979
>   Remote debugging using | gdbserver - --attach 31979
>   Attached; pid = 31979
>   Remote debugging using stdio
>   Reading symbols from target:/bin/bash...
> 
> and:
> 
>   bash$ gdb -q
>   (gdb) target remote | gdbserver - /bin/sh
>   Remote debugging using | gdbserver - /bin/sh
>   Process /bin/sh created; pid = 32166
>   stdin/stdout redirected
>   Remote debugging using stdio
>   Reading symbols from target:/bin/bash...
> 
> There is no change to GDB's behaviour if the user has specified a
> main executable, with the "file" command or on startup, so existing
> use cases do not change.
> 
> Built and regtested on RHEL 6.6 x86_64.
> 
> Ok to commit?

I commented on a couple things, but overall this looks good to me.

Thanks,
Pedro Alves


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