* 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.
This commit is contained in:
Tom Tromey 2012-07-18 19:42:26 +00:00
parent d6ad71ba41
commit f9a062ffb5
13 changed files with 43 additions and 20 deletions

View file

@ -1,3 +1,26 @@
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> 2012-07-18 Tom Tromey <tromey@redhat.com>
* remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close. * remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close.

View file

@ -117,7 +117,7 @@ bfd_openr_with_cleanup (const char *filename, const char *target)
error (_("Failed to open %s: %s."), filename, error (_("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
make_cleanup_bfd_close (ibfd); make_cleanup_bfd_unref (ibfd);
if (!bfd_check_format (ibfd, bfd_object)) if (!bfd_check_format (ibfd, bfd_object))
error (_("'%s' is not a recognized file format."), filename); error (_("'%s' is not a recognized file format."), filename);
@ -136,7 +136,7 @@ bfd_openw_with_cleanup (const char *filename, const char *target,
if (obfd == NULL) if (obfd == NULL)
error (_("Failed to open %s: %s."), filename, error (_("Failed to open %s: %s."), filename,
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
make_cleanup_bfd_close (obfd); make_cleanup_bfd_unref (obfd);
if (!bfd_set_format (obfd, bfd_object)) if (!bfd_set_format (obfd, bfd_object))
error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ())); error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ()));
} }

View file

@ -333,7 +333,7 @@ core_open (char *filename, int from_tty)
/* FIXME: should be checking for errors from bfd_close (for one /* FIXME: should be checking for errors from bfd_close (for one
thing, on error it does not free all the storage associated thing, on error it does not free all the storage associated
with the bfd). */ with the bfd). */
make_cleanup_bfd_close (temp_bfd); make_cleanup_bfd_unref (temp_bfd);
error (_("\"%s\" is not a core dump: %s"), error (_("\"%s\" is not a core dump: %s"),
filename, bfd_errmsg (bfd_get_error ())); filename, bfd_errmsg (bfd_get_error ()));
} }

View file

@ -315,7 +315,7 @@ extern struct cleanup *make_cleanup_close (int fd);
extern struct cleanup *make_cleanup_fclose (FILE *file); 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; struct obstack;
extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack); extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack);

View file

