X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fmachoread.c;h=26eac27a049c035b524d200a45d2cc66235887cd;hb=d043f8c867f85f1c36cc957da8204fe2907b3aea;hp=4c1d4f0bfa78ee689fcc85a9815eba554b713ad5;hpb=b98664d3862579c5a0d23901b1e2fc1f595f39ff;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/machoread.c b/gdb/machoread.c index 4c1d4f0bfa..26eac27a04 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -1,5 +1,5 @@ /* Darwin support for GDB, the GNU debugger. - Copyright (C) 2008-2018 Free Software Foundation, Inc. + Copyright (C) 2008-2019 Free Software Foundation, Inc. Contributed by AdaCore. @@ -24,12 +24,10 @@ #include "bfd.h" #include "symfile.h" #include "objfiles.h" -#include "buildsym.h" #include "gdbcmd.h" #include "gdbcore.h" #include "mach-o.h" #include "aout/stab_gnu.h" -#include "vec.h" #include "psympriv.h" #include "complaints.h" #include "gdb_bfd.h" @@ -576,7 +574,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd, sec->name, sym->name, paddress (arch, res)); } - bfd_set_section_vma (abfd.get (), sec, res); + bfd_set_section_vma (sec, res); sections_rebased[sec->index] = 1; } } @@ -590,7 +588,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd, bfd_hash_table_free (&table); - /* We need to clear SYMFILE_MAINLINE to avoid interractive question + /* We need to clear SYMFILE_MAINLINE to avoid interactive question from symfile.c:symbol_file_add_with_addrs_or_offsets. */ symbol_file_add_from_bfd (abfd.get (), name, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), @@ -616,7 +614,7 @@ macho_symfile_read_all_oso (std::vector *oso_vector_ptr, std::sort (oso_vector_ptr->begin (), oso_vector_ptr->end (), oso_el_compare_name); - for (ix = 0; ix < oso_vector_ptr->size (); ++ix) + for (ix = 0; ix < oso_vector_ptr->size ();) { int pfx_len; @@ -672,7 +670,7 @@ macho_symfile_read_all_oso (std::vector *oso_vector_ptr, /* Load all oso in this library. */ while (member_bfd != NULL) { - const char *member_name = member_bfd->filename; + const char *member_name = bfd_get_filename (member_bfd.get ()); int member_len = strlen (member_name); /* If this member is referenced, add it as a symfile. */ @@ -686,7 +684,7 @@ macho_symfile_read_all_oso (std::vector *oso_vector_ptr, member_len)) { macho_add_oso_symfile (oso2, member_bfd, - bfd_get_filename (member_bfd), + bfd_get_filename (member_bfd.get ()), main_objfile, symfile_flags); oso2->name = NULL; break; @@ -698,7 +696,7 @@ macho_symfile_read_all_oso (std::vector *oso_vector_ptr, } for (ix2 = ix; ix2 < last_ix; ix2++) { - oso_el *oso2 = &(*oso_vector_ptr)[ix2]; + oso2 = &(*oso_vector_ptr)[ix2]; if (oso2->name != NULL) warning (_("Could not find specified archive member " @@ -793,6 +791,9 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) bfd *abfd = objfile->obfd; long storage_needed; std::vector oso_vector; + /* We have to hold on to the symbol table until the call to + macho_symfile_read_all_oso at the end of this function. */ + gdb::def_vector symbol_table; /* Get symbols from the symbol table only if the file is an executable. The symbol table of object files is not relocated and is expected to @@ -812,8 +813,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { long symcount; - gdb::def_vector symbol_table (storage_needed - / sizeof (asymbol *)); + symbol_table.resize (storage_needed / sizeof (asymbol *)); minimal_symbol_reader reader (objfile); @@ -853,8 +853,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { if (strcmp (asect->name, dsect->name) != 0) break; - bfd_set_section_size (dsym_bfd.get (), dsect, - bfd_get_section_size (asect)); + bfd_set_section_size (dsect, bfd_section_size (asect)); } /* Add the dsym file as a separate file. */