Add myself as write after approval maintainer
[deliverable/binutils-gdb.git] / gdb / symtab.c
index 01ddb91f6eb524e71e368df3b12a851a93f0e6b3..d8d8e231f482842b1b1fe0eb30ad81b1501c9ecc 100644 (file)
@@ -74,21 +74,16 @@ static struct symbol *lookup_symbol_aux (const char *name,
                                         struct field_of_this_result *);
 
 static
-struct symbol *lookup_symbol_aux_local (const char *name,
-                                       const struct block *block,
-                                       const domain_enum domain,
-                                       enum language language);
+struct symbol *lookup_local_symbol (const char *name,
+                                   const struct block *block,
+                                   const domain_enum domain,
+                                   enum language language);
 
 static
-struct symbol *lookup_symbol_aux_symtabs (int block_index,
-                                         const char *name,
-                                         const domain_enum domain);
-
-static
-struct symbol *lookup_symbol_aux_quick (struct objfile *objfile,
-                                       int block_index,
-                                       const char *name,
-                                       const domain_enum domain);
+struct symbol *lookup_symbol_via_quick_fns (struct objfile *objfile,
+                                           int block_index,
+                                           const char *name,
+                                           const domain_enum domain);
 
 extern initialize_file_ftype _initialize_symtab;
 
@@ -178,20 +173,27 @@ search_domain_name (enum search_domain e)
     }
 }
 
-/* Set the primary field in SYMTAB.  */
+/* See symtab.h.  */
 
-void
-set_symtab_primary (struct symtab *symtab, int primary)
+struct symtab *
+compunit_primary_filetab (const struct compunit_symtab *cust)
 {
-  symtab->primary = primary;
+  gdb_assert (COMPUNIT_FILETABS (cust) != NULL);
 
-  if (symtab_create_debug && primary)
-    {
-      fprintf_unfiltered (gdb_stdlog,
-                         "Created primary symtab %s for %s.\n",
-                         host_address_to_string (symtab),
-                         symtab_to_filename_for_display (symtab));
-    }
+  /* The primary file symtab is the first one in the list.  */
+  return COMPUNIT_FILETABS (cust);
+}
+
+/* See symtab.h.  */
+
+enum language
+compunit_language (const struct compunit_symtab *cust)
+{
+  struct symtab *symtab = compunit_primary_filetab (cust);
+
+/* The language of the compunit symtab is the language of its primary
+   source file.  */
+  return SYMTAB_LANGUAGE (symtab);
 }
 
 /* See whether FILENAME matches SEARCH_NAME using the rule that we
@@ -242,8 +244,9 @@ compare_filenames_for_search (const char *filename, const char *search_name)
    are identical to the `map_symtabs_matching_filename' method of
    quick_symbol_functions.
 
-   FIRST and AFTER_LAST indicate the range of symtabs to search.
-   AFTER_LAST is one past the last symtab to search; NULL means to
+   FIRST and AFTER_LAST indicate the range of compunit symtabs to search.
+   Each symtab within the specified compunit symtab is also searched.
+   AFTER_LAST is one past the last compunit symtab to search; NULL means to
    search until the end of the list.  */
 
 int
