#endif
#include "target.h"
#include "gdb/fileio.h"
+#include "inferior.h"
typedef bfd *bfdp;
DEF_VEC_P (bfdp);
OPEN_CLOSURE is unused. */
static void *
-gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *open_closure)
+gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior)
{
const char *filename = bfd_get_filename (abfd);
int fd, target_errno;
gdb_assert (is_target_filename (filename));
- fd = target_fileio_open (filename + strlen (TARGET_SYSROOT_PREFIX),
+ fd = target_fileio_open ((struct inferior *) inferior,
+ filename + strlen (TARGET_SYSROOT_PREFIX),
FILEIO_O_RDONLY, 0,
&target_errno);
if (fd == -1)
{
gdb_assert (fd == -1);
- abfd = gdb_bfd_openr_iovec (name, target,
- gdb_bfd_iovec_fileio_open, NULL,
+ return gdb_bfd_openr_iovec (name, target,
+ gdb_bfd_iovec_fileio_open,
+ current_inferior (),
gdb_bfd_iovec_fileio_pread,
gdb_bfd_iovec_fileio_close,
gdb_bfd_iovec_fileio_fstat);
-
- if (abfd != NULL || errno != ENOSYS)
- return abfd;
-
- /* gdb_bfd_iovec_fileio_open failed with ENOSYS. This can
- happen, for example, with vgdb (Valgrind GDB), which
- presents itself as a remote target but works on the local
- filesystem: it does not implement remote get and users
- are not expected to set gdb_sysroot. To handle this case
- we fall back to trying the local filesystem iff
- gdb_sysroot is exactly TARGET_SYSROOT_PREFIX. */
- if (gdb_sysroot == NULL
- || strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0)
- return NULL;
}
name += strlen (TARGET_SYSROOT_PREFIX);