Fix build failure with macOS bison
[deliverable/binutils-gdb.git] / gdb / machoread.c
index 4c1d4f0bfa78ee689fcc85a9815eba554b713ad5..85353fc9d11f478450c4ed631eb5ef2a8ae551ab 100644 (file)
@@ -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,7 +24,6 @@
 #include "bfd.h"
 #include "symfile.h"
 #include "objfiles.h"
-#include "buildsym.h"
 #include "gdbcmd.h"
 #include "gdbcore.h"
 #include "mach-o.h"
@@ -616,7 +615,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *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;
 
@@ -698,7 +697,7 @@ macho_symfile_read_all_oso (std::vector<oso_el> *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 +792,9 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
   bfd *abfd = objfile->obfd;
   long storage_needed;
   std::vector<oso_el> 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<asymbol *> 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 +814,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
        {
          long symcount;
 
-         gdb::def_vector<asymbol *> symbol_table (storage_needed
-                                                  / sizeof (asymbol *));
+         symbol_table.resize (storage_needed / sizeof (asymbol *));
 
           minimal_symbol_reader reader (objfile);
 
This page took 0.024495 seconds and 4 git commands to generate.