@@ -252,48 +255,52 @@ iterate_over_some_symtabs (const char *name,
                           int (*callback) (struct symtab *symtab,
                                            void *data),
                           void *data,
-                          struct symtab *first,
-                          struct symtab *after_last)
+                          struct compunit_symtab *first,
+                          struct compunit_symtab *after_last)
 {
-  struct symtab *s = NULL;
+  struct compunit_symtab *cust;
+  struct symtab *s;
   const char* base_name = lbasename (name);
 
-  for (s = first; s != NULL && s != after_last; s = s->next)
+  for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
     {
-      if (compare_filenames_for_search (s->filename, name))
+      ALL_COMPUNIT_FILETABS (cust, s)
        {
-         if (callback (s, data))
-           return 1;
-         continue;
-       }
-
-      /* Before we invoke realpath, which can get expensive when many
-        files are involved, do a quick comparison of the basenames.  */
-      if (! basenames_may_differ
-         && FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
-       continue;
-
-      if (compare_filenames_for_search (symtab_to_fullname (s), name))
-       {
-         if (callback (s, data))
-           return 1;
-         continue;
-       }
+         if (compare_filenames_for_search (s->filename, name))
+           {
+             if (callback (s, data))
+               return 1;
+             continue;
+           }
 
-      /* If the user gave us an absolute path, try to find the file in
-        this symtab and use its absolute path.  */
-      if (real_path != NULL)
-       {
-         const char *fullname = symtab_to_fullname (s);
+         /* Before we invoke realpath, which can get expensive when many
+            files are involved, do a quick comparison of the basenames.  */
+         if (! basenames_may_differ
+             && FILENAME_CMP (base_name, lbasename (s->filename)) != 0)
+           continue;
 
-         gdb_assert (IS_ABSOLUTE_PATH (real_path));
-         gdb_assert (IS_ABSOLUTE_PATH (name));
-         if (FILENAME_CMP (real_path, fullname) == 0)
+         if (compare_filenames_for_search (symtab_to_fullname (s), name))
            {
              if (callback (s, data))
                return 1;
              continue;
            }
+
+         /* If the user gave us an absolute path, try to find the file in
+            this symtab and use its absolute path.  */
+         if (real_path != NULL)
+           {
+             const char *fullname = symtab_to_fullname (s);
+
+             gdb_assert (IS_ABSOLUTE_PATH (real_path));
+             gdb_assert (IS_ABSOLUTE_PATH (name));
+             if (FILENAME_CMP (real_path, fullname) == 0)
+               {
+                 if (callback (s, data))
+                   return 1;
+                 continue;
+               }
+           }
        }
     }
 
@@ -329,7 +336,7 @@ iterate_over_symtabs (const char *name,
   ALL_OBJFILES (objfile)
   {
     if (iterate_over_some_symtabs (name, real_path, callback, data,
-                                  objfile->symtabs, NULL))
+                                  objfile->compunit_symtabs, NULL))
       {
        do_cleanups (cleanups);
        return;
@@ -466,40 +473,15 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
   return (mangled_name);
 }
 
-/* Initialize the cplus_specific structure.  'cplus_specific' should
-   only be allocated for use with cplus symbols.  */
-
-static void
-symbol_init_cplus_specific (struct general_symbol_info *gsymbol,
-                           struct obstack *obstack)
-{
-  /* A language_specific structure should not have been previously
-     initialized.  */
-  gdb_assert (gsymbol->language_specific.cplus_specific == NULL);
-  gdb_assert (obstack != NULL);
-
-  gsymbol->language_specific.cplus_specific =
-    OBSTACK_ZALLOC (obstack, struct cplus_specific);
-}
-
 /* Set the demangled name of GSYMBOL to NAME.  NAME must be already
-   correctly allocated.  For C++ symbols a cplus_specific struct is
-   allocated so OBJFILE must not be NULL.  If this is a non C++ symbol
-   OBJFILE can be NULL.  */
+   correctly allocated.  */
 
 void
 symbol_set_demangled_name (struct general_symbol_info *gsymbol,
                            const char *name,
                            struct obstack *obstack)
 {
-  if (gsymbol->language == language_cplus)
-    {
-      if (gsymbol->language_specific.cplus_specific == NULL)
-       symbol_init_cplus_specific (gsymbol, obstack);
-
-      gsymbol->language_specific.cplus_specific->demangled_name = name;
-    }
-  else if (gsymbol->language == language_ada)
+  if (gsymbol->language == language_ada)
     {
       if (name == NULL)
        {
@@ -521,14 +503,7 @@ symbol_set_demangled_name (struct general_symbol_info *gsymbol,
 const char *
 symbol_get_demangled_name (const struct general_symbol_info *gsymbol)
 {
-  if (gsymbol->language == language_cplus)
-    {
-      if (gsymbol->language_specific.cplus_specific != NULL)
-       return gsymbol->language_specific.cplus_specific->demangled_name;
-      else
-       return NULL;
-    }
-  else if (gsymbol->language == language_ada)
+  if (gsymbol->language == language_ada)
     {
       if (!gsymbol->ada_mangled)
        return NULL;
@@ -548,7 +523,8 @@ symbol_set_language (struct general_symbol_info *gsymbol,
                     struct obstack *obstack)
 {
   gsymbol->language = language;
-  if (gsymbol->language == language_d
+  if (gsymbol->language == language_cplus
+      || gsymbol->language == language_d
       || gsymbol->language == language_go
       || gsymbol->language == language_java
       || gsymbol->language == language_objc
@@ -561,8 +537,6 @@ symbol_set_language (struct general_symbol_info *gsymbol,
       gdb_assert (gsymbol->ada_mangled == 0);
       gsymbol->language_specific.obstack = obstack;
     }
-  else if (gsymbol->language == language_cplus)
-    gsymbol->language_specific.cplus_specific = NULL;
   else
     {
       memset (&gsymbol->language_specific, 0,
@@ -1050,8 +1024,10 @@ matching_obj_sections (struct obj_section *obj_first,
   return 0;
 }
 
-struct symtab *
-find_pc_sect_symtab_via_partial (CORE_ADDR pc, struct obj_section *section)
+/* See symtab.h.  */
+
+void
+expand_symtab_containing_pc (CORE_ADDR pc, struct obj_section *section)
 {
   struct objfile *objfile;
   struct bound_minimal_symbol msymbol;
@@ -1066,20 +1042,18 @@ find_pc_sect_symtab_via_partial (CORE_ADDR pc, struct obj_section *section)
          || MSYMBOL_TYPE (msymbol.minsym) == mst_abs
          || MSYMBOL_TYPE (msymbol.minsym) == mst_file_data
          || MSYMBOL_TYPE (msymbol.minsym) == mst_file_bss))
-    return NULL;
+    return;
 
   ALL_OBJFILES (objfile)
   {
-    struct symtab *result = NULL;
+    struct compunit_symtab *cust = NULL;
 
     if (objfile->sf)
-      result = objfile->sf->qf->find_pc_sect_symtab (objfile, msymbol,
-                                                    pc, section, 0);
-    if (result)
-      return result;
+      cust = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
+                                                           pc, section, 0);
+    if (cust)
+      return;
   }
-
-  return NULL;
 }
 \f
 /* Debug symbols usually don't have section information.  We need to dig that
@@ -1179,7 +1153,7 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
   gdb_assert (objfile || SYMBOL_SYMTAB (sym));
 
   if (objfile == NULL)
-    objfile = SYMBOL_SYMTAB (sym)->objfile;
+    objfile = SYMBOL_OBJFILE (sym);
 
   if (SYMBOL_OBJ_SECTION (objfile, sym))
     return sym;
@@ -1344,7 +1318,7 @@ lookup_language_this (const struct language_defn *lang,
     {
       struct symbol *sym;
 
-      sym = lookup_block_symbol (block, lang->la_name_of_this, VAR_DOMAIN);
+      sym = block_lookup_symbol (block, lang->la_name_of_this, VAR_DOMAIN);
       if (sym != NULL)
        {
          block_found = block;
@@ -1424,7 +1398,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
   /* Search specified block and its superiors.  Don't search
      STATIC_BLOCK or GLOBAL_BLOCK.  */
 
-  sym = lookup_symbol_aux_local (name, block, domain, language);
+  sym = lookup_local_symbol (name, block, domain, language);
   if (sym != NULL)
     return sym;
 
@@ -1471,38 +1445,16 @@ lookup_symbol_aux (const char *name, const struct block *block,
   /* Now search all static file-level symbols.  Not strictly correct,
      but more useful than an error.  */
 
-  return lookup_static_symbol_aux (name, domain);
-}
-
-/* See symtab.h.  */
-
-struct symbol *
-lookup_static_symbol_aux (const char *name, const domain_enum domain)
-{
-  struct objfile *objfile;
-  struct symbol *sym;
-
-  sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain);
-  if (sym != NULL)
-    return sym;
-
-  ALL_OBJFILES (objfile)
-  {
-    sym = lookup_symbol_aux_quick (objfile, STATIC_BLOCK, name, domain);
-    if (sym != NULL)
-      return sym;
-  }
-
-  return NULL;
+  return lookup_static_symbol (name, domain);
 }
 
 /* Check to see if the symbol is defined in BLOCK or its superiors.
    Don't search STATIC_BLOCK or GLOBAL_BLOCK.  */
 
 static struct symbol *
-lookup_symbol_aux_local (const char *name, const struct block *block,
-                         const domain_enum domain,
-                         enum language language)
+lookup_local_symbol (const char *name, const struct block *block,
+                    const domain_enum domain,
+                    enum language language)
 {
   struct symbol *sym;
   const struct block *static_block = block_static_block (block);
@@ -1515,7 +1467,7 @@ lookup_symbol_aux_local (const char *name, const struct block *block,
 
   while (block != static_block)
     {
-      sym = lookup_symbol_aux_block (name, block, domain);
+      sym = lookup_symbol_in_block (name, block, domain);
       if (sym != NULL)
        return sym;
 
@@ -1543,15 +1495,16 @@ struct objfile *
 lookup_objfile_from_block (const struct block *block)
 {
   struct objfile *obj;
-  struct symtab *s;
+  struct compunit_symtab *cust;
 
   if (block == NULL)
     return NULL;
 
   block = block_global_block (block);
-  /* Go through SYMTABS.  */
-  ALL_SYMTABS (obj, s)
-    if (block == BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK))
+  /* Look through all blockvectors.  */
+  ALL_COMPUNITS (obj, cust)
+    if (block == BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
+                                   GLOBAL_BLOCK))
       {
        if (obj->separate_debug_objfile_backlink)
          obj = obj->separate_debug_objfile_backlink;
@@ -1565,12 +1518,12 @@ lookup_objfile_from_block (const struct block *block)
 /* See symtab.h.  */
 
 struct symbol *
-lookup_symbol_aux_block (const char *name, const struct block *block,
-                        const domain_enum domain)
+lookup_symbol_in_block (const char *name, const struct block *block,
+                       const domain_enum domain)
 {
   struct symbol *sym;
 
-  sym = lookup_block_symbol (block, name, domain);
+  sym = block_lookup_symbol (block, name, domain);
   if (sym)
     {
       block_found = block;
@@ -1588,21 +1541,23 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
                                   const domain_enum domain)
 {
   const struct objfile *objfile;
-  struct symbol *sym;
-  const struct blockvector *bv;
-  const struct block *block;
-  struct symtab *s;
 
   for (objfile = main_objfile;
        objfile;
        objfile = objfile_separate_debug_iterate (main_objfile, objfile))
     {
+      struct compunit_symtab *cust;
+      struct symbol *sym;
+
       /* Go through symtabs.  */
-      ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+      ALL_OBJFILE_COMPUNITS (objfile, cust)
        {
-         bv = BLOCKVECTOR (s);
+         const struct blockvector *bv;
+         const struct block *block;
+
+         bv = COMPUNIT_BLOCKVECTOR (cust);
          block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         sym = lookup_block_symbol (block, name, domain);
+         sym = block_lookup_symbol (block, name, domain);
          if (sym)
            {
              block_found = block;
@@ -1610,8 +1565,8 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
            }
        }
 
-      sym = lookup_symbol_aux_quick ((struct objfile *) objfile, GLOBAL_BLOCK,
-                                    name, domain);
+      sym = lookup_symbol_via_quick_fns ((struct objfile *) objfile,
+                                        GLOBAL_BLOCK, name, domain);
       if (sym)
        return sym;
     }
@@ -1625,19 +1580,22 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile,
    static symbols.  */
 
 static struct symbol *
-lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
-                          const char *name, const domain_enum domain)
+lookup_symbol_in_objfile_symtabs (struct objfile *objfile, int block_index,
+                                 const char *name, const domain_enum domain)
 {
-  struct symbol *sym = NULL;
-  const struct blockvector *bv;
-  const struct block *block;
-  struct symtab *s;
+  struct compunit_symtab *cust;
+
+  gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
 
-  ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+  ALL_OBJFILE_COMPUNITS (objfile, cust)
     {
-      bv = BLOCKVECTOR (s);
+      const struct blockvector *bv;
+      const struct block *block;
+      struct symbol *sym;
+
+      bv = COMPUNIT_BLOCKVECTOR (cust);
       block = BLOCKVECTOR_BLOCK (bv, block_index);
-      sym = lookup_block_symbol (block, name, domain);
+      sym = block_lookup_symbol_primary (block, name, domain);
       if (sym)
        {
          block_found = block;
@@ -1648,29 +1606,14 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
   return NULL;
 }
 
-/* Same as lookup_symbol_aux_objfile, except that it searches all
-   objfiles.  Return the first match found.  */
-
-static struct symbol *
-lookup_symbol_aux_symtabs (int block_index, const char *name,
-                          const domain_enum domain)
-{
-  struct symbol *sym;
-  struct objfile *objfile;
-
-  ALL_OBJFILES (objfile)
-  {
-    sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain);
-    if (sym)
-      return sym;
-  }
-
-  return NULL;
-}
-
-/* Wrapper around lookup_symbol_aux_objfile for search_symbols.
+/* Wrapper around lookup_symbol_in_objfile_symtabs for search_symbols.
    Look up LINKAGE_NAME in DOMAIN in the global and static blocks of OBJFILE
-   and all related objfiles.  */
+   and all associated separate debug objfiles.
+
+   Normally we only look in OBJFILE, and not any separate debug objfiles
+   because the outer loop will cause them to be searched too.  This case is
+   different.  Here we're called from search_symbols where it will only
+   call us for the the objfile that contains a matching minsym.  */
 
 static struct symbol *
 lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
@@ -1694,11 +1637,11 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
     {
       struct symbol *sym;
 
-      sym = lookup_symbol_aux_objfile (cur_objfile, GLOBAL_BLOCK,
-                                      modified_name, domain);
+      sym = lookup_symbol_in_objfile_symtabs (cur_objfile, GLOBAL_BLOCK,
+                                             modified_name, domain);
       if (sym == NULL)
-       sym = lookup_symbol_aux_objfile (cur_objfile, STATIC_BLOCK,
-                                        modified_name, domain);
+       sym = lookup_symbol_in_objfile_symtabs (cur_objfile, STATIC_BLOCK,
+                                               modified_name, domain);
       if (sym != NULL)
        {
          do_cleanups (cleanup);
@@ -1715,39 +1658,41 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
 
 static void ATTRIBUTE_NORETURN
 error_in_psymtab_expansion (int block_index, const char *name,
-                           struct symtab *symtab)
+                           struct compunit_symtab *cust)
 {
   error (_("\
 Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n  \
 (if a template, try specifying an instantiation: %s<type>)."),
         block_index == GLOBAL_BLOCK ? "global" : "static",
-        name, symtab_to_filename_for_display (symtab), name, name);
+        name,
+        symtab_to_filename_for_display (compunit_primary_filetab (cust)),
+        name, name);
 }
 
-/* A helper function for lookup_symbol_aux that interfaces with the
-   "quick" symbol table functions.  */
+/* A helper function for various lookup routines that interfaces with
+   the "quick" symbol table functions.  */
 
 static struct symbol *
-lookup_symbol_aux_quick (struct objfile *objfile, int block_index,
-                        const char *name, const domain_enum domain)
+lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
+                            const char *name, const domain_enum domain)
 {
-  struct symtab *symtab;
+  struct compunit_symtab *cust;
   const struct blockvector *bv;
   const struct block *block;
   struct symbol *sym;
 
   if (!objfile->sf)
     return NULL;
-  symtab = objfile->sf->qf->lookup_symbol (objfile, block_index, name, domain);
-  if (!symtab)
+  cust = objfile->sf->qf->lookup_symbol (objfile, block_index, name, domain);
+  if (cust == NULL)
     return NULL;
 
-  bv = BLOCKVECTOR (symtab);
+  bv = COMPUNIT_BLOCKVECTOR (cust);
   block = BLOCKVECTOR_BLOCK (bv, block_index);
-  sym = lookup_block_symbol (block, name, domain);
+  sym = block_lookup_symbol (block, name, domain);
   if (!sym)
-    error_in_psymtab_expansion (block_index, name, symtab);
+    error_in_psymtab_expansion (block_index, name, cust);
   block_found = block;
   return fixup_symbol_section (sym, objfile);
 }
@@ -1771,7 +1716,7 @@ basic_lookup_symbol_nonlocal (const char *name,
      not it would be appropriate to search the current global block
      here as well.  (That's what this code used to do before the
      is_a_field_of_this check was moved up.)  On the one hand, it's
-     redundant with the lookup_symbol_aux_symtabs search that happens
+     redundant with the lookup in all objfiles search that happens
      next.  On the other hand, if decode_line_1 is passed an argument
      like filename:var, then the user presumably wants 'var' to be
      searched for in filename.  On the third hand, there shouldn't be
@@ -1789,28 +1734,72 @@ basic_lookup_symbol_nonlocal (const char *name,
      than that one, so I don't think we should worry about that for
      now.  */
 
-  sym = lookup_symbol_static (name, block, domain);
+  /* NOTE: dje/2014-10-26: The lookup in all objfiles search could skip
+     the current objfile.  Searching the current objfile first is useful
+     for both matching user expectations as well as performance.  */
+
+  sym = lookup_symbol_in_static_block (name, block, domain);
   if (sym != NULL)
     return sym;
 
-  return lookup_symbol_global (name, block, domain);
+  return lookup_global_symbol (name, block, domain);
 }
 
 /* See symtab.h.  */
 
 struct symbol *
-lookup_symbol_static (const char *name,
-                     const struct block *block,
-                     const domain_enum domain)
+lookup_symbol_in_static_block (const char *name,
+                              const struct block *block,
+                              const domain_enum domain)
 {
   const struct block *static_block = block_static_block (block);
 
   if (static_block != NULL)
-    return lookup_symbol_aux_block (name, static_block, domain);
+    return lookup_symbol_in_block (name, static_block, domain);
   else
     return NULL;
 }
 
+/* Perform the standard symbol lookup of NAME in OBJFILE:
+   1) First search expanded symtabs, and if not found
+   2) Search the "quick" symtabs (partial or .gdb_index).
+   BLOCK_INDEX is one of GLOBAL_BLOCK or STATIC_BLOCK.  */
+
+static struct symbol *
+lookup_symbol_in_objfile (struct objfile *objfile, int block_index,
+                         const char *name, const domain_enum domain)
+{
+  struct symbol *result;
+
+  result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
+                                            name, domain);
+  if (result == NULL)
+    {
+      result = lookup_symbol_via_quick_fns (objfile, block_index,
+                                           name, domain);
+    }
+
+  return result;
+}
+
+/* See symtab.h.  */
+
+struct symbol *
+lookup_static_symbol (const char *name, const domain_enum domain)
+{
+  struct objfile *objfile;
+  struct symbol *result;
+
+  ALL_OBJFILES (objfile)
+    {
+      result = lookup_symbol_in_objfile (objfile, STATIC_BLOCK, name, domain);
+      if (result != NULL)
+       return result;
+    }
+
+  return NULL;
+}
+
 /* Private data to be used with lookup_symbol_global_iterator_cb.  */
 
 struct global_sym_lookup_data
@@ -1840,11 +1829,8 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
 
   gdb_assert (data->result == NULL);
 
-  data->result = lookup_symbol_aux_objfile (objfile, GLOBAL_BLOCK,
-                                           data->name, data->domain);
-  if (data->result == NULL)
-    data->result = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK,
-                                           data->name, data->domain);
+  data->result = lookup_symbol_in_objfile (objfile, GLOBAL_BLOCK,
+                                          data->name, data->domain);
 
   /* If we found a match, tell the iterator to stop.  Otherwise,
      keep going.  */
@@ -1854,7 +1840,7 @@ lookup_symbol_global_iterator_cb (struct objfile *objfile,
 /* See symtab.h.  */
 
 struct symbol *
-lookup_symbol_global (const char *name,
+lookup_global_symbol (const char *name,
                      const struct block *block,
                      const domain_enum domain)
 {
@@ -1915,23 +1901,23 @@ static struct type *
 basic_lookup_transparent_type_quick (struct objfile *objfile, int block_index,
                                     const char *name)
 {
-  struct symtab *symtab;
+  struct compunit_symtab *cust;
   const struct blockvector *bv;
   struct block *block;
   struct symbol *sym;
 
   if (!objfile->sf)
     return NULL;
-  symtab = objfile->sf->qf->lookup_symbol (objfile, block_index, name,
-                                          STRUCT_DOMAIN);
-  if (!symtab)
+  cust = objfile->sf->qf->lookup_symbol (objfile, block_index, name,
+                                        STRUCT_DOMAIN);
+  if (cust == NULL)
     return NULL;
 
-  bv = BLOCKVECTOR (symtab);
+  bv = COMPUNIT_BLOCKVECTOR (cust);
   block = BLOCKVECTOR_BLOCK (bv, block_index);
-  sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
+  sym = block_lookup_symbol (block, name, STRUCT_DOMAIN);
   if (!sym)
-    error_in_psymtab_expansion (block_index, name, symtab);
+    error_in_psymtab_expansion (block_index, name, cust);
 
   if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
     return SYMBOL_TYPE (sym);
@@ -1949,7 +1935,7 @@ struct type *
 basic_lookup_transparent_type (const char *name)
 {
   struct symbol *sym;
-  struct symtab *s = NULL;
+  struct compunit_symtab *cust;
   const struct blockvector *bv;
   struct objfile *objfile;
   struct block *block;
@@ -1962,11 +1948,11 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_OBJFILES (objfile)
   {
-    ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+    ALL_OBJFILE_COMPUNITS (objfile, cust)
       {
-       bv = BLOCKVECTOR (s);
+       bv = COMPUNIT_BLOCKVECTOR (cust);
        block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-       sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
+       sym = block_lookup_symbol (block, name, STRUCT_DOMAIN);
        if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
          {
            return SYMBOL_TYPE (sym);
@@ -1990,11 +1976,11 @@ basic_lookup_transparent_type (const char *name)
 
   ALL_OBJFILES (objfile)
   {
-    ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+    ALL_OBJFILE_COMPUNITS (objfile, cust)
       {
-       bv = BLOCKVECTOR (s);
+       bv = COMPUNIT_BLOCKVECTOR (cust);
        block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-       sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);
+       sym = block_lookup_symbol (block, name, STRUCT_DOMAIN);
        if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
          {
            return SYMBOL_TYPE (sym);
@@ -2012,64 +1998,6 @@ basic_lookup_transparent_type (const char *name)
   return (struct type *) 0;
 }
 
-/* See symtab.h.
-
-   Note that if NAME is the demangled form of a C++ symbol, we will fail
-   to find a match during the binary search of the non-encoded names, but
-   for now we don't worry about the slight inefficiency of looking for
-   a match we'll never find, since it will go pretty quick.  Once the
-   binary search terminates, we drop through and do a straight linear
-   search on the symbols.  Each symbol which is marked as being a ObjC/C++
-   symbol (language_cplus or language_objc set) has both the encoded and
-   non-encoded names tested for a match.  */
-
-struct symbol *
-lookup_block_symbol (const struct block *block, const char *name,
-                    const domain_enum domain)
-{
-  struct block_iterator iter;
-  struct symbol *sym;
-
-  if (!BLOCK_FUNCTION (block))
-    {
-      for (sym = block_iter_name_first (block, name, &iter);
-          sym != NULL;
-          sym = block_iter_name_next (name, &iter))
-       {
-         if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
-                                    SYMBOL_DOMAIN (sym), domain))
-           return sym;
-       }
-      return NULL;
-    }
-  else
-    {
-      /* Note that parameter symbols do not always show up last in the
-        list; this loop makes sure to take anything else other than
-        parameter symbols first; it only uses parameter symbols as a
-        last resort.  Note that this only takes up extra computation
-        time on a match.  */
-
-      struct symbol *sym_found = NULL;
-
-      for (sym = block_iter_name_first (block, name, &iter);
-          sym != NULL;
-          sym = block_iter_name_next (name, &iter))
-       {
-         if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
-                                    SYMBOL_DOMAIN (sym), domain))
-           {
-             sym_found = sym;
-             if (!SYMBOL_IS_ARGUMENT (sym))
-               {
-                 break;
-               }
-           }
-       }
-      return (sym_found);      /* Will be NULL if not found.  */
-    }
-}
-
 /* Iterate over the symbols named NAME, matching DOMAIN, in BLOCK.
    
    For each symbol that matches, CALLBACK is called.  The symbol and
@@ -2087,9 +2015,7 @@ iterate_over_symbols (const struct block *block, const char *name,
   struct block_iterator iter;
   struct symbol *sym;
 
-  for (sym = block_iter_name_first (block, name, &iter);
-       sym != NULL;
-       sym = block_iter_name_next (name, &iter))
+  ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
     {
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
                                 SYMBOL_DOMAIN (sym), domain))
@@ -2100,16 +2026,14 @@ iterate_over_symbols (const struct block *block, const char *name,
     }
 }
 
-/* Find the symtab associated with PC and SECTION.  Look through the
-   psymtabs and read in another symtab if necessary.  */
+/* Find the compunit symtab associated with PC and SECTION.
+   This will read in debug info as necessary.  */
 
-struct symtab *
-find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
+struct compunit_symtab *
+find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
 {
-  struct block *b;
-  const struct blockvector *bv;
-  struct symtab *s = NULL;
-  struct symtab *best_s = NULL;
+  struct compunit_symtab *cust;
+  struct compunit_symtab *best_cust = NULL;
   struct objfile *objfile;
   CORE_ADDR distance = 0;
   struct bound_minimal_symbol msymbol;
@@ -2143,9 +2067,12 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
      It also happens for objfiles that have their functions reordered.
      For these, the symtab we are looking for is not necessarily read in.  */
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
-    bv = BLOCKVECTOR (s);
+    struct block *b;
+    const struct blockvector *bv;
+
+    bv = COMPUNIT_BLOCKVECTOR (cust);
     b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
 
     if (BLOCK_START (b) <= pc
@@ -2161,14 +2088,14 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
           can't be found.  */
        if ((objfile->flags & OBJF_REORDERED) && objfile->sf)
          {
-           struct symtab *result;
+           struct compunit_symtab *result;
 
            result
-             = objfile->sf->qf->find_pc_sect_symtab (objfile,
-                                                     msymbol,
-                                                     pc, section,
-                                                     0);
-           if (result)
+             = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile,
+                                                              msymbol,
+                                                              pc, section,
+                                                              0);
+           if (result != NULL)
              return result;
          }
        if (section != 0)
@@ -2188,39 +2115,40 @@ find_pc_sect_symtab (CORE_ADDR pc, struct obj_section *section)
                                   section.  */
          }
        distance = BLOCK_END (b) - BLOCK_START (b);
-       best_s = s;
+       best_cust = cust;
       }
   }
 
-  if (best_s != NULL)
-    return (best_s);
+  if (best_cust != NULL)
+    return best_cust;
 
   /* Not found in symtabs, search the "quick" symtabs (e.g. psymtabs).  */
 
   ALL_OBJFILES (objfile)
   {
-    struct symtab *result;
+    struct compunit_symtab *result;
 
     if (!objfile->sf)
       continue;
-    result = objfile->sf->qf->find_pc_sect_symtab (objfile,
-                                                  msymbol,
-                                                  pc, section,
-                                                  1);
-    if (result)
+    result = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile,
+                                                           msymbol,
+                                                           pc, section,
+                                                           1);
+    if (result != NULL)
       return result;
   }
 
   return NULL;
 }
 
-/* Find the symtab associated with PC.  Look through the psymtabs and read
-   in another symtab if necessary.  Backward compatibility, no section.  */
+/* Find the compunit symtab associated with PC.
+   This will read in debug info as necessary.
+   Backward compatibility, no section.  */
 
-struct symtab *
-find_pc_symtab (CORE_ADDR pc)
+struct compunit_symtab *
+find_pc_compunit_symtab (CORE_ADDR pc)
 {
-  return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
+  return find_pc_sect_compunit_symtab (pc, find_pc_mapped_section (pc));
 }
 \f
 
@@ -2244,7 +2172,8 @@ find_pc_symtab (CORE_ADDR pc)
 struct symtab_and_line
 find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
 {
-  struct symtab *s;
+  struct compunit_symtab *cust;
+  struct symtab *iter_s;
   struct linetable *l;
   int len;
   int i;
@@ -2252,7 +2181,6 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
   struct symtab_and_line val;
   const struct blockvector *bv;
   struct bound_minimal_symbol msymbol;
-  struct objfile *objfile;
 
   /* Info on best line seen so far, and where it starts, and its file.  */
 
@@ -2370,8 +2298,8 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
       }
 
 
-  s = find_pc_sect_symtab (pc, section);
-  if (!s)
+  cust = find_pc_sect_compunit_symtab (pc, section);
+  if (cust == NULL)
     {
       /* If no symbol information, return previous pc.  */
       if (notcurrent)
@@ -2380,20 +2308,16 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
       return val;
     }
 
-  bv = BLOCKVECTOR (s);
-  objfile = s->objfile;
+  bv = COMPUNIT_BLOCKVECTOR (cust);
 
   /* Look at all the symtabs that share this blockvector.
      They all have the same apriori range, that we found was right;
      but they have different line tables.  */
 
-  ALL_OBJFILE_SYMTABS (objfile, s)
+  ALL_COMPUNIT_FILETABS (cust, iter_s)
     {
-      if (BLOCKVECTOR (s) != bv)
-       continue;
-
       /* Find the best line in this symtab.  */
-      l = LINETABLE (s);
+      l = SYMTAB_LINETABLE (iter_s);
       if (!l)
        continue;
       len = l->nitems;
@@ -2437,7 +2361,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
       if (prev && prev->line && (!best || prev->pc > best->pc))
        {
          best = prev;
-         best_symtab = s;
+         best_symtab = iter_s;
 
          /* Discard BEST_END if it's before the PC of the current BEST.  */
          if (best_end <= best->pc)
@@ -2495,6 +2419,19 @@ find_pc_line (CORE_ADDR pc, int notcurrent)
     pc = overlay_mapped_address (pc, section);
   return find_pc_sect_line (pc, section, notcurrent);
 }
+
+/* See symtab.h.  */
+
+struct symtab *
+find_pc_line_symtab (CORE_ADDR pc)
+{
+  struct symtab_and_line sal;
+
+  /* This always passes zero for NOTCURRENT to find_pc_line.
+     There are currently no callers that ever pass non-zero.  */
+  sal = find_pc_line (pc, 0);
+  return sal.symtab;
+}
 \f
 /* Find line number LINE in any symtab whose name is the same as
    SYMTAB.
@@ -2520,7 +2457,7 @@ find_line_symtab (struct symtab *symtab, int line,
   struct symtab *best_symtab;
 
   /* First try looking it up in the given symtab.  */
-  best_linetable = LINETABLE (symtab);
+  best_linetable = SYMTAB_LINETABLE (symtab);
   best_symtab = symtab;
   best_index = find_line_common (best_linetable, line, &exact, 0);
   if (best_index < 0 || !exact)
@@ -2538,6 +2475,7 @@ find_line_symtab (struct symtab *symtab, int line,
       int best;
 
       struct objfile *objfile;
+      struct compunit_symtab *cu;
       struct symtab *s;
 
       if (best_index >= 0)
@@ -2552,7 +2490,7 @@ find_line_symtab (struct symtab *symtab, int line,
                                                   symtab_to_fullname (symtab));
       }
 
-      ALL_SYMTABS (objfile, s)
+      ALL_FILETABS (objfile, cu, s)
       {
        struct linetable *l;
        int ind;
@@ -2562,7 +2500,7 @@ find_line_symtab (struct symtab *symtab, int line,
        if (FILENAME_CMP (symtab_to_fullname (symtab),
                          symtab_to_fullname (s)) != 0)
          continue;     
-       l = LINETABLE (s);
+       l = SYMTAB_LINETABLE (s);
        ind = find_line_common (l, line, &exact, 0);
        if (ind >= 0)
          {
@@ -2612,13 +2550,14 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
       int was_exact;
       int idx;
 
-      idx = find_line_common (LINETABLE (symtab), line, &was_exact, start);
+      idx = find_line_common (SYMTAB_LINETABLE (symtab), line, &was_exact,
+                             start);
       if (idx < 0)
        break;
 
       if (!was_exact)
        {
-         struct linetable_entry *item = &LINETABLE (symtab)->item[idx];
+         struct linetable_entry *item = &SYMTAB_LINETABLE (symtab)->item[idx];
 
          if (*best_item == NULL || item->line < (*best_item)->line)
            *best_item = item;
@@ -2626,7 +2565,8 @@ find_pcs_for_symtab_line (struct symtab *symtab, int line,
          break;
        }
 
-      VEC_safe_push (CORE_ADDR, result, LINETABLE (symtab)->item[idx].pc);
+      VEC_safe_push (CORE_ADDR, result,
+                    SYMTAB_LINETABLE (symtab)->item[idx].pc);
       start = idx + 1;
     }
 
@@ -2651,7 +2591,7 @@ find_line_pc (struct symtab *symtab, int line, CORE_ADDR *pc)
   symtab = find_line_symtab (symtab, line, &ind, NULL);
   if (symtab != NULL)
     {
-      l = LINETABLE (symtab);
+      l = SYMTAB_LINETABLE (symtab);
       *pc = l->item[ind].pc;
       return 1;
     }
@@ -2805,7 +2745,7 @@ skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
   int i;
 
   /* Give up if this symbol has no lineinfo table.  */
-  l = LINETABLE (symtab);
+  l = SYMTAB_LINETABLE (symtab);
   if (l == NULL)
     return func_addr;
 
@@ -2866,7 +2806,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
       pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
       section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
       name = SYMBOL_LINKAGE_NAME (sym);
-      objfile = SYMBOL_SYMTAB (sym)->objfile;
+      objfile = SYMBOL_OBJFILE (sym);
     }
   else
     {
@@ -2898,7 +2838,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
   /* Be conservative - allow direct PC (without skipping prologue) only if we
      have proven the CU (Compilation Unit) supports it.  sal->SYMTAB does not
      have to be set by the caller so we use SYM instead.  */
-  if (sym && SYMBOL_SYMTAB (sym)->locations_valid)
+  if (sym && COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (SYMBOL_SYMTAB (sym))))
     force_skip = 0;
 
   saved_pc = pc;
@@ -3007,79 +2947,6 @@ skip_prologue_sal (struct symtab_and_line *sal)
     }
 }
 
-/* Determine if PC is in the prologue of a function.  The prologue is the area
-   between the first instruction of a function, and the first executable line.
-   Returns 1 if PC *might* be in prologue, 0 if definately *not* in prologue.
-
-   If non-zero, func_start is where we think the prologue starts, possibly
-   by previous examination of symbol table information.  */
-
-int
-in_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR func_start)
-{
-  struct symtab_and_line sal;
-  CORE_ADDR func_addr, func_end;
-
-  /* We have several sources of information we can consult to figure
-     this out.
-     - Compilers usually emit line number info that marks the prologue
-       as its own "source line".  So the ending address of that "line"
-       is the end of the prologue.  If available, this is the most
-       reliable method.
-     - The minimal symbols and partial symbols, which can usually tell
-       us the starting and ending addresses of a function.
-     - If we know the function's start address, we can call the
-       architecture-defined gdbarch_skip_prologue function to analyze the
-       instruction stream and guess where the prologue ends.
-     - Our `func_start' argument; if non-zero, this is the caller's
-       best guess as to the function's entry point.  At the time of
-       this writing, handle_inferior_event doesn't get this right, so
-       it should be our last resort.  */
-
-  /* Consult the partial symbol table, to find which function
-     the PC is in.  */
-  if (! find_pc_partial_function (pc, NULL, &func_addr, &func_end))
-    {
-      CORE_ADDR prologue_end;
-
-      /* We don't even have minsym information, so fall back to using
-         func_start, if given.  */
-      if (! func_start)
-       return 1;               /* We *might* be in a prologue.  */
-
-      prologue_end = gdbarch_skip_prologue (gdbarch, func_start);
-
-      return func_start <= pc && pc < prologue_end;
-    }
-
-  /* If we have line number information for the function, that's
-     usually pretty reliable.  */
-  sal = find_pc_line (func_addr, 0);
-
-  /* Now sal describes the source line at the function's entry point,
-     which (by convention) is the prologue.  The end of that "line",
-     sal.end, is the end of the prologue.
-
-     Note that, for functions whose source code is all on a single
-     line, the line number information doesn't always end up this way.
-     So we must verify that our purported end-of-prologue address is
-     *within* the function, not at its start or end.  */
-  if (sal.line == 0
-      || sal.end <= func_addr
-      || func_end <= sal.end)
-    {
-      /* We don't have any good line number info, so use the minsym
-        information, together with the architecture-specific prologue
-        scanning code.  */
-      CORE_ADDR prologue_end = gdbarch_skip_prologue (gdbarch, func_addr);
-
-      return func_addr <= pc && pc < prologue_end;
-    }
-
-  /* We have line number info, and it looks good.  */
-  return func_addr <= pc && pc < sal.end;
-}
-
 /* Given PC at the function's start address, attempt to find the
    prologue end using SAL information.  Return zero if the skip fails.
 
@@ -3119,7 +2986,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
         do this.  */
       if (prologue_sal.symtab->language != language_asm)
        {
-         struct linetable *linetable = LINETABLE (prologue_sal.symtab);
+         struct linetable *linetable = SYMTAB_LINETABLE (prologue_sal.symtab);
          int idx = 0;
 
          /* Skip any earlier lines, and any end-of-sequence marker
@@ -3458,6 +3325,7 @@ output_partial_symbol_filename (const char *filename, const char *fullname,
 static void
 sources_info (char *ignore, int from_tty)
 {
+  struct compunit_symtab *cu;
   struct symtab *s;
   struct objfile *objfile;
   struct output_source_filename_data data;
@@ -3475,7 +3343,7 @@ sources_info (char *ignore, int from_tty)
   printf_filtered ("Source files for which symbols have been read in:\n\n");
 
   data.first = 1;
-  ALL_SYMTABS (objfile, s)
+  ALL_FILETABS (objfile, cu, s)
   {
     const char *fullname = symtab_to_fullname (s);
 
@@ -3673,7 +3541,7 @@ search_symbols (const char *regexp, enum search_domain kind,
                int nfiles, const char *files[],
                struct symbol_search **matches)
 {
-  struct symtab *s;
+  struct compunit_symtab *cust;
   const struct blockvector *bv;
   struct block *b;
   int i = 0;
@@ -3813,10 +3681,10 @@ search_symbols (const char *regexp, enum search_domain kind,
              {
                /* Note: An important side-effect of these lookup functions
                   is to expand the symbol table if msymbol is found, for the
-                  benefit of the next loop on ALL_PRIMARY_SYMTABS.  */
+                  benefit of the next loop on ALL_COMPUNITS.  */
                if (kind == FUNCTIONS_DOMAIN
-                   ? find_pc_symtab (MSYMBOL_VALUE_ADDRESS (objfile,
-                                                            msymbol)) == NULL
+                   ? (find_pc_compunit_symtab
+                      (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) == NULL)
                    : (lookup_symbol_in_objfile_from_linkage_name
                       (objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
                       == NULL))
@@ -3831,9 +3699,9 @@ search_symbols (const char *regexp, enum search_domain kind,
   nfound = 0;
   retval_chain = make_cleanup_free_search_symbols (&found);
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
-    bv = BLOCKVECTOR (s);
+    bv = COMPUNIT_BLOCKVECTOR (cust);
     for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
       {
        b = BLOCKVECTOR_BLOCK (bv, i);
@@ -3862,8 +3730,8 @@ search_symbols (const char *regexp, enum search_domain kind,
                            e.g., c++ static const members.
                            We only want to skip enums here.  */
                         && !(SYMBOL_CLASS (sym) == LOC_CONST
-                             && TYPE_CODE (SYMBOL_TYPE (sym))
-                             == TYPE_CODE_ENUM))
+                             && (TYPE_CODE (SYMBOL_TYPE (sym))
+                                 == TYPE_CODE_ENUM)))
                        || (kind == FUNCTIONS_DOMAIN 
                            && SYMBOL_CLASS (sym) == LOC_BLOCK)
                        || (kind == TYPES_DOMAIN
@@ -3895,7 +3763,7 @@ search_symbols (const char *regexp, enum search_domain kind,
     }
 
   /* If there are no eyes, avoid all contact.  I mean, if there are
-     no debug symbols, then print directly from the msymbol_vector.  */
+     no debug symbols, then add matching minsyms.  */
 
   if (found_misc || (nfiles == 0 && kind != FUNCTIONS_DOMAIN))
     {
@@ -3918,8 +3786,8 @@ search_symbols (const char *regexp, enum search_domain kind,
                /* For functions we can do a quick check of whether the
                   symbol might be found via find_pc_symtab.  */
                if (kind != FUNCTIONS_DOMAIN
-                   || find_pc_symtab (MSYMBOL_VALUE_ADDRESS (objfile,
-                                                             msymbol)) == NULL)
+                   || (find_pc_compunit_symtab
+                       (MSYMBOL_VALUE_ADDRESS (objfile, msymbol)) == NULL))
                  {
                    if (lookup_symbol_in_objfile_from_linkage_name
                        (objfile, MSYMBOL_LINKAGE_NAME (msymbol), VAR_DOMAIN)
@@ -4471,7 +4339,7 @@ default_make_symbol_completion_list_break_on (const char *text,
      won't be that many.  */
 
   struct symbol *sym;
-  struct symtab *s;
+  struct compunit_symtab *cust;
   struct minimal_symbol *msymbol;
   struct objfile *objfile;
   const struct block *b;
@@ -4637,10 +4505,10 @@ default_make_symbol_completion_list_break_on (const char *text,
   /* Go through the symtabs and check the externs and statics for
      symbols which match.  */
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), GLOBAL_BLOCK);
     ALL_BLOCK_SYMBOLS (b, iter, sym)
       {
        if (code == TYPE_CODE_UNDEF
@@ -4650,10 +4518,10 @@ default_make_symbol_completion_list_break_on (const char *text,
       }
   }
 
-  ALL_PRIMARY_SYMTABS (objfile, s)
+  ALL_COMPUNITS (objfile, cust)
   {
     QUIT;
-    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+    b = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), STATIC_BLOCK);
     ALL_BLOCK_SYMBOLS (b, iter, sym)
       {
        if (code == TYPE_CODE_UNDEF
@@ -4817,13 +4685,13 @@ make_file_symbol_completion_list (const char *text, const char *word,
   /* Go through this symtab and check the externs and statics for
      symbols which match.  */
 
-  b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+  b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
   ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
       COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
     }
 
-  b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+  b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
   ALL_BLOCK_SYMBOLS (b, iter, sym)
     {
       COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
@@ -4930,6 +4798,7 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
 VEC (char_ptr) *
 make_source_files_completion_list (const char *text, const char *word)
 {
+  struct compunit_symtab *cu;
   struct symtab *s;
   struct objfile *objfile;
   size_t text_len = strlen (text);
@@ -4948,7 +4817,7 @@ make_source_files_completion_list (const char *text, const char *word)
   cache_cleanup = make_cleanup (delete_filename_seen_cache,
                                filename_seen_cache);
 
-  ALL_SYMTABS (objfile, s)
+  ALL_FILETABS (objfile, cu, s)
     {
       if (not_interesting_fname (s->filename))
        continue;
This page took 0.047428 seconds and 4 git commands to generate.