@ -68,7 +68,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset,
return; return;
} }
cleanup = make_cleanup_bfd_close (abfd); cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0) if (bfd_check_format (abfd, bfd_object) == 0)
{ {
printf_filtered (_("File is not an object file\n")); printf_filtered (_("File is not an object file\n"));

View file

@ -133,7 +133,7 @@ m32r_load (char *filename, int from_tty)
abfd = gdb_bfd_ref (bfd_openr (filename, 0)); abfd = gdb_bfd_ref (bfd_openr (filename, 0));
if (!abfd) if (!abfd)
error (_("Unable to open file %s."), filename); 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) if (bfd_check_format (abfd, bfd_object) == 0)
error (_("File is not an object file.")); error (_("File is not an object file."));
gettimeofday (&start_time, NULL); gettimeofday (&start_time, NULL);
@ -530,7 +530,7 @@ m32r_upload_command (char *args, int from_tty)
gettimeofday (&end_time, NULL); gettimeofday (&end_time, NULL);
abfd = gdb_bfd_ref (bfd_openr (args, 0)); abfd = gdb_bfd_ref (bfd_openr (args, 0));
cleanup = make_cleanup_bfd_close (abfd); cleanup = make_cleanup_bfd_unref (abfd);
if (abfd != NULL) if (abfd != NULL)
{ /* Download is done -- print section statistics. */ { /* Download is done -- print section statistics. */
if (bfd_check_format (abfd, bfd_object) == 0) if (bfd_check_format (abfd, bfd_object) == 0)

View file

@ -1264,7 +1264,7 @@ m32r_load (char *args, int from_tty)
perror_with_name (filename); perror_with_name (filename);
return; return;
} }
old_chain = make_cleanup_bfd_close (pbfd); old_chain = make_cleanup_bfd_unref (pbfd);
if (!bfd_check_format (pbfd, bfd_object)) if (!bfd_check_format (pbfd, bfd_object))
error (_("\"%s\" is not an object file: %s"), filename, error (_("\"%s\" is not an object file: %s"), filename,

View file

@ -2796,7 +2796,7 @@ mips_load_srec (char *args)
return; return;
} }
cleanup = make_cleanup_bfd_close (abfd); cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0) if (bfd_check_format (abfd, bfd_object) == 0)
{ {
printf_filtered ("File is not an object file\n"); printf_filtered ("File is not an object file\n");
@ -3382,7 +3382,7 @@ pmon_load_fast (char *file)
printf_filtered ("Unable to open file %s\n", file); printf_filtered ("Unable to open file %s\n", file);
return; return;
} }
cleanup = make_cleanup_bfd_close (abfd); cleanup = make_cleanup_bfd_unref (abfd);
if (bfd_check_format (abfd, bfd_object) == 0) if (bfd_check_format (abfd, bfd_object) == 0)
{ {

View file

@ -376,13 +376,13 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info)
{ {
bfd *sub; bfd *sub;
make_cleanup_bfd_close (dyld_bfd); make_cleanup_bfd_unref (dyld_bfd);
sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object, sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object,
gdbarch_bfd_arch_info (target_gdbarch)); gdbarch_bfd_arch_info (target_gdbarch));
if (sub) if (sub)
{ {
dyld_bfd = gdb_bfd_ref (sub); dyld_bfd = gdb_bfd_ref (sub);
make_cleanup_bfd_close (sub); make_cleanup_bfd_unref (sub);
} }
else else
dyld_bfd = NULL; dyld_bfd = NULL;
@ -517,7 +517,7 @@ darwin_bfd_open (char *pathname)
gdbarch_bfd_arch_info (target_gdbarch)); gdbarch_bfd_arch_info (target_gdbarch));
if (!res) if (!res)
{ {
make_cleanup_bfd_close (abfd); make_cleanup_bfd_unref (abfd);
error (_("`%s': not a shared-library: %s"), error (_("`%s': not a shared-library: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
} }

View file

@ -424,7 +424,7 @@ solib_bfd_open (char *pathname)
/* Check bfd format. */ /* Check bfd format. */
if (!bfd_check_format (abfd, bfd_object)) if (!bfd_check_format (abfd, bfd_object))
{ {
make_cleanup_bfd_close (abfd); make_cleanup_bfd_unref (abfd);
error (_("`%s': not in executable format: %s"), error (_("`%s': not in executable format: %s"),
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
} }

View file

@ -113,7 +113,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name,
if (!bfd_check_format (nbfd, bfd_object)) 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."), error (_("Got object file from memory but can't read symbols: %s."),
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
} }

View file

@ -1075,7 +1075,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
add_flags &= ~SYMFILE_NO_READ; 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 /* Give user a chance to burp if we'd be
interactively wiping out any existing symbols. */ interactively wiping out any existing symbols. */
@ -1731,7 +1731,7 @@ symfile_bfd_open (char *name)
if (!bfd_check_format (sym_bfd, bfd_object)) 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, error (_("`%s': can't read symbols: %s."), name,
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
} }
@ -1775,7 +1775,7 @@ symfile_bfd_open (char *name)
if (!bfd_check_format (sym_bfd, bfd_object)) 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, error (_("`%s': can't read symbols: %s."), name,
bfd_errmsg (bfd_get_error ())); bfd_errmsg (bfd_get_error ()));
} }
@ -2113,7 +2113,7 @@ generic_load (char *args, int from_tty)
return; return;
} }
make_cleanup_bfd_close (loadfile_bfd); make_cleanup_bfd_unref (loadfile_bfd);
if (!bfd_check_format (loadfile_bfd, bfd_object)) if (!bfd_check_format (loadfile_bfd, bfd_object))
{ {

View file

@ -203,7 +203,7 @@ do_bfd_close_cleanup (void *arg)
} }
struct cleanup * struct cleanup *
make_cleanup_bfd_close (bfd *abfd) make_cleanup_bfd_unref (bfd *abfd)
{ {
return make_cleanup (do_bfd_close_cleanup, abfd); return make_cleanup (do_bfd_close_cleanup, abfd);
} }