aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-18 19:33:34 +0000
committerTom Tromey <tromey@redhat.com>2012-07-18 19:33:34 +0000
commitcbb099e88685f8aa80b9a958ba35988d8dbb8721 (patch)
tree67610bb717b6f48e0a3dbf9c6779da252c96177a /gdb/machoread.c
parent * breakpoint.c (find_condition_and_thread): Initialize (diff)
downloadbinutils-gdb-cbb099e88685f8aa80b9a958ba35988d8dbb8721.tar.gz
binutils-gdb-cbb099e88685f8aa80b9a958ba35988d8dbb8721.tar.bz2
binutils-gdb-cbb099e88685f8aa80b9a958ba35988d8dbb8721.zip
* dwarf2read.c (try_open_dwo_file): Use gdb_bfd_ref and
gdb_bfd_unref. (free_dwo_file): Use gdb_bfd_unref. * cli/cli-dump.c: Include gdb_bfd.h. (bfd_openw_with_cleanup): Use gdb_bfd_ref. (bfd_openr_with_cleanup): Likewise. * windows-nat.c (windows_make_so): Use gdb_bfd_ref, gdb_bfd_unref. * utils.c: Include gdb_bfd.h. (do_bfd_close_cleanup): Use gdb_bfd_unref. * symfile.c: Include gdb_bfd.h. (separate_debug_file_exists): Use gdb_bfd_unref. (bfd_open_maybe_remote): Use gdb_bfd_ref. (symfile_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref. (generic_load): Use gdb_bfd_ref. (reread_symbols): Use gdb_bfd_unref. * symfile-mem.c: Include gdb_bfd.h. (symbol_file_add_from_memory): Use make_cleanup_bfd_close. * spu-linux-nat.c (spu_bfd_open): Use gdb_bfd_ref, gdb_bfd_unref. * solib.c: Include gdb_bfd.h. (solib_bfd_fopen): Use gdb_bfd_ref. (solib_bfd_open): Use gdb_bfd_unref. (free_so_symbols): Use gdb_bfd_unref. (reload_shared_libraries_1): Use gdb_bfd_unref. * solib-spu.c: Include gdb_bfd.h. (spu_bfd_fopen): Use gdb_bfd_ref, gdb_bfd_unref. * solib-pa64.c (pa64_solib_create_inferior_hook): Use gdb_bfd_ref, gdb_bfd_unref. * solib-frv.c: Include gdb_bfd.h. (enable_break2): Use gdb_bfd_unref. * solib-dsbt.c: Include gdb_bfd.h. (enable_break2): Use gdb_bfd_unref. * solib-darwin.c: Include gdb_bfd.h. (darwin_solib_get_all_image_info_addr_at_init): Use gdb_bfd_ref, gdb_bfd_unref. (darwin_bfd_open): Use gdb_bfd_unref. * rs6000-nat.c (add_vmap): Use gdb_bfd_ref, gdb_bfd_unref. * remote-mips.c: Include gdb_bfd.h. (mips_load_srec): Use gdb_bfd_ref. (pmon_load_fast): Use gdb_bfd_ref. * remote-m32r-sdi.c: Include gdb_bfd.h. (m32r_load): Use gdb_bfd_ref. * record.c: Include gdb_bfd.h. (record_save_cleanups): Use gdb_bfd_unref. (cmd_record_save): Use gdb_bfd_unref. * procfs.c (insert_dbx_link_bpt_in_file): Use gdb_bfd_ref, gdb_bfd_unref. * objfiles.h (gdb_bfd_close_or_warn): Remove. (gdb_bfd_ref, gdb_bfd_unref): Move to gdb_bfd.h. * objfiles.c: Include gdb_bfd.h. (free_objfile): Use gdb_bfd_unref. (gdb_bfd_close_or_warn, gdb_bfd_ref, gdb_bfd_unref): Move to gdb_bfd.c. * machoread.c (macho_add_oso_symfile): Use gdb_bfd_unref. (macho_symfile_read_all_oso): Use gdb_bfd_ref, gdb_bfd_unref. (macho_check_dsym): Likewise. * m32r-rom.c: Include gdb_bfd.h. (m32r_load): Use gdb_bfd_ref. (m32r_upload_command): Use gdb_bfd_ref. * jit.c: Include gdb_bfd.h. (jit_bfd_try_read_symtab): Use gdb_bfd_ref, gdb_bfd_unref. * gdb_bfd.h: New file. * gdb_bfd.c: New file. * gcore.c: Include gdb_bfd.h. (create_gcore_bfd): Use gdb_bfd_ref. (do_bfd_delete_cleanup): Use gdb_bfd_unref. (gcore_command): Use gdb_bfd_unref. * exec.c: Include gdb_bfd.h. (exec_close): Use gdb_bfd_unref. (exec_close_1): Use gdb_bfd_unref. (exec_file_attach): Use gdb_bfd_ref. * elfread.c: Include gdb_bfd.h. (build_id_verify): Use gdb_bfd_unref. * dsrec.c: Include gdb_bfd.h. (load_srec): Use gdb_bfd_ref. * corelow.c: Include gdb_bfd.h. (core_close): Use gdb_bfd_unref. (core_open): Use gdb_bfd_ref. * bfd-target.c: Include gdb_bfd.h. (target_bfd_xclose): Use gdb_bfd_unref. (target_bfd_reopen): Use gdb_bfd_ref. * Makefile.in (SFILES): Add gdb_bfd.c. (HFILES_NO_SRCDIR): Add gdb_bfd.h. (COMMON_OBS): Add gdb_bfd.o.
Diffstat (limited to 'gdb/machoread.c')
-rw-r--r--gdb/machoread.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 22530ab0869..eb56f14629c 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -466,14 +466,14 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
{
warning (_("`%s': can't read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));
- bfd_close (abfd);
+ gdb_bfd_unref (abfd);
return;
}
if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd))
{
warning (_("`%s': file time stamp mismatch."), oso->name);
- bfd_close (abfd);
+ gdb_bfd_unref (abfd);
return;
}
@@ -482,7 +482,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
oso->nbr_syms))
{
warning (_("`%s': can't create hash table"), oso->name);
- bfd_close (abfd);
+ gdb_bfd_unref (abfd);
return;
}
@@ -686,7 +686,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
}
/* Open the archive and check the format. */
- archive_bfd = bfd_openr (archive_name, gnutarget);
+ archive_bfd = gdb_bfd_ref (bfd_openr (archive_name, gnutarget));
if (archive_bfd == NULL)
{
warning (_("Could not open OSO archive file \"%s\""),
@@ -698,17 +698,18 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
{
warning (_("OSO archive file \"%s\" not an archive."),
archive_name);
- bfd_close (archive_bfd);
+ gdb_bfd_unref (archive_bfd);
ix = last_ix;
continue;
}
- member_bfd = bfd_openr_next_archived_file (archive_bfd, NULL);
+ member_bfd = gdb_bfd_ref (bfd_openr_next_archived_file (archive_bfd,
+ NULL));
if (member_bfd == NULL)
{
warning (_("Could not read archive members out of "
"OSO archive \"%s\""), archive_name);
- bfd_close (archive_bfd);
+ gdb_bfd_unref (archive_bfd);
ix = last_ix;
continue;
}
@@ -738,12 +739,13 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
}
prev = member_bfd;
- member_bfd = bfd_openr_next_archived_file
- (archive_bfd, member_bfd);
+ member_bfd
+ = gdb_bfd_ref (bfd_openr_next_archived_file (archive_bfd,
+ member_bfd));
/* Free previous member if not referenced by an oso. */
if (ix2 >= last_ix)
- bfd_close (prev);
+ gdb_bfd_unref (prev);
}
for (ix2 = ix; ix2 < last_ix; ix2++)
{
@@ -759,7 +761,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags)
{
bfd *abfd;
- abfd = bfd_openr (oso->name, gnutarget);
+ abfd = gdb_bfd_ref (bfd_openr (oso->name, gnutarget));
if (!abfd)
warning (_("`%s': can't open to read symbols: %s."), oso->name,
bfd_errmsg (bfd_get_error ()));
@@ -809,7 +811,7 @@ macho_check_dsym (struct objfile *objfile)
return NULL;
}
dsym_filename = xstrdup (dsym_filename);
- dsym_bfd = bfd_openr (dsym_filename, gnutarget);
+ dsym_bfd = gdb_bfd_ref (bfd_openr (dsym_filename, gnutarget));
if (dsym_bfd == NULL)
{
warning (_("can't open dsym file %s"), dsym_filename);
@@ -819,7 +821,7 @@ macho_check_dsym (struct objfile *objfile)
if (!bfd_check_format (dsym_bfd, bfd_object))
{
- bfd_close (dsym_bfd);
+ gdb_bfd_unref (dsym_bfd);
warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ()));
xfree (dsym_filename);
return NULL;
@@ -829,7 +831,7 @@ macho_check_dsym (struct objfile *objfile)
BFD_MACH_O_LC_UUID, &dsym_uuid) == 0)
{
warning (_("can't find UUID in %s"), dsym_filename);
- bfd_close (dsym_bfd);
+ gdb_bfd_unref (dsym_bfd);
xfree (dsym_filename);
return NULL;
}
@@ -837,7 +839,7 @@ macho_check_dsym (struct objfile *objfile)
sizeof (main_uuid->command.uuid.uuid)))
{
warning (_("dsym file UUID doesn't match the one in %s"), objfile->name);
- bfd_close (dsym_bfd);
+ gdb_bfd_unref (dsym_bfd);
xfree (dsym_filename);
return NULL;
}