]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Replace search_domain with domain_search_flags
authorTom Tromey <tom@tromey.com>
Thu, 2 Mar 2023 22:05:17 +0000 (15:05 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 28 Jan 2024 17:58:16 +0000 (10:58 -0700)
This patch changes gdb to replace search_domain with
domain_search_flags everywhere.  search_domain is removed.

20 files changed:
gdb/ada-lang.c
gdb/compile/compile-cplus-symbols.c
gdb/dwarf2/cooked-index.c
gdb/dwarf2/cooked-index.h
gdb/dwarf2/read-gdb-index.c
gdb/dwarf2/read.c
gdb/linespec.c
gdb/mi/mi-symbol-cmds.c
gdb/objfiles.h
gdb/psymtab.c
gdb/psymtab.h
gdb/python/py-symbol.c
gdb/python/python.c
gdb/quick-symbol.h
gdb/symfile-debug.c
gdb/symfile.c
gdb/symfile.h
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h

index c04c48e2e90b9870534f15a541bafa3464382843..4eea4e6609e31d213dea32d56eeb6cb0f3d74bd4 100644 (file)
@@ -5514,7 +5514,7 @@ map_matching_symbols (struct objfile *objfile,
                                    global
                                    ? SEARCH_GLOBAL_BLOCK
                                    : SEARCH_STATIC_BLOCK,
-                                   domain, ALL_DOMAIN);
+                                   domain, SEARCH_ALL);
 
   const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
   for (compunit_symtab *symtab : objfile->compunits ())
@@ -12997,7 +12997,7 @@ ada_add_global_exceptions (compiled_regex *preg,
                           },
                           NULL,
                           SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-                          VARIABLES_DOMAIN);
+                          SEARCH_VAR_DOMAIN);
 
   /* Iterate over all objfiles irrespective of scope or linker namespaces
      so we get all exceptions anywhere in the progspace.  */
@@ -13542,7 +13542,7 @@ public:
                             NULL,
                             NULL,
                             SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-                            ALL_DOMAIN);
+                            SEARCH_ALL);
 
     /* At this point scan through the misc symbol vectors and add each
        symbol you find to the list.  Eventually we want to ignore
index e4bbaa9a2b08b740993ab00047aceab08bd607a0..dbdabe94e1e7d207353614dc47d4b06d17150577 100644 (file)
@@ -368,7 +368,7 @@ gcc_cplus_convert_symbol (void *datum,
 
       symbol_searcher searcher;
       searcher.find_all_symbols (identifier, current_language,
-                                ALL_DOMAIN, nullptr, nullptr);
+                                SEARCH_ALL, nullptr, nullptr);
 
       /* Convert any found symbols.  */
       for (const auto &it : searcher.matching_symbols ())
index d5a21ee9dec075b7eb7c6bc6bee0f7887ff08963..4831accc9cb47b43024f57003243801b39c4a0ae 100644 (file)
@@ -198,6 +198,42 @@ test_compare ()
 
 /* See cooked-index.h.  */
 
+bool
+cooked_index_entry::matches (domain_search_flags kind) const
+{
+  /* Just reject type declarations.  */
+  if ((flags & IS_TYPE_DECLARATION) != 0)
+    return false;
+
+  if ((kind & SEARCH_VAR_DOMAIN) != 0
+      && (tag == DW_TAG_variable
+         || tag == DW_TAG_constant
+         || tag == DW_TAG_enumerator))
+    return true;
+
+  if ((kind & SEARCH_STRUCT_DOMAIN) != 0
+      && (tag == DW_TAG_structure_type
+         || tag == DW_TAG_class_type
+         || tag == DW_TAG_union_type
+         || tag == DW_TAG_enumeration_type))
+    return true;
+
+  if ((kind & SEARCH_MODULE_DOMAIN) != 0 && tag == DW_TAG_module)
+    return true;
+
+  if ((kind & SEARCH_TYPE_DOMAIN) != 0 && tag_is_type (tag))
+    return true;
+
+  if ((kind & SEARCH_FUNCTION_DOMAIN) != 0
+      && (tag == DW_TAG_subprogram
+         || tag == DW_TAG_entry_point))
+    return true;
+
+  return false;
+}
+
+/* See cooked-index.h.  */
+
 const char *
 cooked_index_entry::full_name (struct obstack *storage, bool for_main) const
 {
index 86fbb8ffac4ab5956053fe93ac885303a7595aa8..b49e0b1f24830c268862c8bdd6f68c9458cbb4ce 100644 (file)
@@ -160,29 +160,7 @@ struct cooked_index_entry : public allocate_on_obstack
   }
 
   /* Return true if this entry matches KIND.  */
