Split rank_one_type_parm_complex from rank_one_type
[deliverable/binutils-gdb.git] / gdb / dbxread.c
index 21a29273f26fb2fd238ce4ab3e2b94a3b88b214c..ad2edc3ff4bf11e03f8259ddcc5b0654fbf8b397 100644 (file)
@@ -536,9 +536,7 @@ dbx_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
     perror_with_name (objfile_name (objfile));
 
   /* Size the symbol table.  */
-  if (objfile->global_psymbols.capacity () == 0
-      && objfile->static_psymbols.capacity () == 0)
-    init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
+  init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
 
   symbol_size = DBX_SYMBOL_SIZE (objfile);
   symbol_table_offset = DBX_SYMTAB_OFFSET (objfile);
@@ -749,7 +747,8 @@ static char *stringtab_global;
 /* These variables are used to control fill_symbuf when the stabs
    symbols are not contiguous (as may be the case when a COFF file is
    linked using --split-by-reloc).  */
-static struct stab_section_list *symbuf_sections;
+static const std::vector<asection *> *symbuf_sections;
+static size_t sect_idx;
 static unsigned int symbuf_left;
 static unsigned int symbuf_read;
 
@@ -785,13 +784,13 @@ fill_symbuf (bfd *sym_bfd)
     {
       if (symbuf_left <= 0)
        {
-         file_ptr filepos = symbuf_sections->section->filepos;
+         file_ptr filepos = (*symbuf_sections)[sect_idx]->filepos;
 
          if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
            perror_with_name (bfd_get_filename (sym_bfd));
-         symbuf_left = bfd_section_size (sym_bfd, symbuf_sections->section);
+         symbuf_left = bfd_section_size (sym_bfd, (*symbuf_sections)[sect_idx]);
          symbol_table_offset = filepos - symbuf_read;
-         symbuf_sections = symbuf_sections->next;
+         ++sect_idx;
        }
 
       count = symbuf_left;
@@ -1476,7 +1475,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_STATIC,
                                   data_sect_index,
-                                  &objfile->static_psymbols,
+                                  psymbol_placement::STATIC,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
 
@@ -1486,7 +1485,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_STATIC,
                                   data_sect_index,
-                                  &objfile->global_psymbols,
+                                  psymbol_placement::GLOBAL,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
 
@@ -1503,14 +1502,14 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                {
                  add_psymbol_to_list (sym_name, sym_len, 1,
                                       STRUCT_DOMAIN, LOC_TYPEDEF, -1,
-                                      &objfile->static_psymbols,
+                                      psymbol_placement::STATIC,
                                       0, psymtab_language, objfile);
                  if (p[2] == 't')
                    {
                      /* Also a typedef with the same name.  */
                      add_psymbol_to_list (sym_name, sym_len, 1,
                                           VAR_DOMAIN, LOC_TYPEDEF, -1,
-                                          &objfile->static_psymbols,
+                                          psymbol_placement::STATIC,
                                           0, psymtab_language, objfile);
                      p += 1;
                    }
@@ -1522,7 +1521,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                {
                  add_psymbol_to_list (sym_name, sym_len, 1,
                                       VAR_DOMAIN, LOC_TYPEDEF, -1,
-                                      &objfile->static_psymbols,
+                                      psymbol_placement::STATIC,
                                       0, psymtab_language, objfile);
                }
            check_enum:
@@ -1583,7 +1582,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
                         enum constants in psymtabs, just in symtabs.  */
                      add_psymbol_to_list (p, q - p, 1,
                                           VAR_DOMAIN, LOC_CONST, -1,
-                                          &objfile->static_psymbols, 0,
+                                          psymbol_placement::STATIC, 0,
                                           psymtab_language, objfile);
                      /* Point past the name.  */
                      p = q;
@@ -1601,7 +1600,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              /* Constant, e.g. from "const" in Pascal.  */
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_CONST, -1,
-                                  &objfile->static_psymbols, 0,
+                                  psymbol_placement::STATIC, 0,
                                   psymtab_language, objfile);
              continue;
 
@@ -1657,7 +1656,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_BLOCK,
                                   SECT_OFF_TEXT (objfile),
-                                  &objfile->static_psymbols,
+                                  psymbol_placement::STATIC,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
 
@@ -1716,7 +1715,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
              add_psymbol_to_list (sym_name, sym_len, 1,
                                   VAR_DOMAIN, LOC_BLOCK,
                                   SECT_OFF_TEXT (objfile),
-                                  &objfile->global_psymbols,
+                                  psymbol_placement::GLOBAL,
                                   nlist.n_value, psymtab_language, objfile);
              continue;
 
@@ -2013,7 +2012,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
          address, set it to our starting address.  Take care to not set our
          own ending address to our starting address.  */
 
-      for (partial_symtab *p1 : objfile_psymtabs (objfile))
+      for (partial_symtab *p1 : objfile->psymtabs ())
        if (!p1->text_high_valid && p1->text_low_valid && p1 != pst)
          p1->set_text_high (pst->raw_text_low ());
     }
