[PATCH 0/7] Do not require "file" commands for remote targets

Gary Benson
2015-04-01T11:22:36Z

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:

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?

Thanks,
Gary

--
[1] https://sourceware.org/ml/gdb-patches/2015-03/msg00638.html