X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmachoread.c;h=fe77a2dccbfc3d5969615609cfd7daf089a7f66d;hb=45a466b578083a05f1138eff9232254b1a30f683;hp=5b9e2ba4f64fb18fa0ca75464462db89d0439b2a;hpb=64c311498e46cef6b70aa88577e7d7c382e0f7cc;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/machoread.c b/gdb/machoread.c index 5b9e2ba4f6..fe77a2dccb 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -1,5 +1,5 @@ /* Darwin support for GDB, the GNU debugger. - Copyright (C) 2008-2012 Free Software Foundation, Inc. + Copyright (C) 2008-2013 Free Software Foundation, Inc. Contributed by AdaCore. @@ -34,11 +34,12 @@ #include "vec.h" #include "psympriv.h" #include "complaints.h" +#include "gdb_bfd.h" #include /* If non-zero displays debugging message. */ -static int mach_o_debug_level = 0; +static unsigned int mach_o_debug_level = 0; /* Dwarf debugging information are never in the final executable. They stay in object files and the executable contains the list of object files read @@ -78,7 +79,6 @@ static void macho_symfile_init (struct objfile *objfile) { objfile->flags |= OBJF_REORDERED; - init_entry_point_info (objfile); } /* Add a new OSO to the vector of OSO to load. */ @@ -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. */ @@ -684,7 +687,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) } /* Open the archive and check the format. */ - archive_bfd = gdb_bfd_openr (archive_name, gnutarget); + archive_bfd = gdb_bfd_open (archive_name, gnutarget, -1); if (archive_bfd == NULL) { warning (_("Could not open OSO archive file \"%s\""), @@ -758,7 +761,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) { bfd *abfd; - abfd = gdb_bfd_openr (oso->name, gnutarget); + abfd = gdb_bfd_open (oso->name, gnutarget, -1); if (!abfd) warning (_("`%s': can't open to read symbols: %s."), oso->name, bfd_errmsg (bfd_get_error ())); @@ -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; @@ -1039,10 +1045,10 @@ _initialize_machoread () { add_symtab_fns (&macho_sym_fns); - add_setshow_zinteger_cmd ("mach-o", class_obscure, - &mach_o_debug_level, - _("Set if printing Mach-O symbols processing."), - _("Show if printing Mach-O symbols processing."), - NULL, NULL, NULL, - &setdebuglist, &showdebuglist); + add_setshow_zuinteger_cmd ("mach-o", class_obscure, + &mach_o_debug_level, + _("Set if printing Mach-O symbols processing."), + _("Show if printing Mach-O symbols processing."), + NULL, NULL, NULL, + &setdebuglist, &showdebuglist); }