diff options
Diffstat (limited to 'gdb/gdb_bfd.c')
-rw-r--r-- | gdb/gdb_bfd.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 61872a0..25e0178 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -271,22 +271,29 @@ fileio_errno_to_host (int errnum) return -1; } +/* bfd_openr_iovec OPEN_CLOSURE data for gdb_bfd_open. */ +struct gdb_bfd_open_closure +{ + inferior *inf; + bool warn_if_slow; +}; + /* Wrapper for target_fileio_open suitable for passing as the - OPEN_FUNC argument to gdb_bfd_openr_iovec. The supplied - OPEN_CLOSURE is unused. */ + OPEN_FUNC argument to gdb_bfd_openr_iovec. */ static void * -gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *inferior) +gdb_bfd_iovec_fileio_open (struct bfd *abfd, void *open_closure) { const char *filename = bfd_get_filename (abfd); int fd, target_errno; int *stream; + gdb_bfd_open_closure *oclosure = (gdb_bfd_open_closure *) open_closure; gdb_assert (is_target_filename (filename)); - fd = target_fileio_open ((struct inferior *) inferior, + fd = target_fileio_open (oclosure->inf, filename + strlen (TARGET_SYSROOT_PREFIX), - FILEIO_O_RDONLY, 0, true, + FILEIO_O_RDONLY, 0, oclosure->warn_if_slow, &target_errno); if (fd == -1) { @@ -378,7 +385,8 @@ gdb_bfd_iovec_fileio_fstat (struct bfd *abfd, void *stream, /* See gdb_bfd.h. */ gdb_bfd_ref_ptr -gdb_bfd_open (const char *name, const char *target, int fd) +gdb_bfd_open (const char *name, const char *target, int fd, + bool warn_if_slow) { hashval_t hash; void **slot; @@ -392,9 +400,10 @@ gdb_bfd_open (const char *name, const char *target, int fd) { gdb_assert (fd == -1); + gdb_bfd_open_closure open_closure { current_inferior (), warn_if_slow }; return gdb_bfd_openr_iovec (name, target, gdb_bfd_iovec_fileio_open, - current_inferior (), + &open_closure, gdb_bfd_iovec_fileio_pread, gdb_bfd_iovec_fileio_close, gdb_bfd_iovec_fileio_fstat); |