-  bool matches (enum search_domain kind) const
-  {
-    /* Just reject type declarations.  */
-    if ((flags & IS_TYPE_DECLARATION) != 0)
-      return false;
-
-    switch (kind)
-      {
-      case VARIABLES_DOMAIN:
-       return (tag == DW_TAG_variable
-               || tag == DW_TAG_constant
-               || tag == DW_TAG_enumerator);
-      case FUNCTIONS_DOMAIN:
-       return (tag == DW_TAG_subprogram
-               || tag == DW_TAG_entry_point);
-      case TYPES_DOMAIN:
-       return tag_is_type (tag);
-      case MODULES_DOMAIN:
-       return tag == DW_TAG_module;
-      }
-
-    return true;
-  }
+  bool matches (domain_search_flags kind) const;
 
   /* Construct the fully-qualified name of this entry and return a
      pointer to it.  If allocation is needed, it will be done on
@@ -798,7 +776,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind) override;
+     domain_search_flags kind) override;
 
   struct compunit_symtab *find_pc_sect_compunit_symtab
     (struct objfile *objfile, struct bound_minimal_symbol msymbol,
index 3f10aa748f03ad4b16bac3abea3658497e0bcc26..091aa62d61da2ff8ecfc688885155956239f8419 100644 (file)
@@ -147,7 +147,7 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind) override;
+     domain_search_flags kind) override;
 };
 
 /* This dumps minimal information about the index.
@@ -176,7 +176,7 @@ dw2_expand_marked_cus
    gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   search_domain kind)
+   domain_search_flags kind)
 {
   offset_type vec_len, vec_idx;
   bool global_seen = false;
@@ -227,27 +227,24 @@ dw2_expand_marked_cus
                continue;
            }
 
-         switch (kind)
+         domain_search_flags mask = 0;
+         switch (symbol_kind)
            {
-           case VARIABLES_DOMAIN:
-             if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
-               continue;
-             break;
-           case FUNCTIONS_DOMAIN:
-             if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION)
-               continue;
+           case GDB_INDEX_SYMBOL_KIND_VARIABLE:
+             mask = SEARCH_VAR_DOMAIN;
              break;
-           case TYPES_DOMAIN:
-             if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
-               continue;
+           case GDB_INDEX_SYMBOL_KIND_FUNCTION:
+             mask = SEARCH_FUNCTION_DOMAIN;
              break;
-           case MODULES_DOMAIN:
-             if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
-               continue;
+           case GDB_INDEX_SYMBOL_KIND_TYPE:
+             mask = SEARCH_TYPE_DOMAIN;
              break;
-           default:
+           case GDB_INDEX_SYMBOL_KIND_OTHER:
+             mask = SEARCH_MODULE_DOMAIN;
              break;
            }
+         if ((kind & mask) == 0)
+           continue;
        }
 
       /* Don't crash on bad data.  */
@@ -276,7 +273,7 @@ dwarf2_gdb_index::expand_symtabs_matching
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind)
+     domain_search_flags kind)
 {
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
 
index 82f969a30439cc435fe5909a638bca9347f2bd3f..bc56c101a094a1d436a116140cac970e08b9d993 100644 (file)
@@ -1638,7 +1638,7 @@ struct readnow_functions : public dwarf2_base_index_functions
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind) override
+     domain_search_flags kind) override
   {
     return true;
   }
@@ -16625,7 +16625,7 @@ cooked_index_functions::expand_symtabs_matching
       gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
       block_search_flags search_flags,
       domain_enum domain,
-      enum search_domain kind)
+      domain_search_flags kind)
 {
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
 
index 2c54ed55d93ddbb449536f9ce7d494d2ab45c33f..1d8cbc58b9791ca2a45e1bdf6440cfbd7a8b54c0 100644 (file)
@@ -387,13 +387,13 @@ static int symbol_to_sal (struct symtab_and_line *result,
 
 static void add_matching_symbols_to_info (const char *name,
                                          symbol_name_match_type name_match_type,
-                                         enum search_domain search_domain,
+                                         domain_search_flags domain_search_flags,
                                          struct collect_info *info,
                                          struct program_space *pspace);
 
 static void add_all_symbol_names_from_pspace
     (struct collect_info *info, struct program_space *pspace,
-     const std::vector<const char *> &names, enum search_domain search_domain);
+     const std::vector<const char *> &names, domain_search_flags domain_search_flags);
 
 static std::vector<symtab *>
   collect_symtabs_from_filename (const char *file,
@@ -1155,7 +1155,7 @@ iterate_over_all_matching_symtabs
   (struct linespec_state *state,
    const lookup_name_info &lookup_name,
    const domain_enum name_domain,
-   enum search_domain search_domain,
+   domain_search_flags domain_search_flags,
    struct program_space *search_pspace, bool include_inline,
    gdb::function_view<symbol_found_callback_ftype> callback)
 {
@@ -1174,7 +1174,7 @@ iterate_over_all_matching_symtabs
                                            (SEARCH_GLOBAL_BLOCK
                                             | SEARCH_STATIC_BLOCK),
                                            UNDEF_DOMAIN,
-                                           search_domain);
+                                           domain_search_flags);
 
          for (compunit_symtab *cu : objfile->compunits ())
            {
@@ -3331,7 +3331,7 @@ decode_objc (struct linespec_state *self, linespec *ls, const char *arg)
     return {};
 
   add_all_symbol_names_from_pspace (&info, NULL, symbol_names,
-                                   FUNCTIONS_DOMAIN);
+                                   SEARCH_FUNCTION_DOMAIN);
 
   std::vector<symtab_and_line> values;
   if (!symbols.empty () || !minimal_symbols.empty ())
@@ -3450,10 +3450,10 @@ lookup_prefix_sym (struct linespec_state *state,
       if (elt == nullptr)
        {
          iterate_over_all_matching_symtabs (state, lookup_name,
-                                            STRUCT_DOMAIN, ALL_DOMAIN,
+                                            STRUCT_DOMAIN, SEARCH_ALL,
                                             NULL, false, collector);
          iterate_over_all_matching_symtabs (state, lookup_name,
-                                            VAR_DOMAIN, ALL_DOMAIN,
+                                            VAR_DOMAIN, SEARCH_ALL,
                                             NULL, false, collector);
        }
       else
@@ -3531,12 +3531,12 @@ static void
 add_all_symbol_names_from_pspace (struct collect_info *info,
                                  struct program_space *pspace,
                                  const std::vector<const char *> &names,
-                                 enum search_domain search_domain)
+                                 domain_search_flags domain_search_flags)
 {
   for (const char *iter : names)
     add_matching_symbols_to_info (iter,
                                  symbol_name_match_type::FULL,
-                                 search_domain, info, pspace);
+                                 domain_search_flags, info, pspace);
 }
 
 static void
@@ -3630,7 +3630,7 @@ find_method (struct linespec_state *self,
             iterate over the symbol tables looking for all
             matches in this pspace.  */
          add_all_symbol_names_from_pspace (&info, pspace, result_names,
-                                           FUNCTIONS_DOMAIN);
+                                           SEARCH_FUNCTION_DOMAIN);
 
          superclass_vec.clear ();
          last_result_len = result_names.size ();
