* symfile.c (bfd_open_maybe_remote): Use gdb_bfd_open.
(symfile_bfd_open): Likewise.
(generic_load): Likewise.
* solib.c (solib_bfd_fopen): Use gdb_bfd_open.
* solib-pa64.c (pa64_solib_create_inferior_hook): Use
gdb_bfd_open.
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
Use gdb_bfd_open.
* rs6000-nat.c (add_vmap): Use gdb_bfd_open.
* remote-mips.c (mips_load_srec): Use gdb_bfd_open.
(pmon_load_fast): Likewise.
* remote-m32r-sdi.c (m32r_load): Use gdb_bfd_open.
* procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_open.
* machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_open.
(macho_check_dsym): Likewise.
* m32r-rom.c (m32r_load): Use gdb_bfd_open.
(m32r_upload_command): Likewise.
* gdb_bfd.h (gdb_bfd_cache): Declare.
* gdb_bfd.c (struct gdb_bfd_data): New.
(gdb_bfd_cache): New global.
(struct gdb_bfd_cache_search): New.
(hash_bfd): New function.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(gdb_bfd_ref): Allocate a gdb_bfd_data and attach to the BFD.
(gdb_bfd_unref): Remove closed BFD from cache. Update for
gdb_bfd_data.
* exec.c (exec_file_attach): Use gdb_bfd_open.
* dsrec.c (load_srec): Use gdb_bfd_open.
+2012-08-22 Tom Tromey <tromey@redhat.com>
+
+ * windows-nat.c (windows_make_so): Use gdb_bfd_open.
+ * symfile.c (bfd_open_maybe_remote): Use gdb_bfd_open.
+ (symfile_bfd_open): Likewise.
+ (generic_load): Likewise.
+ * solib.c (solib_bfd_fopen): Use gdb_bfd_open.
+ * solib-pa64.c (pa64_solib_create_inferior_hook): Use
+ gdb_bfd_open.
+ * solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
+ Use gdb_bfd_open.
+ * rs6000-nat.c (add_vmap): Use gdb_bfd_open.
+ * remote-mips.c (mips_load_srec): Use gdb_bfd_open.
+ (pmon_load_fast): Likewise.
+ * remote-m32r-sdi.c (m32r_load): Use gdb_bfd_open.
+ * procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_open.
+ * machoread.c (macho_symfile_read_all_oso): Use gdb_bfd_open.
+ (macho_check_dsym): Likewise.
+ * m32r-rom.c (m32r_load): Use gdb_bfd_open.
+ (m32r_upload_command): Likewise.
+ * gdb_bfd.h (gdb_bfd_cache): Declare.
+ * gdb_bfd.c (struct gdb_bfd_data): New.
+ (gdb_bfd_cache): New global.
+ (struct gdb_bfd_cache_search): New.
+ (hash_bfd): New function.
+ (eq_bfd): Likewise.
+ (gdb_bfd_open): Likewise.
+ (gdb_bfd_ref): Allocate a gdb_bfd_data and attach to the BFD.
+ (gdb_bfd_unref): Remove closed BFD from cache. Update for
+ gdb_bfd_data.
+ * exec.c (exec_file_attach): Use gdb_bfd_open.
+ * dsrec.c (load_srec): Use gdb_bfd_open.
+
2012-08-22 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (macro_start_file): Update.
srec = (char *) alloca (maxrecsize + 1);
- abfd = gdb_bfd_openr (file, 0);
+ abfd = gdb_bfd_open (file, NULL, -1);
if (!abfd)
{
printf_filtered (_("Unable to open file %s\n"), file);
if (scratch_chan < 0)
perror_with_name (filename);
- exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
- write_files ? FOPEN_RUB : FOPEN_RB,
- scratch_chan);
+ if (write_files)
+ exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget,
+ FOPEN_RUB, scratch_chan);
+ else
+ exec_bfd = gdb_bfd_open (scratch_pathname, gnutarget, scratch_chan);
if (!exec_bfd)
{
if (filename == NULL || filename[0] == 0)
filename = get_exec_file (1);
- abfd = gdb_bfd_openr (filename, 0);
+ abfd = gdb_bfd_open (filename, NULL, -1);
if (!abfd)
error (_("Unable to open file %s."), filename);
cleanup = make_cleanup_bfd_unref (abfd);
printf_filtered (" -- Ethernet load complete.\n");
gettimeofday (&end_time, NULL);
- abfd = gdb_bfd_openr (args, 0);
+ abfd = gdb_bfd_open (args, NULL, -1);
cleanup = make_cleanup_bfd_unref (abfd);
if (abfd != NULL)
{ /* Download is done -- print section statistics. */
}
/* Open the archive and check the format. */
- archive_bfd = gdb_bfd_openr (archive_name, gnutarget);
+ archive_bfd = gdb_bfd_open (archive_name, gnutarget, -1);
if (archive_bfd == NULL)
{
warning (_("Could not open OSO archive file \"%s\""),
{
bfd *abfd;
- abfd = gdb_bfd_openr (oso->name, gnutarget);
+ abfd = gdb_bfd_open (oso->name, gnutarget, -1);
if (!abfd)
warning (_("`%s': can't open to read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));
if (!filename)
filename = get_exec_file (1);
- pbfd = gdb_bfd_openr (filename, gnutarget);
+ pbfd = gdb_bfd_open (filename, gnutarget, -1);
if (pbfd == NULL)
{
perror_with_name (filename);
buffer = alloca (srec_frame * 2 + 256);
- abfd = gdb_bfd_openr (args, 0);
+ abfd = gdb_bfd_open (args, NULL, -1);
if (!abfd)
{
printf_filtered ("Unable to open file %s\n", args);
buffer = (char *) xmalloc (MAXRECSIZE + 1);
binbuf = (unsigned char *) xmalloc (BINCHUNK);
- abfd = gdb_bfd_openr (file, 0);
+ abfd = gdb_bfd_open (file, NULL, -1);
if (!abfd)
{
printf_filtered ("Unable to open file %s\n", file);
mem = xstrdup (mem);
fd = LDI_FD (ldi, arch64);
- if (fd < 0)
- /* Note that this opens it once for every member; a possible
- enhancement would be to only open it once for every object. */
- abfd = gdb_bfd_openr (filename, gnutarget);
- else
- abfd = gdb_bfd_fdopenr (filename, gnutarget, fd);
+ abfd = gdb_bfd_open (filename, gnutarget, fd < 0 ? -1 : fd);
if (!abfd)
{
warning (_("Could not open `%s' as an executable file: %s"),
cleanup = make_cleanup (null_cleanup, NULL);
/* Create a bfd for the interpreter. */
- dyld_bfd = gdb_bfd_openr (interp_name, gnutarget);
+ dyld_bfd = gdb_bfd_open (interp_name, gnutarget, -1);
if (dyld_bfd)
{
bfd *sub;
to find any magic formula to find it for Solaris (appears to
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
- tmp_bfd = gdb_bfd_openr (buf, gnutarget);
+ tmp_bfd = gdb_bfd_open (buf, gnutarget, -1);
if (tmp_bfd == NULL)
return;
}
else
{
- abfd = gdb_bfd_fopen (pathname, gnutarget, FOPEN_RB, fd);
+ abfd = gdb_bfd_open (pathname, gnutarget, fd);
if (abfd)
bfd_set_cacheable (abfd, 1);
if (remote_filename_p (name))
result = remote_bfd_open (name, gnutarget);
else
- result = gdb_bfd_openr (name, gnutarget);
+ result = gdb_bfd_open (name, gnutarget, -1);
return result;
}
name = absolute_name;
make_cleanup (xfree, name);
- sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc);
+ sym_bfd = gdb_bfd_open (name, gnutarget, desc);
if (!sym_bfd)
{
make_cleanup (xfree, name);
}
/* Open the file for loading. */
- loadfile_bfd = gdb_bfd_openr (filename, gnutarget);
+ loadfile_bfd = gdb_bfd_open (filename, gnutarget, -1);
if (loadfile_bfd == NULL)
{
perror_with_name (filename);
asection *text = NULL;
CORE_ADDR text_vma;
- abfd = gdb_bfd_openr (so->so_name, "pei-i386");
+ abfd = gdb_bfd_open (so->so_name, "pei-i386", -1);
if (!abfd)
return so;