make_cleanup_bfd_close.
* defs.h (make_cleanup_bfd_unref): Rename from
make_cleanup_bfd_close.
* cli/cli-dump.c (bfd_openr_with_cleanup): Update.
(bfd_openw_with_cleanup): Update.
* corelow.c (core_open): Update.
* dsrec.c (load_srec): Update.
* m32r-rom.c (m32r_load, m32r_upload_command): Update.
* remote-m32r-sdi.c (m32r_load): Update.
* remote-mips.c (mips_load_srec): Update.
(pmon_load_fast): Update.
* solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
Update.
(darwin_bfd_open): Update.
* solib.c (solib_bfd_fopen): Update.
* symfile-mem.c (symbol_file_add_from_memory): Update.
* symfile.c (symbol_file_add_with_addrs_or_offsets): Update.
(symfile_bfd_open): Update.
(generic_load): Update.
2012-07-18 Tom Tromey <tromey@redhat.com>
+ * utils.c (make_cleanup_bfd_unref): Rename from
+ make_cleanup_bfd_close.
+ * defs.h (make_cleanup_bfd_unref): Rename from
+ make_cleanup_bfd_close.
+ * cli/cli-dump.c (bfd_openr_with_cleanup): Update.
+ (bfd_openw_with_cleanup): Update.
+ * corelow.c (core_open): Update.
+ * dsrec.c (load_srec): Update.
+ * m32r-rom.c (m32r_load, m32r_upload_command): Update.
+ * remote-m32r-sdi.c (m32r_load): Update.
+ * remote-mips.c (mips_load_srec): Update.
+ (pmon_load_fast): Update.
+ * solib-darwin.c (darwin_solib_get_all_image_info_addr_at_init):
+ Update.
+ (darwin_bfd_open): Update.
+ * solib.c (solib_bfd_fopen): Update.
+ * symfile-mem.c (symbol_file_add_from_memory): Update.
+ * symfile.c (symbol_file_add_with_addrs_or_offsets): Update.
+ (symfile_bfd_open): Update.
+ (generic_load): Update.
+
+2012-07-18 Tom Tromey <tromey@redhat.com>
+
* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.
(pmon_load_fast): Likewise.
* m32r-rom.c (m32r_load): Use make_cleanup_bfd_close.
error (_("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ()));
- make_cleanup_bfd_close (ibfd);
+ make_cleanup_bfd_unref (ibfd);
if (!bfd_check_format (ibfd, bfd_object))
error (_("'%s' is not a recognized file format."), filename);
if (obfd == NULL)
error (_("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ()));
- make_cleanup_bfd_close (obfd);
+ make_cleanup_bfd_unref (obfd);
if (!bfd_set_format (obfd, bfd_object))
error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ()));
}
/* FIXME: should be checking for errors from bfd_close (for one
thing, on error it does not free all the storage associated
with the bfd). */
- make_cleanup_bfd_close (temp_bfd);
+ make_cleanup_bfd_unref (temp_bfd);
error (_("\"%s\" is not a core dump: %s"),
filename, bfd_errmsg (bfd_get_error ()));
}
extern struct cleanup *make_cleanup_fclose (FILE *file);
-extern struct cleanup *make_cleanup_bfd_close (bfd *abfd);
+extern struct cleanup *make_cleanup_bfd_unref (bfd *abfd);
struct obstack;
extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack);
return;
}
- cleanup = make_cleanup_bfd_close (abfd);
+ cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0)
{
printf_filtered (_("File is not an object file\n"));
abfd = gdb_bfd_ref (bfd_openr (filename, 0));
if (!abfd)
error (_("Unable to open file %s."), filename);
- cleanup = make_cleanup_bfd_close (abfd);
+ cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0)
error (_("File is not an object file."));
gettimeofday (&start_time, NULL);
gettimeofday (&end_time, NULL);
abfd = gdb_bfd_ref (bfd_openr (args, 0));
- cleanup = make_cleanup_bfd_close (abfd);
+ cleanup = make_cleanup_bfd_unref (abfd);
if (abfd != NULL)
{ /* Download is done -- print section statistics. */
if (bfd_check_format (abfd, bfd_object) == 0)
perror_with_name (filename);
return;
}
- old_chain = make_cleanup_bfd_close (pbfd);
+ old_chain = make_cleanup_bfd_unref (pbfd);
if (!bfd_check_format (pbfd, bfd_object))
error (_("\"%s\" is not an object file: %s"), filename,
return;
}
- cleanup = make_cleanup_bfd_close (abfd);
+ cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0)
{
printf_filtered ("File is not an object file\n");
printf_filtered ("Unable to open file %s\n", file);
return;
}
- cleanup = make_cleanup_bfd_close (abfd);
+ cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0)
{
{
bfd *sub;
- make_cleanup_bfd_close (dyld_bfd);
+ make_cleanup_bfd_unref (dyld_bfd);
sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object,
gdbarch_bfd_arch_info (target_gdbarch));
if (sub)
{
dyld_bfd = gdb_bfd_ref (sub);
- make_cleanup_bfd_close (sub);
+ make_cleanup_bfd_unref (sub);
}
else
dyld_bfd = NULL;
gdbarch_bfd_arch_info (target_gdbarch));
if (!res)
{
- make_cleanup_bfd_close (abfd);
+ make_cleanup_bfd_unref (abfd);
error (_("`%s': not a shared-library: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
/* Check bfd format. */
if (!bfd_check_format (abfd, bfd_object))
{
- make_cleanup_bfd_close (abfd);
+ make_cleanup_bfd_unref (abfd);
error (_("`%s': not in executable format: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
if (!bfd_check_format (nbfd, bfd_object))
{
- make_cleanup_bfd_close (nbfd);
+ make_cleanup_bfd_unref (nbfd);
error (_("Got object file from memory but can't read symbols: %s."),
bfd_errmsg (bfd_get_error ()));
}
add_flags &= ~SYMFILE_NO_READ;
}
- my_cleanups = make_cleanup_bfd_close (abfd);
+ my_cleanups = make_cleanup_bfd_unref (abfd);
/* Give user a chance to burp if we'd be
interactively wiping out any existing symbols. */
if (!bfd_check_format (sym_bfd, bfd_object))
{
- make_cleanup_bfd_close (sym_bfd);
+ make_cleanup_bfd_unref (sym_bfd);
error (_("`%s': can't read symbols: %s."), name,
bfd_errmsg (bfd_get_error ()));
}
if (!bfd_check_format (sym_bfd, bfd_object))
{
- make_cleanup_bfd_close (sym_bfd);
+ make_cleanup_bfd_unref (sym_bfd);
error (_("`%s': can't read symbols: %s."), name,
bfd_errmsg (bfd_get_error ()));
}
return;
}
- make_cleanup_bfd_close (loadfile_bfd);
+ make_cleanup_bfd_unref (loadfile_bfd);
if (!bfd_check_format (loadfile_bfd, bfd_object))
{
}
struct cleanup *
-make_cleanup_bfd_close (bfd *abfd)
+make_cleanup_bfd_unref (bfd *abfd)
{
return make_cleanup (do_bfd_close_cleanup, abfd);
}