@@ -3753,7 +3753,7 @@ symtabs_from_filename (const char *filename,
 void
 symbol_searcher::find_all_symbols (const std::string &name,
                                   const struct language_defn *language,
-                                  enum search_domain search_domain,
+                                  domain_search_flags domain_search_flags,
                                   std::vector<symtab *> *search_symtabs,
                                   struct program_space *search_pspace)
 {
@@ -3775,7 +3775,7 @@ symbol_searcher::find_all_symbols (const std::string &name,
   info.file_symtabs = search_symtabs;
 
   add_matching_symbols_to_info (name.c_str (), symbol_name_match_type::WILD,
-                               search_domain, &info, search_pspace);
+                               domain_search_flags, &info, search_pspace);
 }
 
 /* Look up a function symbol named NAME in symtabs FILE_SYMTABS.  Matching
@@ -3801,9 +3801,10 @@ find_function_symbols (struct linespec_state *state,
   find_imps (name, &symbol_names);
   if (!symbol_names.empty ())
     add_all_symbol_names_from_pspace (&info, state->search_pspace,
-                                     symbol_names, FUNCTIONS_DOMAIN);
+                                     symbol_names, SEARCH_FUNCTION_DOMAIN);
   else
-    add_matching_symbols_to_info (name, name_match_type, FUNCTIONS_DOMAIN,
+    add_matching_symbols_to_info (name, name_match_type,
+                                 SEARCH_FUNCTION_DOMAIN,
                                  &info, state->search_pspace);
 }
 
@@ -4322,7 +4323,7 @@ search_minsyms_for_name (struct collect_info *info,
 static void
 add_matching_symbols_to_info (const char *name,
                              symbol_name_match_type name_match_type,
-                             enum search_domain search_domain,
+                             domain_search_flags domain_search_flags,
                              struct collect_info *info,
                              struct program_space *pspace)
 {
@@ -4333,7 +4334,7 @@ add_matching_symbols_to_info (const char *name,
       if (elt == nullptr)
        {
          iterate_over_all_matching_symtabs (info->state, lookup_name,
-                                            VAR_DOMAIN, search_domain,
+                                            VAR_DOMAIN, domain_search_flags,
                                             pspace, true,
                                             [&] (block_symbol *bsym)
            { return info->add_symbol (bsym); });
index 758f59747068cbd99a043f4e97a59c861ece028e..37cf2fbcfa2b2f95cbffb19123a8cd8226cb612d 100644 (file)
@@ -72,7 +72,7 @@ mi_cmd_symbol_list_lines (const char *command, const char *const *argv,
    results.  */
 
 static void
-output_debug_symbol (ui_out *uiout, enum search_domain kind,
+output_debug_symbol (ui_out *uiout, domain_search_flags kind,
                     struct symbol *sym, int block)
 {
   ui_out_emit_tuple tuple_emitter (uiout, NULL);
@@ -81,7 +81,7 @@ output_debug_symbol (ui_out *uiout, enum search_domain kind,
     uiout->field_unsigned ("line", sym->line ());
   uiout->field_string ("name", sym->print_name ());
 
-  if (kind == FUNCTIONS_DOMAIN || kind == VARIABLES_DOMAIN)
+  if ((kind & (SEARCH_FUNCTION_DOMAIN | SEARCH_VAR_DOMAIN)) != 0)
     {
       string_file tmp_stream;
       type_print (sym->type (), "", &tmp_stream, -1);
@@ -113,7 +113,7 @@ output_nondebug_symbol (ui_out *uiout,
    and then prints the matching [m]symbols in an MI structured format.  */
 
 static void
-mi_symbol_info (enum search_domain kind, const char *name_regexp,
+mi_symbol_info (domain_search_flags kind, const char *name_regexp,
                const char *type_regexp, bool exclude_minsyms,
                size_t max_results)
 {
@@ -190,7 +190,7 @@ parse_max_results_option (const char *arg)
    Processes command line options from ARGV and ARGC.  */
 
 static void
-mi_info_functions_or_variables (enum search_domain kind,
+mi_info_functions_or_variables (domain_search_flags kind,
                                const char *const *argv, int argc)
 {
   size_t max_results = SIZE_MAX;
@@ -217,7 +217,7 @@ mi_info_functions_or_variables (enum search_domain kind,
   while (1)
     {
       const char *cmd_string
-       = ((kind == FUNCTIONS_DOMAIN)
+       = ((kind == SEARCH_FUNCTION_DOMAIN)
           ? "-symbol-info-functions" : "-symbol-info-variables");
       int opt = mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
       if (opt < 0)
@@ -253,7 +253,7 @@ typedef std::vector<module_symbol_search>::const_iterator
 static module_symbol_search_iterator
 output_module_symbols_in_single_module_and_file
        (struct ui_out *uiout, module_symbol_search_iterator iter,
-        const module_symbol_search_iterator end, enum search_domain kind)
+        const module_symbol_search_iterator end, domain_search_flags kind)
 {
   /* The symbol for the module in which the first result resides.  */
   const symbol *first_module_symbol = iter->first.symbol;
@@ -288,7 +288,7 @@ output_module_symbols_in_single_module_and_file
 static module_symbol_search_iterator
 output_module_symbols_in_single_module
        (struct ui_out *uiout, module_symbol_search_iterator iter,
-        const module_symbol_search_iterator end, enum search_domain kind)
+        const module_symbol_search_iterator end, domain_search_flags kind)
 {
   gdb_assert (iter->first.symbol != nullptr);
   gdb_assert (iter->second.symbol != nullptr);
@@ -316,8 +316,8 @@ output_module_symbols_in_single_module
    command line options passed to the MI command.  */
 
 static void
-mi_info_module_functions_or_variables (enum search_domain kind,
-                                       const char *const *argv, int argc)
+mi_info_module_functions_or_variables (domain_search_flags kind,
+                                      const char *const *argv, int argc)
 {
   const char *module_regexp = nullptr;
   const char *regexp = nullptr;
@@ -343,7 +343,7 @@ mi_info_module_functions_or_variables (enum search_domain kind,
   while (1)
     {
       const char *cmd_string
-       = ((kind == FUNCTIONS_DOMAIN)
+       = ((kind == SEARCH_FUNCTION_DOMAIN)
           ? "-symbol-info-module-functions"
           : "-symbol-info-module-variables");
       int opt = mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
@@ -385,7 +385,7 @@ void
 mi_cmd_symbol_info_functions (const char *command, const char *const *argv,
                              int argc)
 {
-  mi_info_functions_or_variables (FUNCTIONS_DOMAIN, argv, argc);
+  mi_info_functions_or_variables (SEARCH_FUNCTION_DOMAIN, argv, argc);
 }
 
 /* Implement -symbol-info-module-functions command.  */
@@ -394,7 +394,7 @@ void
 mi_cmd_symbol_info_module_functions (const char *command,
                                     const char *const *argv, int argc)
 {
-  mi_info_module_functions_or_variables (FUNCTIONS_DOMAIN, argv, argc);
+  mi_info_module_functions_or_variables (SEARCH_FUNCTION_DOMAIN, argv, argc);
 }
 
 /* Implement -symbol-info-module-variables command.  */
@@ -403,7 +403,7 @@ void
 mi_cmd_symbol_info_module_variables (const char *command,
                                     const char *const *argv, int argc)
 {
-  mi_info_module_functions_or_variables (VARIABLES_DOMAIN, argv, argc);
+  mi_info_module_functions_or_variables (SEARCH_VAR_DOMAIN, argv, argc);
 }
 
 /* Implement -symbol-inf-modules command.  */
@@ -446,7 +446,7 @@ mi_cmd_symbol_info_modules (const char *command, const char *const *argv,
        }
     }
 
-  mi_symbol_info (MODULES_DOMAIN, regexp, nullptr, true, max_results);
+  mi_symbol_info (SEARCH_MODULE_DOMAIN, regexp, nullptr, true, max_results);
 }
 
 /* Implement -symbol-info-types command.  */
@@ -489,7 +489,8 @@ mi_cmd_symbol_info_types (const char *command, const char *const *argv,
        }
     }
 
-  mi_symbol_info (TYPES_DOMAIN, regexp, nullptr, true, max_results);
+  mi_symbol_info (SEARCH_TYPE_DOMAIN | SEARCH_STRUCT_DOMAIN, regexp, nullptr,
+                 true, max_results);
 }
 
 /* Implement -symbol-info-variables command.  */
@@ -498,5 +499,5 @@ void
 mi_cmd_symbol_info_variables (const char *command, const char *const *argv,
                              int argc)
 {
-  mi_info_functions_or_variables (VARIABLES_DOMAIN, argv, argc);
+  mi_info_functions_or_variables (SEARCH_VAR_DOMAIN, argv, argc);
 }
index 65115ce17f013d7bf6572c32d5631807acd32f35..e576c4b70873f5661f61e49918b9a5ed3217e098 100644 (file)
@@ -592,7 +592,7 @@ public:
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind);
+     domain_search_flags kind);
 
   /* See quick_symbol_functions.  */
   struct compunit_symtab *find_pc_sect_compunit_symtab
index 4a3a872309d79eca4f4ad7182d169455bbd3eca9..61d7c3bdc7127417fe2adc9ce533b1bd575f7f7c 100644 (file)
@@ -803,7 +803,7 @@ recursively_search_psymtabs
    struct objfile *objfile,
    block_search_flags search_flags,
    domain_enum domain,
-   enum search_domain search,
+   domain_search_flags search,
    const lookup_name_info &lookup_name,
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
 {
@@ -876,15 +876,15 @@ recursively_search_psymtabs
          if ((domain == UNDEF_DOMAIN
               || symbol_matches_domain ((*psym)->ginfo.language (),
                                         (*psym)->domain, domain))
-             && (search == ALL_DOMAIN
-                 || (search == MODULES_DOMAIN
+             && (search == SEARCH_ALL
+                 || (search == SEARCH_MODULE_DOMAIN
                      && (*psym)->domain == MODULE_DOMAIN)
-                 || (search == VARIABLES_DOMAIN
+                 || (search == SEARCH_VAR_DOMAIN
                      && (*psym)->aclass != LOC_TYPEDEF
                      && (*psym)->aclass != LOC_BLOCK)
-                 || (search == FUNCTIONS_DOMAIN
+                 || (search == SEARCH_FUNCTION_DOMAIN
                      && (*psym)->aclass == LOC_BLOCK)
-                 || (search == TYPES_DOMAIN
+                 || (search == SEARCH_TYPE_DOMAIN
                      && (*psym)->aclass == LOC_TYPEDEF))
              && psymbol_name_matches (*psym, lookup_name)
              && (sym_matcher == NULL
@@ -914,7 +914,7 @@ psymbol_functions::expand_symtabs_matching
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
    domain_enum domain,
-   enum search_domain search)
+   domain_search_flags search)
 {
   /* Clear the search flags.  */
   for (partial_symtab *ps : partial_symbols (objfile))
index 2bf423400d148628ae526f596d740f923e798be9..c4a0d9184f214f279625c5c886c983123a50741b 100644 (file)
@@ -634,7 +634,7 @@ struct psymbol_functions : public quick_symbol_functions
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind) override;
+     domain_search_flags kind) override;
 
   struct compunit_symtab *find_pc_sect_compunit_symtab
     (struct objfile *objfile, struct bound_minimal_symbol msymbol,
index 52a25b632e03e4abdd69812eef61d61af2451fa6..a7d010f6d0c7d1e48e76405d6d2a0ecbb0fd926f 100644 (file)
@@ -596,7 +596,7 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
       lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
       expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
                               SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-                              ALL_DOMAIN);
+                              SEARCH_ALL);
 
       for (objfile *objfile : current_program_space->objfiles ())
        {
index 1d406392bd33680b244d07c154ef4c1d76a981e2..de3a94dfc9ad518372dc508f9eae16b52efc034d 100644 (file)
@@ -736,7 +736,7 @@ gdbpy_rbreak (PyObject *self, PyObject *args, PyObject *kw)
       minsyms_p = cmp;
     }
 
-  global_symbol_searcher spec (FUNCTIONS_DOMAIN, regex);
+  global_symbol_searcher spec (SEARCH_FUNCTION_DOMAIN, regex);
   SCOPE_EXIT {
     for (const char *elem : spec.filenames)
       xfree ((void *) elem);
index 63b2908b8b247b02c8f240f75558560c00c4791d..8646ac199bd0930e62faf91785227628c809aad7 100644 (file)
@@ -156,7 +156,7 @@ struct quick_symbol_functions
      gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
      block_search_flags search_flags,
      domain_enum domain,
-     enum search_domain kind) = 0;
+     domain_search_flags kind) = 0;
 
   /* Return the comp unit from OBJFILE that contains PC and
      SECTION.  Return NULL if there is no such compunit.  This
index b0d2e19295d86f824f4c06cbd787b906c01d9fa3..38db7777d8306c9d4e47dc580bc9bd181ab61441 100644 (file)
@@ -223,7 +223,7 @@ objfile::map_symtabs_matching_filename
                                          (SEARCH_GLOBAL_BLOCK
                                           | SEARCH_STATIC_BLOCK),
                                          UNDEF_DOMAIN,
-                                         ALL_DOMAIN))
+                                         SEARCH_ALL))
        {
          retval = false;
          break;
@@ -289,7 +289,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
                                          ? SEARCH_GLOBAL_BLOCK
                                          : SEARCH_STATIC_BLOCK,
                                          domain,
-                                         ALL_DOMAIN))
+                                         SEARCH_ALL))
        break;
     }
 
@@ -344,7 +344,7 @@ objfile::expand_symtabs_for_function (const char *func_name)
                                   (SEARCH_GLOBAL_BLOCK
                                    | SEARCH_STATIC_BLOCK),
                                   VAR_DOMAIN,
-                                  ALL_DOMAIN);
+                                  SEARCH_ALL);
 }
 
 void
@@ -381,7 +381,7 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
                                   (SEARCH_GLOBAL_BLOCK
                                    | SEARCH_STATIC_BLOCK),
                                   UNDEF_DOMAIN,
-                                  ALL_DOMAIN);
+                                  SEARCH_ALL);
 }
 
 bool
@@ -392,7 +392,7 @@ objfile::expand_symtabs_matching
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
    domain_enum domain,
-   enum search_domain kind)
+   domain_search_flags kind)
 {
   /* This invariant is documented in quick-functions.h.  */
   gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
@@ -404,7 +404,7 @@ objfile::expand_symtabs_matching
                host_address_to_string (&file_matcher),
                host_address_to_string (&symbol_matcher),
                host_address_to_string (&expansion_notify),
-               search_domain_name (kind));
+               domain_name (kind).c_str ());
 
   for (const auto &iter : qf)
     if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
index 6b9f8055711d6c9cae8bc0b11c43a84a1ea19b02..065eaf0d518bbba2e0a3921b284b1d35c101fe5b 100644 (file)
@@ -3769,7 +3769,7 @@ expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   enum search_domain kind)
+   domain_search_flags kind)
 {
   for (objfile *objfile : current_program_space->objfiles ())
     if (!objfile->expand_symtabs_matching (file_matcher,
index 4cb3c38a5bf85a87d69a7aeb8a0510151e31e6ba..6f8b441b39fd3007f802f78181e7da420fd7a84f 100644 (file)
@@ -352,7 +352,7 @@ bool expand_symtabs_matching
    gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
    gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
    block_search_flags search_flags,
-   enum search_domain kind);
+   domain_search_flags kind);
 
 void map_symbol_filenames (gdb::function_view<symbol_filename_ftype> fun,
                           bool need_fullname);
index 5dfb9fca8f07c57038fe4570961906ce32ce4461..519df2550473e44f3e34a42528d9b3e70d20c3cf 100644 (file)
@@ -920,7 +920,7 @@ maintenance_expand_symtabs (const char *args, int from_tty)
         NULL,
         SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
         UNDEF_DOMAIN,
-        ALL_DOMAIN);
+        SEARCH_ALL);
 }
 \f
 
index 779e1ff82fedb03b1f0000afc148d671b161f9c4..7c56dbadf8cd20e6dba1b0c4ba0a5b4b59bffcac 100644 (file)
@@ -313,22 +313,6 @@ domain_name (domain_enum e)
     }
 }
 
-/* Return the name of a search_domain .  */
-
-const char *
-search_domain_name (enum search_domain e)
-{
-  switch (e)
-    {
-    case VARIABLES_DOMAIN: return "VARIABLES_DOMAIN";
-    case FUNCTIONS_DOMAIN: return "FUNCTIONS_DOMAIN";
-    case TYPES_DOMAIN: return "TYPES_DOMAIN";
-    case MODULES_DOMAIN: return "MODULES_DOMAIN";
-    case ALL_DOMAIN: return "ALL_DOMAIN";
-    default: gdb_assert_not_reached ("bad search_domain");
-    }
-}
-
 /* See symtab.h.  */
 
 std::string
@@ -4774,7 +4758,7 @@ treg_matches_sym_type_name (const compiled_regex &treg,
 
 bool
 global_symbol_searcher::is_suitable_msymbol
-       (const enum search_domain kind, const minimal_symbol *msymbol)
+       (const domain_search_flags kind, const minimal_symbol *msymbol)
 {
   switch (msymbol->type ())
     {
@@ -4782,12 +4766,12 @@ global_symbol_searcher::is_suitable_msymbol
     case mst_bss:
     case mst_file_data:
     case mst_file_bss:
-      return kind == VARIABLES_DOMAIN;
+      return (kind & SEARCH_VAR_DOMAIN) != 0;
     case mst_text:
     case mst_file_text:
     case mst_solib_trampoline:
     case mst_text_gnu_ifunc:
-      return kind == FUNCTIONS_DOMAIN;
+      return (kind & SEARCH_FUNCTION_DOMAIN) != 0;
     default:
       return false;
     }
@@ -4799,7 +4783,7 @@ bool
 global_symbol_searcher::expand_symtabs
        (objfile *objfile, const std::optional<compiled_regex> &preg) const
 {
-  enum search_domain kind = m_kind;
+  domain_search_flags kind = m_kind;
   bool found_msymbol = false;
 
   auto do_file_match = [&] (const char *filename, bool basenames)
@@ -4838,7 +4822,7 @@ global_symbol_searcher::expand_symtabs
      all objfiles.  In large programs (1000s of shared libs) searching all
      objfiles is not worth the pain.  */
   if (filenames.empty ()
-      && (kind == VARIABLES_DOMAIN || kind == FUNCTIONS_DOMAIN))
+      && (kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN)) != 0)
     {
       for (minimal_symbol *msymbol : objfile->msymbols ())
        {
@@ -4858,7 +4842,7 @@ global_symbol_searcher::expand_symtabs
                     in the process we will add matching symbols or
                     msymbols to the results list, and that requires that
                     the symbols tables are expanded.  */
-                 if (kind == FUNCTIONS_DOMAIN
+                 if ((kind & SEARCH_FUNCTION_DOMAIN) != 0
                      ? (find_pc_compunit_symtab
                         (msymbol->value_address (objfile)) == NULL)
                      : (lookup_symbol_in_objfile_from_linkage_name
@@ -4883,7 +4867,7 @@ global_symbol_searcher::add_matching_symbols
         const std::optional<compiled_regex> &treg,
         std::set<symbol_search> *result_set) const
 {
-  enum search_domain kind = m_kind;
+  domain_search_flags kind = m_kind;
 
   /* Add matching symbols (if not already present).  */
   for (compunit_symtab *cust : objfile->compunits ())
@@ -4916,7 +4900,7 @@ global_symbol_searcher::add_matching_symbols
                continue;
 
              bool matches = false;
-             if (!matches && kind == VARIABLES_DOMAIN)
+             if (!matches && (kind & SEARCH_VAR_DOMAIN) != 0)
                {
                  if (sym->aclass () != LOC_TYPEDEF
                      && sym->aclass () != LOC_UNRESOLVED
@@ -4932,7 +4916,7 @@ global_symbol_searcher::add_matching_symbols
                          || treg_matches_sym_type_name (*treg, sym)))
                    matches = true;
                }
-             if (!matches && kind == FUNCTIONS_DOMAIN)
+             if (!matches && (kind & SEARCH_FUNCTION_DOMAIN) != 0)
                {
                  if (sym->aclass () == LOC_BLOCK
                      && (!treg.has_value ()
@@ -4940,13 +4924,13 @@ global_symbol_searcher::add_matching_symbols
                                                         sym)))
                    matches = true;
                }
-             if (!matches && kind == TYPES_DOMAIN)
+             if (!matches && (kind & SEARCH_TYPE_DOMAIN) != 0)
                {
                  if (sym->aclass () == LOC_TYPEDEF
                      && sym->domain () != MODULE_DOMAIN)
                    matches = true;
                }
-             if (!matches && kind == MODULES_DOMAIN)
+             if (!matches && (kind & SEARCH_MODULE_DOMAIN) != 0)
                {
                  if (sym->domain () == MODULE_DOMAIN
                      && sym->line () != 0)
@@ -4978,7 +4962,7 @@ global_symbol_searcher::add_matching_msymbols
        (objfile *objfile, const std::optional<compiled_regex> &preg,
         std::vector<symbol_search> *results) const
 {
-  enum search_domain kind = m_kind;
+  domain_search_flags kind = m_kind;
 
   for (minimal_symbol *msymbol : objfile->msymbols ())
     {
@@ -4995,7 +4979,7 @@ global_symbol_searcher::add_matching_msymbols
            {
              /* For functions we can do a quick check of whether the
                 symbol might be found via find_pc_symtab.  */
-             if (kind != FUNCTIONS_DOMAIN
+             if ((kind & SEARCH_FUNCTION_DOMAIN) == 0
                  || (find_pc_compunit_symtab
                      (msymbol->value_address (objfile)) == NULL))
                {
@@ -5025,8 +5009,6 @@ global_symbol_searcher::search () const
   std::optional<compiled_regex> preg;
   std::optional<compiled_regex> treg;
 
-  gdb_assert (m_kind != ALL_DOMAIN);
-
   if (m_symbol_name_regexp != NULL)
     {
       const char *symbol_name_regexp = m_symbol_name_regexp;
@@ -5103,11 +5085,13 @@ global_symbol_searcher::search () const
      user wants to see symbols matching a type regexp, then never give a
      minimal symbol, as we assume that a minimal symbol does not have a
      type.  */
-  if ((found_msymbol || (filenames.empty () && m_kind == VARIABLES_DOMAIN))
+  if ((found_msymbol
+       || (filenames.empty () && (m_kind & SEARCH_VAR_DOMAIN) != 0))
       && !m_exclude_minsyms
       && !treg.has_value ())
     {
-      gdb_assert (m_kind == VARIABLES_DOMAIN || m_kind == FUNCTIONS_DOMAIN);
+      gdb_assert ((m_kind & (SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN))
+                 != 0);
       for (objfile *objfile : current_program_space->objfiles ())
        if (!add_matching_msymbols (objfile, preg, &result))
          break;
@@ -5238,36 +5222,55 @@ print_msymbol_info (struct bound_minimal_symbol msymbol)
 
 static void
 symtab_symbol_info (bool quiet, bool exclude_minsyms,
-                   const char *regexp, enum search_domain kind,
+                   const char *regexp, domain_enum kind,
                    const char *t_regexp, int from_tty)
 {
-  static const char * const classnames[] =
-    {"variable", "function", "type", "module"};
   const char *last_filename = "";
   int first = 1;
 
-  gdb_assert (kind != ALL_DOMAIN);
-
   if (regexp != nullptr && *regexp == '\0')
     regexp = nullptr;
 
-  global_symbol_searcher spec (kind, regexp);
+  domain_search_flags flags = to_search_flags (kind);
+  if (kind == TYPE_DOMAIN)
+    flags |= SEARCH_STRUCT_DOMAIN;
+
+  global_symbol_searcher spec (flags, regexp);
   spec.set_symbol_type_regexp (t_regexp);
   spec.set_exclude_minsyms (exclude_minsyms);
   std::vector<symbol_search> symbols = spec.search ();
 
   if (!quiet)
     {
+      const char *classname;
+      switch (kind)
+       {
+       case VAR_DOMAIN:
+         classname = "variable";
+         break;
+       case FUNCTION_DOMAIN:
+         classname = "function";
+         break;
+       case TYPE_DOMAIN:
+         classname = "type";
+         break;
+       case MODULE_DOMAIN:
+         classname = "module";
+         break;
+       default:
+         gdb_assert_not_reached ("invalid domain enum");
+       }
+
       if (regexp != NULL)
        {
          if (t_regexp != NULL)
            gdb_printf
              (_("All %ss matching regular expression \"%s\""
                 " with type matching regular expression \"%s\":\n"),
-              classnames[kind], regexp, t_regexp);
+              classname, regexp, t_regexp);
          else
            gdb_printf (_("All %ss matching regular expression \"%s\":\n"),
-                       classnames[kind], regexp);
+                       classname, regexp);
        }
       else
        {
@@ -5275,9 +5278,9 @@ symtab_symbol_info (bool quiet, bool exclude_minsyms,
            gdb_printf
              (_("All defined %ss"
                 " with type matching regular expression \"%s\" :\n"),
-              classnames[kind], t_regexp);
+              classname, t_regexp);
          else
-           gdb_printf (_("All defined %ss:\n"), classnames[kind]);
+           gdb_printf (_("All defined %ss:\n"), classname);
        }
     }
 
@@ -5380,7 +5383,7 @@ info_variables_command (const char *args, int from_tty)
     args = nullptr;
 
   symtab_symbol_info
-    (opts.quiet, opts.exclude_minsyms, args, VARIABLES_DOMAIN,
+    (opts.quiet, opts.exclude_minsyms, args, VAR_DOMAIN,
      opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
      from_tty);
 }
@@ -5399,7 +5402,7 @@ info_functions_command (const char *args, int from_tty)
     args = nullptr;
 
   symtab_symbol_info
-    (opts.quiet, opts.exclude_minsyms, args, FUNCTIONS_DOMAIN,
+    (opts.quiet, opts.exclude_minsyms, args, FUNCTION_DOMAIN,
      opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
      from_tty);
 }
@@ -5442,7 +5445,8 @@ info_types_command (const char *args, int from_tty)
     (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
   if (args != nullptr && *args == '\0')
     args = nullptr;
-  symtab_symbol_info (opts.quiet, false, args, TYPES_DOMAIN, NULL, from_tty);
+  symtab_symbol_info (opts.quiet, false, args, TYPE_DOMAIN, nullptr,
+                     from_tty);
 }
 
 /* Command completer for 'info types' command.  */
@@ -5474,7 +5478,7 @@ info_modules_command (const char *args, int from_tty)
     (&args, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
   if (args != nullptr && *args == '\0')
     args = nullptr;
-  symtab_symbol_info (opts.quiet, true, args, MODULES_DOMAIN, NULL,
+  symtab_symbol_info (opts.quiet, true, args, MODULE_DOMAIN, nullptr,
                      from_tty);
 }
 
@@ -5517,7 +5521,7 @@ rbreak_command (const char *regexp, int from_tty)
        }
     }
 
-  global_symbol_searcher spec (FUNCTIONS_DOMAIN, regexp);
+  global_symbol_searcher spec (SEARCH_FUNCTION_DOMAIN, regexp);
   if (file_name != nullptr)
     spec.filenames.push_back (file_name);
   std::vector<symbol_search> symbols = spec.search ();
@@ -6015,7 +6019,7 @@ default_collect_symbol_completion_matches_break_on
                               return true;
                             },
                           SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
-                          ALL_DOMAIN);
+                          SEARCH_ALL);
 
   /* Search upwards from currently selected frame (so that we can
      complete on local vars).  Also catch fields of types defined in
@@ -6714,12 +6718,12 @@ static struct cmd_list_element *info_module_cmdlist = NULL;
 
 std::vector<module_symbol_search>
 search_module_symbols (const char *module_regexp, const char *regexp,
-                      const char *type_regexp, search_domain kind)
+                      const char *type_regexp, domain_search_flags kind)
 {
   std::vector<module_symbol_search> results;
 
   /* Search for all modules matching MODULE_REGEXP.  */
-  global_symbol_searcher spec1 (MODULES_DOMAIN, module_regexp);
+  global_symbol_searcher spec1 (SEARCH_MODULE_DOMAIN, module_regexp);
   spec1.set_exclude_minsyms (true);
   std::vector<symbol_search> modules = spec1.search ();
 
@@ -6765,8 +6769,10 @@ search_module_symbols (const char *module_regexp, const char *regexp,
 static void
 info_module_subcommand (bool quiet, const char *module_regexp,
                        const char *regexp, const char *type_regexp,
-                       search_domain kind)
+                       domain_search_flags kind)
 {
+  gdb_assert (kind == SEARCH_FUNCTION_DOMAIN || kind == SEARCH_VAR_DOMAIN);
+
   /* Print a header line.  Don't build the header line bit by bit as this
      prevents internationalisation.  */
   if (!quiet)
@@ -6776,12 +6782,12 @@ info_module_subcommand (bool quiet, const char *module_regexp,
          if (type_regexp == nullptr)
            {
              if (regexp == nullptr)
-               gdb_printf ((kind == VARIABLES_DOMAIN
+               gdb_printf ((kind == SEARCH_VAR_DOMAIN
                             ? _("All variables in all modules:")
                             : _("All functions in all modules:")));
              else
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables matching regular expression"
                        " \"%s\" in all modules:")
                    : _("All functions matching regular expression"
@@ -6792,7 +6798,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
            {
              if (regexp == nullptr)
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables with type matching regular "
                        "expression \"%s\" in all modules:")
                    : _("All functions with type matching regular "
@@ -6800,7 +6806,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
                   type_regexp);
              else
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables matching regular expression "
                        "\"%s\",\n\twith type matching regular "
                        "expression \"%s\" in all modules:")
@@ -6816,7 +6822,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
            {
              if (regexp == nullptr)
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables in all modules matching regular "
                        "expression \"%s\":")
                    : _("All functions in all modules matching regular "
@@ -6824,7 +6830,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
                   module_regexp);
              else
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables matching regular expression "
                        "\"%s\",\n\tin all modules matching regular "
                        "expression \"%s\":")
@@ -6837,7 +6843,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
            {
              if (regexp == nullptr)
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables with type matching regular "
                        "expression \"%s\"\n\tin all modules matching "
                        "regular expression \"%s\":")
@@ -6847,7 +6853,7 @@ info_module_subcommand (bool quiet, const char *module_regexp,
                   type_regexp, module_regexp);
              else
                gdb_printf
-                 ((kind == VARIABLES_DOMAIN
+                 ((kind == SEARCH_VAR_DOMAIN
                    ? _("All variables matching regular expression "
                        "\"%s\",\n\twith type matching regular expression "
                        "\"%s\",\n\tin all modules matching regular "
@@ -6962,7 +6968,7 @@ info_module_functions_command (const char *args, int from_tty)
     (opts.quiet,
      opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
      opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
-     FUNCTIONS_DOMAIN);
+     SEARCH_FUNCTION_DOMAIN);
 }
 
 /* Implements the 'info module variables' command.  */
@@ -6981,7 +6987,7 @@ info_module_variables_command (const char *args, int from_tty)
     (opts.quiet,
      opts.module_regexp.empty () ? nullptr : opts.module_regexp.c_str (), args,
      opts.type_regexp.empty () ? nullptr : opts.type_regexp.c_str (),
-     VARIABLES_DOMAIN);
+     SEARCH_VAR_DOMAIN);
 }
 
 /* Command completer for 'info module ...' sub-commands.  */
index 953b6c1e739a3949de2b578af66d8ca36c7b58b5..b3646e4980ed8ba14d0488c2d80a73847bb43aa6 100644 (file)
@@ -947,30 +947,6 @@ search_flags_matches (domain_search_flags flags, domain_enum domain)
   return (flags & to_search_flags (domain)) != 0;
 }
 
-/* Searching domains, used when searching for symbols.  Element numbers are
-   hardcoded in GDB, check all enum uses before changing it.  */
-
-enum search_domain
-{
-  /* Everything in VAR_DOMAIN minus FUNCTIONS_DOMAIN and
-     TYPES_DOMAIN.  */
-  VARIABLES_DOMAIN = 0,
-
-  /* All functions -- for some reason not methods, though.  */
-  FUNCTIONS_DOMAIN = 1,
-
-  /* All defined types */
-  TYPES_DOMAIN = 2,
-
-  /* All modules.  */
-  MODULES_DOMAIN = 3,
-
-  /* Any type.  */
-  ALL_DOMAIN = 4
-};
-
-extern const char *search_domain_name (enum search_domain);
-
 /* An address-class says where to find the value of a symbol.  */
 
 enum address_class
@@ -2584,13 +2560,11 @@ class global_symbol_searcher
 public:
 
   /* Constructor.  */
-  global_symbol_searcher (enum search_domain kind,
+  global_symbol_searcher (domain_search_flags kind,
                          const char *symbol_name_regexp)
     : m_kind (kind),
       m_symbol_name_regexp (symbol_name_regexp)
   {
-    /* The symbol searching is designed to only find one kind of thing.  */
-    gdb_assert (m_kind != ALL_DOMAIN);
   }
 
   /* Set the optional regexp that matches against the symbol type.  */
@@ -2632,7 +2606,7 @@ private:
      TYPES_DOMAIN     - Search all type names.
      MODULES_DOMAIN   - Search all Fortran modules.
      ALL_DOMAIN       - Not valid for this function.  */
-  enum search_domain m_kind;
+  domain_search_flags m_kind;
 
   /* Regular expression to match against the symbol name.  */
   const char *m_symbol_name_regexp = nullptr;
@@ -2676,7 +2650,7 @@ private:
                              std::vector<symbol_search> *results) const;
 
   /* Return true if MSYMBOL is of type KIND.  */
-  static bool is_suitable_msymbol (const enum search_domain kind,
+  static bool is_suitable_msymbol (const domain_search_flags kind,
                                   const minimal_symbol *msymbol);
 };
 
@@ -2693,7 +2667,7 @@ typedef std::pair<symbol_search, symbol_search> module_symbol_search;
    within the module.  */
 extern std::vector<module_symbol_search> search_module_symbols
        (const char *module_regexp, const char *regexp,
-        const char *type_regexp, search_domain kind);
+        const char *type_regexp, domain_search_flags 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'
@@ -2895,7 +2869,7 @@ public:
      to search all symtabs and program spaces.  */
   void find_all_symbols (const std::string &name,
                         const struct language_defn *language,
-                        enum search_domain search_domain,
+                        domain_search_flags domain_search_flags,
                         std::vector<symtab *> *search_symtabs,
                         struct program_space *search_pspace);