Uniquefy gdb.threads/attach-into-signal.exp
[deliverable/binutils-gdb.git] / gdb / gdb_bfd.c
index 3d5d23f7cb81568291ddda7ccd8cf3247d878994..1781d80853723713a0b544928ae8edd4828214ca 100644 (file)
@@ -32,6 +32,7 @@
 #endif
 #include "target.h"
 #include "gdb/fileio.h"
+#include "inferior.h"
 
 typedef bfd *bfdp;
 DEF_VEC_P (bfdp);
@@ -213,7 +214,7 @@ fileio_errno_to_host (int errnum)
    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;
@@ -221,7 +222,8 @@ gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *open_closure)
 
   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)
@@ -326,25 +328,12 @@ gdb_bfd_open (const char *name, const char *target, int fd)
        {
          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);
This page took 0.030063 seconds and 4 git commands to generate.