aboutsummaryrefslogtreecommitdiff
path: root/gdb/machoread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
committerTom Tromey <tromey@redhat.com>2012-07-23 14:58:44 +0000
commit8ac244b433d5d36b787afd36f7144069e7d837e0 (patch)
treedccbc64cbec657281a84c4d8e07d96df3e508661 /gdb/machoread.c
parent64c311498e46cef6b70aa88577e7d7c382e0f7cc (diff)
downloadgdb-8ac244b433d5d36b787afd36f7144069e7d837e0.zip
gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.gz
gdb-8ac244b433d5d36b787afd36f7144069e7d837e0.tar.bz2
* coffread.c (coff_symfile_read): Make a cleanup for 'debugfile'
and 'abfd'. * elfread.c (elf_symfile_read): Make a cleanup for 'debugfile' and 'abfd'. * jit.c (jit_bfd_try_read_symtab): Make a cleanup for 'nbfd'. * machoread.c (macho_add_oso_symfile): Make a cleanup for 'abfd'. (macho_symfile_read): Make a cleanup for 'dsym_bfd'. * objfiles.c (allocate_objfile): Acquire a new reference. * rs6000-nat.c (add_vmap): Don't acquire a BFD reference. * solib.c (solib_read_symbols): Don't acquire a BFD reference. * spu-linux-nat.c (spu_symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile-mem.c (symbol_file_add_from_memory): Make a cleanup for 'nbfd'. * symfile.c (symbol_file_add_with_addrs_or_offsets): Don't make a cleanup for 'abfd'. (symbol_file_add): Make a BFD cleanup.
Diffstat (limited to 'gdb/machoread.c')
-rw-r--r--gdb/machoread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 5b9e2ba..0d7578a 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -454,6 +454,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
asymbol **symp;
struct bfd_hash_table table;
int nbr_sections;
+ struct cleanup *cleanup;
/* Per section flag to mark which section have been rebased. */
unsigned char *sections_rebased;
@@ -631,11 +632,13 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd,
/* We need to clear SYMFILE_MAINLINE to avoid interractive question
from symfile.c:symbol_file_add_with_addrs_or_offsets. */
+ cleanup = make_cleanup_bfd_unref (abfd);
symbol_file_add_from_bfd
(abfd, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), NULL,
main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED
| OBJF_READNOW | OBJF_USERLOADED),
main_objfile);
+ do_cleanups (cleanup);
}
/* Read symbols from the vector of oso files. */
@@ -897,6 +900,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
int ix;
oso_el *oso;
struct bfd_section *asect, *dsect;
+ struct cleanup *cleanup;
if (mach_o_debug_level > 0)
printf_unfiltered (_("dsym file found\n"));
@@ -917,7 +921,9 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags)
}
/* Add the dsym file as a separate file. */
+ cleanup = make_cleanup_bfd_unref (dsym_bfd);
symbol_file_add_separate (dsym_bfd, symfile_flags, objfile);
+ do_cleanups (cleanup);
/* Don't try to read dwarf2 from main file or shared libraries. */
return;