Make gdb_bfd_open able to open BFDs using target fileio
authorGary Benson <gbenson@redhat.com>
Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)
committerGary Benson <gbenson@redhat.com>
Thu, 2 Apr 2015 12:38:29 +0000 (13:38 +0100)
commitf08e97fed19e0722b6b36e7e638ee86a8aca7db5
tree06019cc0794c1a621d978ee3be6fb00f98e7a505
parent4bd7dc42558fcf53bb0c783f852f03dcac38866f
Make gdb_bfd_open able to open BFDs using target fileio

This commit updates gdb_bfd_open to access files using target
fileio functions if the supplied path starts with "target:"
and if the local and target filesystems are not the same.
This allows users to specify "set sysroot target:" and have
GDB access files locally or from the remote as appropriate.

The new functions in gdb_bfd.c are copies of functions from
remote.c. This duplication is intentional and will be removed
by the next commit in this series.

gdb/ChangeLog:

* gdb/gdb_bfd.h (TARGET_SYSROOT_PREFIX): New definition.
(is_target_filename): New declaration.
(gdb_bfd_has_target_filename): Likewise.
(gdb_bfd_open): Update documentation comment.
* gdb_bfd.c (target.h): New include.
(gdb/fileio.h): Likewise.
(is_target_filename): New function.
(gdb_bfd_has_target_filename): Likewise.
(fileio_errno_to_host): Likewise.
(gdb_bfd_iovec_fileio_open): Likewise.
(gdb_bfd_iovec_fileio_pread): Likewise.
(gdb_bfd_iovec_fileio_close): Likewise.
(gdb_bfd_iovec_fileio_fstat): Likewise.
(gdb_bfd_open): Use target fileio to access paths prefixed
with "target:" where necessary.
gdb/ChangeLog
gdb/gdb_bfd.c
gdb/gdb_bfd.h