gdb: Split global symbol search into separate functions
[deliverable/binutils-gdb.git] / gdb / symtab.h
index 680c334086b7f0435357ec4fd3e3f3c43e307283..41abf1f38ff0af71412e4b82a13e84cac31410cc 100644 (file)
@@ -416,6 +416,14 @@ struct general_symbol_info
      returns the same value (same pointer) as linkage_name ().  */
   const char *search_name () const;
 
+  /* Set just the linkage name of a symbol; do not try to demangle
+     it.  Used for constructs which do not have a mangled name,
+     e.g. struct tags.  Unlike SYMBOL_SET_NAMES, linkage_name must
+     be terminated and either already on the objfile's obstack or
+     permanently allocated.  */
+  void set_linkage_name (const char *linkage_name)
+  { name = linkage_name; }
+
   /* Name of the symbol.  This is a required field.  Storage for the
      name is allocated on the objfile_obstack for the associated
      objfile.  For languages like C++ that make a distinction between
@@ -528,7 +536,6 @@ extern void symbol_set_language (struct general_symbol_info *symbol,
                                  enum language language,
                                 struct obstack *obstack);
 
-
 /* Try to determine the demangled name for a symbol, based on the
    language of that symbol.  If the language is set to language_auto,
    it will attempt to find any demangling algorithm that works and
@@ -538,14 +545,6 @@ extern void symbol_set_language (struct general_symbol_info *symbol,
 extern char *symbol_find_demangled_name (struct general_symbol_info *gsymbol,
                                         const char *mangled);
 
-/* Set just the linkage name of a symbol; do not try to demangle
-   it.  Used for constructs which do not have a mangled name,
-   e.g. struct tags.  Unlike SYMBOL_SET_NAMES, linkage_name must
-   be terminated and either already on the objfile's obstack or
-   permanently allocated.  */
-#define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
-  (symbol)->name = (linkage_name)
-
 /* Set the linkage and natural names of a symbol, by demangling
    the linkage name.  If linkage_name may not be nullterminated,
    copy_name must be set to true.  */
@@ -554,7 +553,9 @@ extern char *symbol_find_demangled_name (struct general_symbol_info *gsymbol,
                    (objfile)->per_bfd)
 extern void symbol_set_names (struct general_symbol_info *symbol,
                              gdb::string_view linkage_name, bool copy_name,
-                             struct objfile_per_bfd_storage *per_bfd);
+                             struct objfile_per_bfd_storage *per_bfd,
+                             gdb::optional<hashval_t> hash
+                               = gdb::optional<hashval_t> ());
 
 /* Return true if NAME matches the "search" name of SYMBOL, according
    to the symbol's language.  */
@@ -2123,6 +2124,29 @@ private:
   /* When this flag is false then minsyms that match M_SYMBOL_REGEXP will
      be included in the results, otherwise they are excluded.  */
   bool m_exclude_minsyms = false;
+
+  /* Expand symtabs in OBJFILE that match PREG, are of type M_KIND.  Return
+     true if any msymbols were seen that we should later consider adding to
+     the results list.  */
+  bool expand_symtabs (objfile *objfile,
+                      const gdb::optional<compiled_regex> &preg) const;
+
+  /* Add symbols from symtabs in OBJFILE that match PREG, and TREG, and are
+     of type M_KIND, to the results vector RESULTS.  */
+  void add_matching_symbols (objfile *objfile,
+                            const gdb::optional<compiled_regex> &preg,
+                            const gdb::optional<compiled_regex> &treg,
+                            std::vector<symbol_search> *results) const;
+
+  /* Add msymbols from OBJFILE that match PREG and M_KIND, to the
+     results vector RESULTS.  */
+  void add_matching_msymbols (objfile *objfile,
+                             const gdb::optional<compiled_regex> &preg,
+                             std::vector<symbol_search> *results) const;
+
+  /* Return true if MSYMBOL is of type KIND.  */
+  static bool is_suitable_msymbol (const enum search_domain kind,
+                                  const minimal_symbol *msymbol);
 };
 
 /* When searching for Fortran symbols within modules (functions/variables)
@@ -2140,6 +2164,14 @@ extern std::vector<module_symbol_search> search_module_symbols
        (const char *module_regexp, const char *regexp,
         const char *type_regexp, search_domain kind);
 
+/* Convert a global or static symbol SYM (based on BLOCK, which should be
+   either GLOBAL_BLOCK or STATIC_BLOCK) into a string for use in 'info'
+   type commands (e.g. 'info variables', 'info functions', etc).  KIND is
+   the type of symbol that was searched for which gave us SYM.  */
+
+extern std::string symbol_to_info_string (struct symbol *sym, int block,
+                                         enum search_domain kind);
+
 extern bool treg_matches_sym_type_name (const compiled_regex &treg,
                                        const struct symbol *sym);
 
This page took 0.030218 seconds and 4 git commands to generate.