@@ -2025,9 +2024,8 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
   pst->number_of_dependencies = number_dependencies;
   if (number_dependencies)
     {
-      pst->dependencies = XOBNEWVEC (&objfile->objfile_obstack,
-                                    struct partial_symtab *,
-                                    number_dependencies);
+      pst->dependencies
+       = objfile->partial_symtabs->allocate_dependencies (number_dependencies);
       memcpy (pst->dependencies, dependency_list,
              number_dependencies * sizeof (struct partial_symtab *));
     }
@@ -2047,7 +2045,7 @@ dbx_end_psymtab (struct objfile *objfile, struct partial_symtab *pst,
       /* We could save slight bits of space by only making one of these,
          shared by the entire set of include files.  FIXME-someday.  */
       subpst->dependencies =
-       XOBNEW (&objfile->objfile_obstack, struct partial_symtab *);
+       objfile->partial_symtabs->allocate_dependencies (1);
       subpst->dependencies[0] = pst;
       subpst->number_of_dependencies = 1;
 
@@ -2945,7 +2943,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
 void
 coffstab_build_psymtabs (struct objfile *objfile,
                         CORE_ADDR textaddr, unsigned int textsize,
-                        struct stab_section_list *stabsects,
+                        const std::vector<asection *> &stabsects,
                         file_ptr stabstroffset, unsigned int stabstrsize)
 {
   int val;
@@ -2984,27 +2982,28 @@ coffstab_build_psymtabs (struct objfile *objfile,
   /* In a coff file, we've already installed the minimal symbols that came
      from the coff (non-stab) symbol table, so always act like an
      incremental load here.  */
-  if (stabsects->next == NULL)
+  scoped_restore save_symbuf_sections
+    = make_scoped_restore (&symbuf_sections);
+  if (stabsects.size () == 1)
     {
-      stabsize = bfd_section_size (sym_bfd, stabsects->section);
+      stabsize = bfd_section_size (sym_bfd, stabsects[0]);
       DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
-      DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
+      DBX_SYMTAB_OFFSET (objfile) = stabsects[0]->filepos;
     }
   else
     {
-      struct stab_section_list *stabsect;
-
       DBX_SYMCOUNT (objfile) = 0;
-      for (stabsect = stabsects; stabsect != NULL; stabsect = stabsect->next)
+      for (asection *section : stabsects)
        {
-         stabsize = bfd_section_size (sym_bfd, stabsect->section);
+         stabsize = bfd_section_size (sym_bfd, section);
          DBX_SYMCOUNT (objfile) += stabsize / DBX_SYMBOL_SIZE (objfile);
        }
 
-      DBX_SYMTAB_OFFSET (objfile) = stabsects->section->filepos;
+      DBX_SYMTAB_OFFSET (objfile) = stabsects[0]->filepos;
 
-      symbuf_sections = stabsects->next;
-      symbuf_left = bfd_section_size (sym_bfd, stabsects->section);
+      sect_idx = 1;
+      symbuf_sections = &stabsects;
+      symbuf_left = bfd_section_size (sym_bfd, stabsects[0]);
       symbuf_read = 0;
     }
 
This page took 0.028064 seconds and 4 git commands to generate.