From: Tom Tromey Date: Wed, 18 Jul 2012 19:42:26 +0000 (+0000) Subject: * utils.c (make_cleanup_bfd_unref): Rename from X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f9a062ffb59ebed937221b852eab2abbd43111ed;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 29ccc0c95c8..1ce1cf63dd4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2012-07-18 Tom Tromey + + * 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 * remote-mips.c (mips_load_srec): Use make_cleanup_bfd_close. diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 7dce32ac2f5..124476771c9 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -117,7 +117,7 @@ bfd_openr_with_cleanup (const char *filename, const char *target) 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); @@ -136,7 +136,7 @@ bfd_openw_with_cleanup (const char *filename, const char *target, 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 ())); } diff --git a/gdb/corelow.c b/gdb/corelow.c index 1fd60e41db5..380c0dce523 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -333,7 +333,7 @@ core_open (char *filename, int from_tty) /* 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 ())); } diff --git a/gdb/defs.h b/gdb/defs.h index bd556b0ccb5..18aec8d2dac 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -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_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); diff --git a/gdb/dsrec.c b/gdb/dsrec.c index 8eefe1e0bf4..66d4c13bfcf 100644 --- a/gdb/dsrec.c +++ b/gdb/dsrec.c @@ -68,7 +68,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, 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")); diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index 9dbcd2609c8..ffda6f91b7f 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -133,7 +133,7 @@ m32r_load (char *filename, int from_tty) 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); @@ -530,7 +530,7 @@ m32r_upload_command (char *args, int from_tty) 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) diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 0536ccfd00b..b4b73248026 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -1264,7 +1264,7 @@ m32r_load (char *args, int from_tty) 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, diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 5020d2aa73f..b46325f4b6f 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2796,7 +2796,7 @@ mips_load_srec (char *args) 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"); @@ -3382,7 +3382,7 @@ pmon_load_fast (char *file) 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) { diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index 8d8da7e604c..7109eadde37 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -376,13 +376,13 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) { 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; @@ -517,7 +517,7 @@ darwin_bfd_open (char *pathname) 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 ())); } diff --git a/gdb/solib.c b/gdb/solib.c index 4ddf91ad322..0fd955d59a9 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -424,7 +424,7 @@ solib_bfd_open (char *pathname) /* 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 ())); } diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 0470d97589b..ad87abdf75d 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -113,7 +113,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name, 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 ())); } diff --git a/gdb/symfile.c b/gdb/symfile.c index 99427aeb28f..c9040112dea 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1075,7 +1075,7 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, 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. */ @@ -1731,7 +1731,7 @@ symfile_bfd_open (char *name) 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 ())); } @@ -1775,7 +1775,7 @@ symfile_bfd_open (char *name) 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 ())); } @@ -2113,7 +2113,7 @@ generic_load (char *args, int from_tty) return; } - make_cleanup_bfd_close (loadfile_bfd); + make_cleanup_bfd_unref (loadfile_bfd); if (!bfd_check_format (loadfile_bfd, bfd_object)) { diff --git a/gdb/utils.c b/gdb/utils.c index d26899980d2..a2bc00da344 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -203,7 +203,7 @@ do_bfd_close_cleanup (void *arg) } struct cleanup * -make_cleanup_bfd_close (bfd *abfd) +make_cleanup_bfd_unref (bfd *abfd) { return make_cleanup (do_bfd_close_cleanup, abfd); }