#include "gdb-dlfcn.h"
#include "gdb_stat.h"
#include "exceptions.h"
+#include "gdb_bfd.h"
static const char *jit_reader_dir = NULL;
static struct bfd *
bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target)
{
- const char *filename = xstrdup ("<in-memory>");
struct target_buffer *buffer = xmalloc (sizeof (struct target_buffer));
buffer->base = addr;
buffer->size = size;
- return bfd_openr_iovec (filename, target,
- mem_bfd_iovec_open,
- buffer,
- mem_bfd_iovec_pread,
- mem_bfd_iovec_close,
- mem_bfd_iovec_stat);
+ return gdb_bfd_openr_iovec ("<in-memory>", target,
+ mem_bfd_iovec_open,
+ buffer,
+ mem_bfd_iovec_pread,
+ mem_bfd_iovec_close,
+ mem_bfd_iovec_stat);
}
/* One reader that has been loaded successfully, and can potentially be used to
{
printf_unfiltered (_("\
JITed symbol file is not an object file, ignoring it.\n"));
- bfd_close (nbfd);
+ gdb_bfd_unref (nbfd);
return;
}
++i;
}
- /* This call takes ownership of NBFD. It does not take ownership of SAI. */
+ /* This call does not take ownership of SAI. */
+ make_cleanup_bfd_unref (nbfd);
objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL);
do_cleanups (old_cleanups);