]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use domain_search_flags in lookup_symbol et al
authorTom Tromey <tom@tromey.com>
Fri, 31 Mar 2023 05:00:26 +0000 (23:00 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 28 Jan 2024 17:58:16 +0000 (10:58 -0700)
This changes lookup_symbol and associated APIs to accept
domain_search_flags rather than a domain_enum.

Note that this introduces some new constants to Python and Guile.  I
chose to break out the documentation patch for this, because the
internals here do not change until a later patch, and it seemed
simpler to patch the docs just once, rather than twice.

64 files changed:
gdb/ada-lang.c
gdb/ada-tasks.c
gdb/alpha-mdebug-tdep.c
gdb/ax-gdb.c
gdb/block.c
gdb/block.h
gdb/c-exp.y
gdb/c-lang.c
gdb/c-valprint.c
gdb/compile/compile-c-symbols.c
gdb/compile/compile-cplus-symbols.c
gdb/compile/compile-cplus-types.c
gdb/compile/compile-object-load.c
gdb/cp-namespace.c
gdb/cp-support.c
gdb/cp-support.h
gdb/d-exp.y
gdb/d-lang.c
gdb/d-lang.h
gdb/d-namespace.c
gdb/dwarf2/ada-imported.c
gdb/dwarf2/loc.c
gdb/eval.c
gdb/f-exp.y
gdb/f-lang.c
gdb/f-lang.h
gdb/f-valprint.c
gdb/fbsd-tdep.c
gdb/frame.c
gdb/ft32-tdep.c
gdb/gdbtypes.c
gdb/gnu-v3-abi.c
gdb/go-exp.y
gdb/guile/scm-frame.c
gdb/guile/scm-symbol.c
gdb/infrun.c
gdb/language.c
gdb/language.h
gdb/linespec.c
gdb/m2-exp.y
gdb/mi/mi-cmd-stack.c
gdb/moxie-tdep.c
gdb/objc-lang.c
gdb/objfiles.h
gdb/p-exp.y
gdb/p-valprint.c
gdb/parse.c
gdb/printcmd.c
gdb/psymtab.c
gdb/python/py-frame.c
gdb/python/py-objfile.c
gdb/python/py-symbol.c
gdb/rust-lang.c
gdb/rust-lang.h
gdb/rust-parse.c
gdb/source.c
gdb/stack.c
gdb/symfile-debug.c
gdb/symfile.c
gdb/symtab.c
gdb/symtab.h
gdb/valops.c
gdb/value.c
gdb/xstormy16-tdep.c

index a1fac3e8ad31dc78c4333c86e693b131eb879b19..a15ea7b725e05b49f3e979452dd23ea7a036ea42 100644 (file)
@@ -13675,19 +13675,15 @@ public:
 
   struct block_symbol lookup_symbol_nonlocal
        (const char *name, const struct block *block,
-        const domain_enum domain) const override
+        const domain_search_flags domain) const override
   {
     struct block_symbol sym;
 
-    domain_search_flags flags = to_search_flags (domain);
-    if (domain == VAR_DOMAIN)
-      flags |= SEARCH_TYPE_DOMAIN | SEARCH_FUNCTION_DOMAIN;
-
     sym = ada_lookup_symbol (name,
                             (block == nullptr
                              ? nullptr
                              : block->static_block ()),
-                            flags);
+                            domain);
     if (sym.symbol != NULL)
       return sym;
 
@@ -13703,7 +13699,7 @@ public:
        languages, we search the primitive types this late and only after
        having searched the global symbols without success.  */
 
-    if (domain == VAR_DOMAIN)
+    if ((domain & SEARCH_TYPE_DOMAIN) != 0)
       {
        struct gdbarch *gdbarch;
 
index e4aacaf4b6a91fde9360608b08c1db951e7a0091..fd3f5d1ead9b40ccb12c8429dee0d7885049c3c6 100644 (file)
@@ -520,16 +520,17 @@ ada_get_tcb_types_info (void)
      C-like) lookups to get the first match.  */
 
   struct symbol *atcb_sym =
-    lookup_symbol_in_language (atcb_name, NULL, STRUCT_DOMAIN,
+    lookup_symbol_in_language (atcb_name, NULL, SEARCH_STRUCT_DOMAIN,
                               language_c, NULL).symbol;
   const struct symbol *common_atcb_sym =
-    lookup_symbol_in_language (common_atcb_name, NULL, STRUCT_DOMAIN,
+    lookup_symbol_in_language (common_atcb_name, NULL, SEARCH_STRUCT_DOMAIN,
                               language_c, NULL).symbol;
   const struct symbol *private_data_sym =
-    lookup_symbol_in_language (private_data_name, NULL, STRUCT_DOMAIN,
+    lookup_symbol_in_language (private_data_name, NULL, SEARCH_STRUCT_DOMAIN,
                               language_c, NULL).symbol;
   const struct symbol *entry_call_record_sym =
-    lookup_symbol_in_language (entry_call_record_name, NULL, STRUCT_DOMAIN,
+    lookup_symbol_in_language (entry_call_record_name, NULL,
+                              SEARCH_STRUCT_DOMAIN,
                               language_c, NULL).symbol;
 
   if (atcb_sym == NULL || atcb_sym->type () == NULL)
@@ -537,7 +538,7 @@ ada_get_tcb_types_info (void)
       /* In Ravenscar run-time libs, the  ATCB does not have a dynamic
         size, so the symbol name differs.  */
       atcb_sym = lookup_symbol_in_language (atcb_name_fixed, NULL,
-                                           STRUCT_DOMAIN, language_c,
+                                           SEARCH_STRUCT_DOMAIN, language_c,
                                            NULL).symbol;
 
       if (atcb_sym == NULL || atcb_sym->type () == NULL)
@@ -929,7 +930,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
       data->known_tasks_addr = msym.value_address ();
 
       /* Try to get pointer type and array length from the symtab.  */
-      sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN,
+      sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL,
+                                      SEARCH_VAR_DOMAIN,
                                       language_c, NULL).symbol;
       if (sym != NULL)
        {
@@ -975,7 +977,8 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data)
       data->known_tasks_addr = msym.value_address ();
       data->known_tasks_length = 1;
 
-      sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN,
+      sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL,
+                                      SEARCH_VAR_DOMAIN,
                                       language_c, NULL).symbol;
       if (sym != NULL && sym->value_address () != 0)
        {
index 1ba8e500e32737f473aa3939b495a6eb131259a0..7691a53148ae77ec5b4b24c6657d2620bbc0b0ed 100644 (file)
@@ -106,7 +106,7 @@ find_proc_desc (CORE_ADDR pc)
           symbol reading.  */
        sym = NULL;
       else
-       sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, LABEL_DOMAIN,
+       sym = lookup_symbol (MDEBUG_EFI_SYMBOL_NAME, b, SEARCH_LABEL_DOMAIN,
                             0).symbol;
     }
 
index c56d48683105d1d906a0d37a901439b7e04d75b3..f6d2bc5772b33f6a527a95652a8f3185948cd2ab 100644 (file)
@@ -1453,7 +1453,8 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value,
   else
     {
       const char *phys_name = type->field (fieldno).loc_physname ();
-      struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0).symbol;
+      struct symbol *sym = lookup_symbol (phys_name, 0,
+                                         SEARCH_VAR_DOMAIN, 0).symbol;
 
       if (sym)
        {
@@ -1544,7 +1545,7 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value,
 
   sym = cp_lookup_symbol_namespace (namespace_name, name,
                                    block_for_pc (ax->scope),
-                                   VAR_DOMAIN);
+                                   SEARCH_VAR_DOMAIN);
 
   if (sym.symbol == NULL)
     return 0;
index 4b9307ea7947b754ddfbd425508e70b81a249e15..0bdd0f915c04912288d833d97fae986e34357fe1 100644 (file)
@@ -630,26 +630,32 @@ block_iterator_next (struct block_iterator *iterator)
 /* See block.h.  */
 
 bool
-best_symbol (struct symbol *a, const domain_enum domain)
+best_symbol (struct symbol *a, const domain_search_flags domain)
 {
-  return (a->domain () == domain
-         && a->aclass () != LOC_UNRESOLVED);
+  if (a->aclass () == LOC_UNRESOLVED)
+    return false;
+
+  if ((domain & SEARCH_VAR_DOMAIN) != 0)
+    return a->domain () == VAR_DOMAIN;
+
+  return a->matches (domain);
 }
 
 /* See block.h.  */
 
 struct symbol *
-better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain)
+better_symbol (struct symbol *a, struct symbol *b,
+              const domain_search_flags domain)
 {
   if (a == NULL)
     return b;
   if (b == NULL)
     return a;
 
-  if (a->domain () == domain && b->domain () != domain)
+  if (a->matches (domain) && !b->matches (domain))
     return a;
 
-  if (b->domain () == domain && a->domain () != domain)
+  if (b->matches (domain) && !a->matches (domain))
     return b;
 
   if (a->aclass () != LOC_UNRESOLVED && b->aclass () == LOC_UNRESOLVED)
@@ -675,7 +681,7 @@ better_symbol (struct symbol *a, struct symbol *b, const domain_enum domain)
 struct symbol *
 block_lookup_symbol (const struct block *block, const char *name,
                     symbol_name_match_type match_type,
-                    const domain_enum domain)
+                    const domain_search_flags domain)
 {
   lookup_name_info lookup_name (name, match_type);
 
@@ -730,7 +736,7 @@ block_lookup_symbol (const struct block *block, const char *name,
 
 struct symbol *
 block_lookup_symbol_primary (const struct block *block, const char *name,
-                            const domain_enum domain)
+                            const domain_search_flags domain)
 {
   struct symbol *sym, *other;
   struct mdict_iterator mdict_iter;
@@ -792,7 +798,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
 
 struct symbol *
 block_find_symbol (const struct block *block, const lookup_name_info &name,
-                  const domain_enum domain, struct symbol **stub)
+                  const domain_search_flags domain, struct symbol **stub)
 {
   /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK.  */
   gdb_assert (block->superblock () == NULL
index 5c56518bfcef36aab1ed33ec4a131c3c9d01f7d5..0c121941f0534b1848fc06a3cdb6d55e846f45f1 100644 (file)
@@ -554,28 +554,29 @@ typedef iterator_range<block_iterator_wrapper> block_iterator_range;
 
 /* Return true if symbol A is the best match possible for DOMAIN.  */
 
-extern bool best_symbol (struct symbol *a, const domain_enum domain);
+extern bool best_symbol (struct symbol *a, const domain_search_flags domain);
 
 /* Return symbol B if it is a better match than symbol A for DOMAIN.
    Otherwise return A.  */
 
 extern struct symbol *better_symbol (struct symbol *a, struct symbol *b,
-                                    const domain_enum domain);
+                                    const domain_search_flags domain);
 
 /* Search BLOCK for symbol NAME in DOMAIN.  */
 
 extern struct symbol *block_lookup_symbol (const struct block *block,
                                           const char *name,
                                           symbol_name_match_type match_type,
-                                          const domain_enum domain);
+                                          const domain_search_flags domain);
 
 /* Search BLOCK for symbol NAME in DOMAIN but only in primary symbol table of
    BLOCK.  BLOCK must be STATIC_BLOCK or GLOBAL_BLOCK.  Function is useful if
    one iterates all global/static blocks of an objfile.  */
 
-extern struct symbol *block_lookup_symbol_primary (const struct block *block,
-                                                  const char *name,
-                                                  const domain_enum domain);
+extern struct symbol *block_lookup_symbol_primary
+     (const struct block *block,
+      const char *name,
+      const domain_search_flags domain);
 
 /* Find symbol NAME in BLOCK and in DOMAIN.  This will return a
    matching symbol whose type is not a "opaque", see TYPE_IS_OPAQUE.
@@ -584,7 +585,7 @@ extern struct symbol *block_lookup_symbol_primary (const struct block *block,
 
 extern struct symbol *block_find_symbol (const struct block *block,
                                         const lookup_name_info &name,
-                                        const domain_enum domain,
+                                        const domain_search_flags domain,
                                         struct symbol **stub);
 
 /* Given a vector of pairs, allocate and build an obstack allocated
index 8c0d86f68b5aafa60cddecbc7ad52a9088035866..fb85914805cf6bb777409ffb062058c259581625 100644 (file)
@@ -1087,9 +1087,10 @@ block    :       block COLONCOLON name
                          std::string copy = copy_name ($3);
                          struct symbol *tem
                            = lookup_symbol (copy.c_str (), $1,
-                                            VAR_DOMAIN, NULL).symbol;
+                                            SEARCH_FUNCTION_DOMAIN,
+                                            nullptr).symbol;
 
-                         if (!tem || tem->aclass () != LOC_BLOCK)
+                         if (tem == nullptr)
                            error (_("No function \"%s\" in specified context."),
                                   copy.c_str ());
                          $$ = tem->value_block (); }
@@ -1113,7 +1114,7 @@ variable: block COLONCOLON name
                          std::string copy = copy_name ($3);
                          struct block_symbol sym
                            = lookup_symbol (copy.c_str (), $1,
-                                            VAR_DOMAIN, NULL);
+                                            SEARCH_VFT, NULL);
 
                          if (sym.symbol == 0)
                            error (_("No symbol \"%s\" in specified context."),
@@ -1168,7 +1169,7 @@ variable: qualified_name
                          struct block_symbol sym
                            = lookup_symbol (name.c_str (),
                                             (const struct block *) NULL,
-                                            VAR_DOMAIN, NULL);
+                                            SEARCH_VFT, NULL);
                          pstate->push_symbol (name.c_str (), sym);
                        }
        ;
@@ -1833,7 +1834,7 @@ name_not_typename :       NAME
                          $$.sym
                            = lookup_symbol ($1.ptr,
                                             pstate->expression_context_block,
-                                            VAR_DOMAIN,
+                                            SEARCH_VFT,
                                             &is_a_field_of_this);
                          $$.is_a_field_of_this
                            = is_a_field_of_this.type != NULL;
@@ -2969,7 +2970,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
 
            if (lookup_symbol (copy.c_str (),
                               pstate->expression_context_block,
-                              VAR_DOMAIN,
+                              SEARCH_VFT,
                               (par_state->language ()->la_language
                                == language_cplus ? &is_a_field_of_this
                                : NULL)).symbol
@@ -3037,7 +3038,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
      we can refer to it unconditionally below.  */
   memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
 
-  bsym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN,
+  bsym = lookup_symbol (copy.c_str (), block, SEARCH_VFT,
                        par_state->language ()->name_of_this ()
                        ? &is_a_field_of_this : NULL);
 
@@ -3060,7 +3061,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
        {
          struct field_of_this_result inner_is_a_field_of_this;
 
-         bsym = lookup_symbol (copy.c_str (), block, STRUCT_DOMAIN,
+         bsym = lookup_symbol (copy.c_str (), block, SEARCH_STRUCT_DOMAIN,
                                &inner_is_a_field_of_this);
          if (bsym.symbol != NULL)
            {
@@ -3167,7 +3168,7 @@ classify_inner_name (struct parser_state *par_state,
   std::string copy = copy_name (yylval.ssym.stoken);
   /* N.B. We assume the symbol can only be in VAR_DOMAIN.  */
   yylval.ssym.sym = cp_lookup_nested_symbol (type, copy.c_str (), block,
-                                            VAR_DOMAIN);
+                                            SEARCH_VFT);
 
   /* If no symbol was found, search for a matching base class named
      COPY.  This will allow users to enter qualified names of class members
index 2dfbd05c52fe744f846a52a7d6bdddbc7f7bf6d2..ce711c4b4f66f5437c0baabae92540e80835f535 100644 (file)
@@ -1014,7 +1014,7 @@ public:
 
   struct block_symbol lookup_symbol_nonlocal
        (const char *name, const struct block *block,
-        const domain_enum domain) const override
+        const domain_search_flags domain) const override
   {
     return cp_lookup_symbol_nonlocal (this, name, block, domain);
   }
index 1731f0302a8ee825afaa23555a37bd28b3699472..8911a1696049f08d0f4f04129a7bbc79d9f3b6ef 100644 (file)
@@ -205,7 +205,7 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
            {
              const char *search_name = msymbol.minsym->search_name ();
              wsym = lookup_symbol_search_name (search_name, NULL,
-                                               VAR_DOMAIN).symbol;
+                                               SEARCH_VAR_DOMAIN).symbol;
            }
 
          if (wsym)
index 9e15709c4e541593f1158d012836787a1dc1a7e9..804a0a01377ebd5594ae85ee19a3d5d8a4dbf9cf 100644 (file)
@@ -210,7 +210,7 @@ convert_one_symbol (compile_c_instance *context,
 
 static void
 convert_symbol_sym (compile_c_instance *context, const char *identifier,
-                   struct block_symbol sym, domain_enum domain)
+                   struct block_symbol sym, domain_search_flags domain)
 {
   int is_local_symbol;
 
@@ -325,19 +325,19 @@ gcc_convert_symbol (void *datum,
 {
   compile_c_instance *context
     = static_cast<compile_c_instance *> (datum);
-  domain_enum domain;
+  domain_search_flags domain;
   int found = 0;
 
   switch (request)
     {
     case GCC_C_ORACLE_SYMBOL:
-      domain = VAR_DOMAIN;
+      domain = SEARCH_VFT;
       break;
     case GCC_C_ORACLE_TAG:
-      domain = STRUCT_DOMAIN;
+      domain = SEARCH_STRUCT_DOMAIN;
       break;
     case GCC_C_ORACLE_LABEL:
-      domain = LABEL_DOMAIN;
+      domain = SEARCH_LABEL_DOMAIN;
       break;
     default:
       gdb_assert_not_reached ("Unrecognized oracle request.");
@@ -355,7 +355,7 @@ gcc_convert_symbol (void *datum,
          convert_symbol_sym (context, identifier, sym, domain);
          found = 1;
        }
-      else if (domain == VAR_DOMAIN)
+      else if (request == GCC_C_ORACLE_SYMBOL)
        {
          struct bound_minimal_symbol bmsym;
 
@@ -398,8 +398,9 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
       struct symbol *sym;
 
       /* We only need global functions here.  */
-      sym = lookup_symbol (identifier, NULL, VAR_DOMAIN, NULL).symbol;
-      if (sym != NULL && sym->aclass () == LOC_BLOCK)
+      sym = lookup_symbol (identifier, nullptr, SEARCH_FUNCTION_DOMAIN,
+                          nullptr).symbol;
+      if (sym != nullptr)
        {
          if (compile_debug)
            gdb_printf (gdb_stdlog,
index dbdabe94e1e7d207353614dc47d4b06d17150577..9d8e801ba3a342fb4f9a27eac8ef0490259fec05 100644 (file)
@@ -227,7 +227,7 @@ convert_one_symbol (compile_cplus_instance *instance,
 static void
 convert_symbol_sym (compile_cplus_instance *instance,
                    const char *identifier, struct block_symbol sym,
-                   domain_enum domain)
+                   domain_search_flags domain)
 {
   /* If we found a symbol and it is not in the  static or global
      scope, then we should first convert any static or global scope
@@ -355,12 +355,12 @@ gcc_cplus_convert_symbol (void *datum,
         This will find variables in the current scope.  */
 
       struct block_symbol sym
-       = lookup_symbol (identifier, instance->block (), VAR_DOMAIN, nullptr);
+       = lookup_symbol (identifier, instance->block (), SEARCH_VFT, nullptr);
 
       if (sym.symbol != nullptr)
        {
          found = true;
-         convert_symbol_sym (instance, identifier, sym, VAR_DOMAIN);
+         convert_symbol_sym (instance, identifier, sym, SEARCH_VFT);
        }
 
       /* Then use linespec.c's multi-symbol search.  This should find
@@ -378,7 +378,7 @@ gcc_cplus_convert_symbol (void *datum,
            {
              found = true;
              convert_symbol_sym (instance, identifier, it,
-                                 it.symbol->domain ());
+                                 to_search_flags (it.symbol->domain ()));
            }
        }
 
@@ -437,9 +437,10 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
   try
     {
       struct symbol *sym
-       = lookup_symbol (identifier, nullptr, VAR_DOMAIN, nullptr).symbol;
+       = lookup_symbol (identifier, nullptr, SEARCH_FUNCTION_DOMAIN,
+                        nullptr).symbol;
 
-      if (sym != nullptr && sym->aclass () == LOC_BLOCK)
+      if (sym != nullptr)
        {
          if (compile_debug)
            gdb_printf (gdb_stdlog,
index 90ce3f15e143e7d28183660ffe040601e288385e..c8a2551535918c446f12c0dda31d7aa63560be7b 100644 (file)
@@ -154,7 +154,7 @@ type_name_to_scope (const char *type_name, const struct block *block)
 
       /* Look up the resulting name.  */
       struct block_symbol bsymbol
-       = lookup_symbol (lookup_name.c_str (), block, VAR_DOMAIN, nullptr);
+       = lookup_symbol (lookup_name.c_str (), block, SEARCH_VFT, nullptr);
 
       if (bsymbol.symbol != nullptr)
        {
@@ -384,7 +384,7 @@ compile_cplus_instance::new_scope (const char *type_name, struct type *type)
          scope_component comp
            = {
                decl_name (type->name ()).get (),
-               lookup_symbol (type->name (), block (), VAR_DOMAIN, nullptr)
+               lookup_symbol (type->name (), block (), SEARCH_VFT, nullptr)
              };
          scope.push_back (comp);
        }
@@ -617,7 +617,7 @@ compile_cplus_convert_struct_or_union_members
                const char *physname = type->field (i).loc_physname ();
                struct block_symbol sym
                  = lookup_symbol (physname, instance->block (),
-                                  VAR_DOMAIN, nullptr);
+                                  SEARCH_VFT, nullptr);
 
                if (sym.symbol == nullptr)
                  {
@@ -729,7 +729,7 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance,
          gcc_type method_type;
          struct block_symbol sym
            = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (methods, j),
-                            instance->block (), VAR_DOMAIN, nullptr);
+                            instance->block (), SEARCH_VFT, nullptr);
 
          if (sym.symbol == nullptr)
            {
index b2cc3a1a0427c24797dbb39c0f1ab3fcd5960d13..e26f0f46048a8e46f2c2b989934dffa66c66d4aa 100644 (file)
@@ -437,7 +437,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
       gdb_val_sym = block_lookup_symbol (block,
                                         COMPILE_I_EXPR_VAL,
                                         symbol_name_match_type::SEARCH_NAME,
-                                        VAR_DOMAIN);
+                                        SEARCH_VFT);
       if (gdb_val_sym == NULL)
        continue;
 
@@ -463,7 +463,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
 
   gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
                                          symbol_name_match_type::SEARCH_NAME,
-                                         VAR_DOMAIN);
+                                         SEARCH_VFT);
   if (gdb_ptr_type_sym == NULL)
     error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
   gdb_ptr_type = gdb_ptr_type_sym->type ();
@@ -652,7 +652,7 @@ compile_object_load (const compile_file_names &file_names,
   func_sym = lookup_global_symbol_from_objfile (objfile,
                                                GLOBAL_BLOCK,
                                                GCC_FE_WRAPPER_FUNCTION,
-                                               VAR_DOMAIN).symbol;
+                                               SEARCH_VFT).symbol;
   if (func_sym == NULL)
     error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
           GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
index a573b1410d3a724d5f55fc3a0e16180755ef05fa..593340af3506afdfbe1ca1a79af3ecfe8490a184 100644 (file)
@@ -42,7 +42,7 @@ static struct block_symbol
                             const char *nested_name,
                             const char *concatenated_name,
                             const struct block *block,
-                            const domain_enum domain,
+                            const domain_search_flags domain,
                             int basic_lookup, int is_in_anonymous);
 
 static struct type *cp_lookup_transparent_type_loop (const char *name,
@@ -129,7 +129,7 @@ cp_is_in_anonymous (const char *symbol_name)
 
 static struct block_symbol
 cp_basic_lookup_symbol (const char *name, const struct block *block,
-                       const domain_enum domain, int is_in_anonymous)
+                       const domain_search_flags domain, int is_in_anonymous)
 {
   struct block_symbol sym;
 
@@ -172,7 +172,7 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
 static struct block_symbol
 cp_lookup_bare_symbol (const struct language_defn *langdef,
                       const char *name, const struct block *block,
-                      const domain_enum domain, int search)
+                      const domain_search_flags domain, int search)
 {
   struct block_symbol sym;
 
@@ -192,7 +192,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
      shared libraries we could search all of them only to find out the
      builtin type isn't defined in any of them.  This is common for types
      like "void".  */
-  if (langdef != NULL && domain == VAR_DOMAIN)
+  if (langdef != nullptr && (domain & SEARCH_TYPE_DOMAIN) != 0)
     {
       struct gdbarch *gdbarch;
 
@@ -251,7 +251,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef,
 static struct block_symbol
 cp_search_static_and_baseclasses (const char *name,
                                  const struct block *block,
-                                 const domain_enum domain,
+                                 const domain_search_flags domain,
                                  unsigned int prefix_len,
                                  int is_in_anonymous)
 {
@@ -273,9 +273,9 @@ cp_search_static_and_baseclasses (const char *name,
      symbol_matches_domain (which should be replaced with something
      else, but it's what we have today).  */
   block_symbol scope_sym = lookup_symbol_in_static_block (scope.c_str (),
-                                                         block, VAR_DOMAIN);
+                                                         block, SEARCH_VFT);
   if (scope_sym.symbol == NULL)
-    scope_sym = lookup_global_symbol (scope.c_str (), block, VAR_DOMAIN);
+    scope_sym = lookup_global_symbol (scope.c_str (), block, SEARCH_VFT);
   if (scope_sym.symbol == NULL)
     return {};
 
@@ -285,9 +285,9 @@ cp_search_static_and_baseclasses (const char *name,
      static variable.  E.g., "print 'function()::static_var'".  */
   if ((scope_type->code () == TYPE_CODE_FUNC
        || scope_type->code () == TYPE_CODE_METHOD)
-      && domain == VAR_DOMAIN)
+      && (domain & SEARCH_VAR_DOMAIN) != 0)
     return lookup_symbol (nested, scope_sym.symbol->value_block (),
-                         VAR_DOMAIN, NULL);
+                         domain, NULL);
 
   /* Look for a symbol named NESTED in this class/namespace.
      The caller is assumed to have already have done a basic lookup of NAME.
@@ -308,7 +308,7 @@ cp_search_static_and_baseclasses (const char *name,
 static struct block_symbol
 cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
                               const struct block *block,
-                              const domain_enum domain, int search)
+                              const domain_search_flags domain, int search)
 {
   char *concatenated_name = NULL;
   int is_in_anonymous;
@@ -382,7 +382,7 @@ static void
 cp_lookup_symbol_via_imports (const char *scope,
                              const char *name,
                              const struct block *block,
-                             const domain_enum domain,
+                             const domain_search_flags domain,
                              const int search_scope_first,
                              const int declaration_only,
                              const int search_parents,
@@ -503,7 +503,7 @@ static struct block_symbol
 cp_lookup_symbol_via_imports (const char *scope,
                              const char *name,
                              const struct block *block,
-                             const domain_enum domain,
+                             const domain_search_flags domain,
                              const int declaration_only,
                              const int search_parents)
 {
@@ -560,13 +560,14 @@ struct block_symbol
 cp_lookup_symbol_imports_or_template (const char *scope,
                                      const char *name,
                                      const struct block *block,
-                                     const domain_enum domain)
+                                     const domain_search_flags domain)
 {
   struct symbol *function = block->function ();
 
   symbol_lookup_debug_printf
     ("cp_lookup_symbol_imports_or_template (%s, %s, %s, %s)",
-     scope, name, host_address_to_string (block), domain_name (domain));
+     scope, name, host_address_to_string (block),
+     domain_name (domain).c_str ());
 
   if (function != NULL && function->language () == language_cplus)
     {
@@ -646,7 +647,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
 static struct block_symbol
 cp_lookup_symbol_via_all_imports (const char *scope, const char *name,
                                  const struct block *block,
-                                 const domain_enum domain)
+                                 const domain_search_flags domain)
 {
   struct block_symbol sym;
 
@@ -671,13 +672,13 @@ struct block_symbol
 cp_lookup_symbol_namespace (const char *scope,
                            const char *name,
                            const struct block *block,
-                           const domain_enum domain)
+                           const domain_search_flags domain)
 {
   struct block_symbol sym;
 
   symbol_lookup_debug_printf ("cp_lookup_symbol_namespace (%s, %s, %s, %s)",
                              scope, name, host_address_to_string (block),
-                             domain_name (domain));
+                             domain_name (domain).c_str ());
 
   /* First, try to find the symbol in the given namespace.  */
   sym = cp_lookup_symbol_in_namespace (scope, name, block, domain, 1);
@@ -711,7 +712,7 @@ static struct block_symbol
 lookup_namespace_scope (const struct language_defn *langdef,
                        const char *name,
                        const struct block *block,
-                       const domain_enum domain,
+                       const domain_search_flags domain,
                        const char *scope,
                        int scope_len)
 {
@@ -768,14 +769,15 @@ struct block_symbol
 cp_lookup_symbol_nonlocal (const struct language_defn *langdef,
                           const char *name,
                           const struct block *block,
-                          const domain_enum domain)
+                          const domain_search_flags domain)
 {
   struct block_symbol sym;
   const char *scope = block == nullptr ? "" : block->scope ();
 
   symbol_lookup_debug_printf
     ("cp_lookup_symbol_non_local (%s, %s (scope %s), %s)",
-     name, host_address_to_string (block), scope, domain_name (domain));
+     name, host_address_to_string (block), scope,
+     domain_name (domain).c_str ());
 
   /* First, try to find the symbol in the given namespace, and all
      containing namespaces.  */
@@ -826,7 +828,8 @@ cp_find_type_baseclass_by_name (struct type *parent_type, const char *name)
 
 static struct block_symbol
 find_symbol_in_baseclass (struct type *parent_type, const char *name,
-                         const struct block *block, const domain_enum domain,
+                         const struct block *block,
+                         const domain_search_flags domain,
                          int is_in_anonymous)
 {
   int i;
@@ -869,7 +872,7 @@ cp_lookup_nested_symbol_1 (struct type *container_type,
                           const char *nested_name,
                           const char *concatenated_name,
                           const struct block *block,
-                          const domain_enum domain,
+                          const domain_search_flags domain,
                           int basic_lookup, int is_in_anonymous)
 {
   struct block_symbol sym;
@@ -933,7 +936,7 @@ struct block_symbol
 cp_lookup_nested_symbol (struct type *parent_type,
                         const char *nested_name,
                         const struct block *block,
-                        const domain_enum domain)
+                        const domain_search_flags domain)
 {
   /* type_name_or_error provides better error reporting using the
      original type.  */
@@ -948,7 +951,7 @@ cp_lookup_nested_symbol (struct type *parent_type,
       symbol_lookup_debug_printf ("cp_lookup_nested_symbol (%s, %s, %s, %s)",
                                  type_name != NULL ? type_name : "unnamed",
                                  nested_name, host_address_to_string (block),
-                                 domain_name (domain));
+                                 domain_name (domain).c_str ());
     }
 
   switch (parent_type->code ())
index 3ce2f131b258a1de33cd376614ed4f99538809fe..9a59d7632a15e013bd447ee994eaf18a5bd8342f 100644 (file)
@@ -151,7 +151,7 @@ inspect_type (struct demangle_parse_info *info,
 
   try
     {
-      sym = lookup_symbol (name, 0, VAR_DOMAIN, 0).symbol;
+      sym = lookup_symbol (name, 0, SEARCH_VFT, 0).symbol;
     }
   catch (const gdb_exception &except)
     {
@@ -505,7 +505,7 @@ replace_typedefs (struct demangle_parse_info *info,
              try
                {
                  sym = lookup_symbol (local_name.get (), 0,
-                                      VAR_DOMAIN, 0).symbol;
+                                      SEARCH_VFT, 0).symbol;
                }
              catch (const gdb_exception &except)
                {
@@ -1500,7 +1500,7 @@ cp_lookup_rtti_type (const char *name, const struct block *block)
 
   /* Use VAR_DOMAIN here as NAME may be a typedef.  PR 18141, 18417.
      Classes "live" in both STRUCT_DOMAIN and VAR_DOMAIN.  */
-  rtti_sym = lookup_symbol (name, block, VAR_DOMAIN, NULL).symbol;
+  rtti_sym = lookup_symbol (name, block, SEARCH_VFT, NULL).symbol;
 
   if (rtti_sym == NULL)
     {
index a50b111bab8fb4427b472a22d2d8b7b748989662..f95b6f0f0e298e249a197f86e0dbfbe763a1b2cb 100644 (file)
@@ -141,25 +141,25 @@ extern struct block_symbol cp_lookup_symbol_nonlocal
      (const struct language_defn *langdef,
       const char *name,
       const struct block *block,
-      const domain_enum domain);
+      const domain_search_flags domain);
 
 extern struct block_symbol
   cp_lookup_symbol_namespace (const char *the_namespace,
                              const char *name,
                              const struct block *block,
-                             const domain_enum domain);
+                             const domain_search_flags domain);
 
 extern struct block_symbol cp_lookup_symbol_imports_or_template
      (const char *scope,
       const char *name,
       const struct block *block,
-      const domain_enum domain);
+      const domain_search_flags domain);
 
 extern struct block_symbol
   cp_lookup_nested_symbol (struct type *parent_type,
                           const char *nested_name,
                           const struct block *block,
-                          const domain_enum domain);
+                          const domain_search_flags domain);
 
 struct type *cp_lookup_transparent_type (const char *name);
 
index 6f7beae0dacaa63b2eb804b58ea75471c7f85b32..620d900709c4a2775f3dad2174c5fe12b6bd6164 100644 (file)
@@ -444,7 +444,7 @@ PrimaryExpression:
                  /* Handle VAR, which could be local or global.  */
                  sym = lookup_symbol (copy.c_str (),
                                       pstate->expression_context_block,
-                                      VAR_DOMAIN, &is_a_field_of_this);
+                                      SEARCH_VFT, &is_a_field_of_this);
                  if (sym.symbol && sym.symbol->aclass () != LOC_TYPEDEF)
                    {
                      if (symbol_read_needs_frame (sym.symbol))
@@ -493,7 +493,7 @@ PrimaryExpression:
                              sym =
                                lookup_symbol (name.c_str (),
                                               (const struct block *) NULL,
-                                              VAR_DOMAIN, NULL);
+                                              SEARCH_VFT, NULL);
                              pstate->push_symbol (name.c_str (), sym);
                            }
                          else
@@ -1337,7 +1337,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
 
   std::string copy = copy_name (yylval.sval);
 
-  sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this);
+  sym = lookup_symbol (copy.c_str (), block, SEARCH_VFT, &is_a_field_of_this);
   if (sym.symbol && sym.symbol->aclass () == LOC_TYPEDEF)
     {
       yylval.tsym.type = sym.symbol->type ();
@@ -1346,9 +1346,11 @@ classify_name (struct parser_state *par_state, const struct block *block)
   else if (sym.symbol == NULL)
     {
       /* Look-up first for a module name, then a type.  */
-      sym = lookup_symbol (copy.c_str (), block, MODULE_DOMAIN, NULL);
+      sym = lookup_symbol (copy.c_str (), block, SEARCH_MODULE_DOMAIN,
+                          nullptr);
       if (sym.symbol == NULL)
-       sym = lookup_symbol (copy.c_str (), block, STRUCT_DOMAIN, NULL);
+       sym = lookup_symbol (copy.c_str (), block, SEARCH_STRUCT_DOMAIN,
+                            nullptr);
 
       if (sym.symbol != NULL)
        {
index 5b0307d44ac44bbc9dc2bde62bff75bb86168ad3..6af57062ef969f60aeb52a3e45004829f881d3a9 100644 (file)
@@ -171,7 +171,7 @@ public:
 
   struct block_symbol lookup_symbol_nonlocal
        (const char *name, const struct block *block,
-        const domain_enum domain) const override
+        const domain_search_flags domain) const override
   {
     return d_lookup_symbol_nonlocal (this, name, block, domain);
   }
index 1747ad90f2402f0367bc1b8fabdefb84a922afa4..ecf194d8155b029039761d824a5a9b1619d80cda 100644 (file)
@@ -69,10 +69,11 @@ extern const struct builtin_d_type *builtin_d_type (struct gdbarch *);
 
 /* Defined in d-namespace.c  */
 
-extern struct block_symbol d_lookup_symbol_nonlocal (const struct language_defn *,
-                                                    const char *,
-                                                    const struct block *,
-                                                    const domain_enum);
+extern struct block_symbol d_lookup_symbol_nonlocal
+     (const struct language_defn *,
+      const char *,
+      const struct block *,
+      const domain_search_flags);
 
 extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *,
                                                   const struct block *);
index c110cbda0570ae7c9b7e6f738730f54777c43ac6..3f8f7d8c24e1fadda1a0d23ffe168a0cc2635eec 100644 (file)
@@ -78,7 +78,7 @@ d_entire_prefix_len (const char *name)
 static struct block_symbol
 d_lookup_symbol (const struct language_defn *langdef,
                 const char *name, const struct block *block,
-                const domain_enum domain, int search)
+                const domain_search_flags domain, int search)
 {
   struct block_symbol sym;
 
@@ -88,7 +88,7 @@ d_lookup_symbol (const struct language_defn *langdef,
 
   /* If we didn't find a definition for a builtin type in the static block,
      such as "ucent" which is a specialist type, search for it now.  */
-  if (langdef != NULL && domain == VAR_DOMAIN)
+  if (langdef != nullptr && (domain & SEARCH_TYPE_DOMAIN) != 0)
     {
       struct gdbarch *gdbarch;
 
@@ -166,7 +166,7 @@ d_lookup_symbol (const struct language_defn *langdef,
 static struct block_symbol
 d_lookup_symbol_in_module (const char *module, const char *name,
                           const struct block *block,
-                          const domain_enum domain, int search)
+                          const domain_search_flags domain, int search)
 {
   char *concatenated_name = NULL;
 
@@ -198,7 +198,7 @@ d_lookup_symbol_in_module (const char *module, const char *name,
 static struct block_symbol
 lookup_module_scope (const struct language_defn *langdef,
                     const char *name, const struct block *block,
-                    const domain_enum domain, const char *scope,
+                    const domain_search_flags domain, const char *scope,
                     int scope_len)
 {
   char *module;
@@ -261,7 +261,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
 
       /* Search this particular base class.  */
       sym = d_lookup_symbol_in_module (base_name, name, block,
-                                      VAR_DOMAIN, 0);
+                                      SEARCH_VFT, 0);
       if (sym.symbol != NULL)
        break;
 
@@ -270,14 +270,14 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name,
         what we want is possibly there.  */
       std::string concatenated_name = std::string (base_name) + "." + name;
       sym = lookup_symbol_in_static_block (concatenated_name.c_str (), block,
-                                          VAR_DOMAIN);
+                                          SEARCH_VFT);
       if (sym.symbol != NULL)
        break;
 
       /* Nope.  We now have to search all static blocks in all objfiles,
         even if block != NULL, because there's no guarantees as to which
         symtab the symbol we want is in.  */
-      sym = lookup_static_symbol (concatenated_name.c_str (), VAR_DOMAIN);
+      sym = lookup_static_symbol (concatenated_name.c_str (), SEARCH_VFT);
       if (sym.symbol != NULL)
        break;
 
@@ -320,7 +320,7 @@ d_lookup_nested_symbol (struct type *parent_type,
          const char *parent_name = type_name_or_error (saved_parent_type);
          struct block_symbol sym
            = d_lookup_symbol_in_module (parent_name, nested_name,
-                                        block, VAR_DOMAIN, 0);
+                                        block, SEARCH_VFT, 0);
          char *concatenated_name;
 
          if (sym.symbol != NULL)
@@ -337,7 +337,7 @@ d_lookup_nested_symbol (struct type *parent_type,
          xsnprintf (concatenated_name, size, "%s.%s",
                     parent_name, nested_name);
 
-         sym = lookup_static_symbol (concatenated_name, VAR_DOMAIN);
+         sym = lookup_static_symbol (concatenated_name, SEARCH_VFT);
          if (sym.symbol != NULL)
            return sym;
 
@@ -361,7 +361,7 @@ d_lookup_nested_symbol (struct type *parent_type,
 static struct block_symbol
 d_lookup_symbol_imports (const char *scope, const char *name,
                         const struct block *block,
-                        const domain_enum domain)
+                        const domain_search_flags domain)
 {
   struct using_direct *current;
   struct block_symbol sym;
@@ -473,7 +473,7 @@ d_lookup_symbol_imports (const char *scope, const char *name,
 static struct block_symbol
 d_lookup_symbol_module (const char *scope, const char *name,
                        const struct block *block,
-                       const domain_enum domain)
+                       const domain_search_flags domain)
 {
   struct block_symbol sym;
 
@@ -509,7 +509,7 @@ struct block_symbol
 d_lookup_symbol_nonlocal (const struct language_defn *langdef,
                          const char *name,
                          const struct block *block,
-                         const domain_enum domain)
+                         const domain_search_flags domain)
 {
   struct block_symbol sym;
   const char *scope = block == nullptr ? "" : block->scope ();
index 7654c05742e49aa589b382ac5d59b33e322c2de8..21f81bbcdea0e648a42169ac16a6b84145e718b7 100644 (file)
@@ -103,7 +103,7 @@ ada_alias_get_block_value (const struct symbol *sym)
 {
   const char *name = get_imported_name (sym);
   block_symbol real_symbol = lookup_global_symbol (name, nullptr,
-                                                  VAR_DOMAIN);
+                                                  SEARCH_VFT);
   if (real_symbol.symbol == nullptr)
     error (_("could not find alias '%s' for function '%s'"),
           name, sym->print_name ());
index 1be5246e7a3fa42bda24d898120bffa9dcecc335..72197d8d5a589c095bd08e18c3d4592a25379ff3 100644 (file)
@@ -624,7 +624,7 @@ func_get_frame_base_dwarf_block (struct symbol *framefunc, CORE_ADDR pc,
 value *
 compute_var_value (const char *name)
 {
-  struct block_symbol sym = lookup_symbol (name, nullptr, VAR_DOMAIN,
+  struct block_symbol sym = lookup_symbol (name, nullptr, SEARCH_VAR_DOMAIN,
                                           nullptr);
   if (sym.symbol != nullptr)
     return value_of_variable (sym.symbol, sym.block);
index 1529063b7a99f3c3d65b645e178125a3808be0ca..9b8091a65111f0e3a977e719daec7184833b45b7 100644 (file)
@@ -730,7 +730,7 @@ scope_operation::evaluate_funcall (struct type *expect_type,
       function = cp_lookup_symbol_namespace (type->name (),
                                             name.c_str (),
                                             get_selected_block (0),
-                                            VAR_DOMAIN).symbol;
+                                            SEARCH_FUNCTION_DOMAIN).symbol;
       if (function == NULL)
        error (_("No symbol \"%s\" in namespace \"%s\"."),
               name.c_str (), type->name ());
@@ -1106,7 +1106,8 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp,
 {
   CORE_ADDR addr = func->address ();
   const block *blk = block_for_pc (addr);
-  struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL);
+  struct block_symbol sym = lookup_symbol (var, blk, SEARCH_VAR_DOMAIN,
+                                          nullptr);
   if (sym.symbol == NULL)
     error (_("No symbol \"%s\" in specified context."), var);
   return evaluate_var_value (noside, sym.block, sym.symbol);
index 7e45069c67e841ceb4bce685e075e3fdd53aff13..faa53ba9dd0eb432e088b63015c1c3a219bd83fc 100644 (file)
@@ -1640,11 +1640,11 @@ yylex (void)
   {
     std::string tmp = copy_name (yylval.sval);
     struct block_symbol result;
-    const domain_enum lookup_domains[] =
+    const domain_search_flags lookup_domains[] =
     {
-      STRUCT_DOMAIN,
-      VAR_DOMAIN,
-      MODULE_DOMAIN
+      SEARCH_STRUCT_DOMAIN,
+      SEARCH_VFT,
+      SEARCH_MODULE_DOMAIN
     };
     int hextype;
 
index c35c73a0eb7c13c94ebad84da9694ce26814bc9c..d573c4f2fbb81ce34d3fb37ef846dbd96685fea3 100644 (file)
@@ -1715,7 +1715,7 @@ f_language::search_name_hash (const char *name) const
 struct block_symbol
 f_language::lookup_symbol_nonlocal (const char *name,
                                    const struct block *block,
-                                   const domain_enum domain) const
+                                   const domain_search_flags domain) const
 {
   return cp_lookup_symbol_nonlocal (this, name, block, domain);
 }
index 3126146c607b8028cbb76789cddfdb7a35528233..c2034258513adf4599081c490726a3f1b1923d7c 100644 (file)
@@ -142,7 +142,7 @@ public:
 
   struct block_symbol lookup_symbol_nonlocal
        (const char *name, const struct block *block,
-        const domain_enum domain) const override;
+        const domain_search_flags domain) const override;
 
   /* See language.h.  */
 
index f15ae7e8fb62212c8d1725cb4c602efb9d694062..19bcd746208adc39ff07635375504b8fecc31d1c 100644 (file)
@@ -552,7 +552,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
                     value field before printing its value.  */
                  struct block_symbol sym
                    = lookup_symbol (field_name, get_selected_block (nullptr),
-                                    VAR_DOMAIN, nullptr);
+                                    SEARCH_VFT, nullptr);
                  if (sym.symbol == nullptr)
                    error (_("failed to find symbol for name list component %s"),
                           field_name);
index 5bcd5a744f149d05e7cd3ccff9469b43aed28eb9..d8fae0786f877241cf06171d282678ae40798095 100644 (file)
@@ -1960,8 +1960,9 @@ fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
     {
       /* Fetch offsets from debug symbols in rtld.  */
       struct symbol *obj_entry_sym
-       = lookup_symbol_in_language ("Struct_Obj_Entry", NULL, STRUCT_DOMAIN,
-                                    language_c, NULL).symbol;
+       = lookup_symbol_in_language ("Struct_Obj_Entry", nullptr,
+                                    SEARCH_STRUCT_DOMAIN,
+                                    language_c, nullptr).symbol;
       if (obj_entry_sym == NULL)
        error (_("Unable to find Struct_Obj_Entry symbol"));
       data->off_linkmap = lookup_struct_elt (obj_entry_sym->type (),
index 29cda7da74953746a35475febefa28cc261d1760..9e286a4272bf1e7b091a9bfaf9bf4ec88deb6f63 100644 (file)
@@ -2559,7 +2559,8 @@ inside_main_func (frame_info_ptr this_frame)
       /* In some language (for example Fortran) there will be no minimal
         symbol with the name of the main function.  In this case we should
         search the full symbols to see if we can find a match.  */
-      struct block_symbol bs = lookup_symbol (name, NULL, VAR_DOMAIN, 0);
+      struct block_symbol bs = lookup_symbol (name, nullptr,
+                                             SEARCH_VFT, nullptr);
 
       /* We might have found some unrelated symbol.  For example, the
         Rust compiler can emit both a subprogram and a namespace with
index 9484f9e843f5b3530ebf0f14675b566c7ebf5edb..069d40f56fb200d94eebdcc001a913f99f497da0 100644 (file)
@@ -297,7 +297,8 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          plg_end = ft32_analyze_prologue (func_addr,
                                           func_end, &cache, gdbarch);
          /* Found a function.  */
-         sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
+         sym = lookup_symbol (func_name, nullptr, SEARCH_FUNCTION_DOMAIN,
+                              nullptr).symbol;
          /* Don't use line number debug info for assembly source files.  */
          if ((sym != NULL) && sym->language () != language_asm)
            {
index 1dc68a99104f81cbb64a138214de42f71f4f629b..f4eff650799b635b8fd7d4ccd63fa78693487863 100644 (file)
@@ -1655,7 +1655,7 @@ lookup_typename (const struct language_defn *language,
 {
   struct symbol *sym;
 
-  sym = lookup_symbol_in_language (name, block, VAR_DOMAIN,
+  sym = lookup_symbol_in_language (name, block, SEARCH_VFT,
                                   language->la_language, NULL).symbol;
   if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
     {
@@ -1699,7 +1699,7 @@ lookup_struct (const char *name, const struct block *block)
 {
   struct symbol *sym;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
+  sym = lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN, 0).symbol;
 
   if (sym == NULL)
     {
@@ -1722,7 +1722,7 @@ lookup_union (const char *name, const struct block *block)
   struct symbol *sym;
   struct type *t;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
+  sym = lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN, 0).symbol;
 
   if (sym == NULL)
     error (_("No union type named %s."), name);
@@ -1745,7 +1745,7 @@ lookup_enum (const char *name, const struct block *block)
 {
   struct symbol *sym;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
+  sym = lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN, 0).symbol;
   if (sym == NULL)
     {
       error (_("No enum type named %s."), name);
@@ -1772,7 +1772,8 @@ lookup_template_type (const char *name, struct type *type,
   nam += type->name ();
   nam += " >"; /* FIXME, extra space still introduced in gcc?  */
 
-  symbol *sym = lookup_symbol (nam.c_str (), block, VAR_DOMAIN, 0).symbol;
+  symbol *sym = lookup_symbol (nam.c_str (), block,
+                              SEARCH_STRUCT_DOMAIN, 0).symbol;
 
   if (sym == NULL)
     {
@@ -2994,7 +2995,8 @@ check_typedef (struct type *type)
              stub_noname_complaint ();
              return make_qualified_type (type, instance_flags, NULL);
            }
-         sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
+         sym = lookup_symbol (name, nullptr, SEARCH_STRUCT_DOMAIN,
+                              nullptr).symbol;
          if (sym)
            type->set_target_type (sym->type ());
          else                                  /* TYPE_CODE_UNDEF */
@@ -3084,7 +3086,8 @@ check_typedef (struct type *type)
          stub_noname_complaint ();
          return make_qualified_type (type, instance_flags, NULL);
        }
-      sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0).symbol;
+      sym = lookup_symbol (name, nullptr, SEARCH_STRUCT_DOMAIN,
+                          nullptr).symbol;
       if (sym)
        {
          /* Same as above for opaque types, we can replace the stub
index de6d21ae2c3ead8b6257e3c5ac7e4bfa2892e04a..faefe92594364aa4e087e6447e592a228f38a340 100644 (file)
@@ -1079,7 +1079,7 @@ gnuv3_get_typeid_type (struct gdbarch *gdbarch)
   struct symbol *typeinfo;
   struct type *typeinfo_type;
 
-  typeinfo = lookup_symbol ("std::type_info", NULL, STRUCT_DOMAIN,
+  typeinfo = lookup_symbol ("std::type_info", NULL, SEARCH_STRUCT_DOMAIN,
                            NULL).symbol;
   if (typeinfo == NULL)
     {
index 0b17ea42ff328b9fb76f7f07137f5c03bbf95f4c..a3afbbb8514a7c4add3322c5e81d54d274119401 100644 (file)
@@ -1293,7 +1293,8 @@ package_name_p (const char *name, const struct block *block)
   struct symbol *sym;
   struct field_of_this_result is_a_field_of_this;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol;
+  sym = lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN,
+                      &is_a_field_of_this).symbol;
 
   if (sym
       && sym->aclass () == LOC_TYPEDEF
@@ -1335,7 +1336,7 @@ classify_packaged_name (const struct block *block)
 
   std::string copy = copy_name (yylval.sval);
 
-  sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this);
+  sym = lookup_symbol (copy.c_str (), block, SEARCH_VFT, &is_a_field_of_this);
 
   if (sym.symbol)
     {
@@ -1378,7 +1379,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
 
   /* TODO: What about other types?  */
 
-  sym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN, &is_a_field_of_this);
+  sym = lookup_symbol (copy.c_str (), block, SEARCH_VFT, &is_a_field_of_this);
 
   if (sym.symbol)
     {
@@ -1403,7 +1404,7 @@ classify_name (struct parser_state *par_state, const struct block *block)
                               strlen (current_package_name.get ()),
                               copy.c_str (), copy.size ());
 
-       sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
+       sym = lookup_symbol (sval.ptr, block, SEARCH_VFT,
                             &is_a_field_of_this);
        if (sym.symbol)
          {
index 60bacdd7320b34fc92c2a8d1498d9d384f2b5ea3..b133e8de11d65afed67f15236a957cbfc4fcb25f 100644 (file)
@@ -937,7 +937,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
 
            if (block == NULL)
              block = get_frame_block (frame_info_ptr (frame), NULL);
-           lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN,
+           lookup_sym = lookup_symbol (var_name.get (), block, SEARCH_VFT,
                                        NULL);
            var = lookup_sym.symbol;
            block = lookup_sym.block;
index bf5fe24f23dea74b058efd527127642c388632c6..7061ff5887298f17e685131bf606da0452d87c89 100644 (file)
@@ -617,7 +617,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
   gdbscm_gdb_exception except {};
   try
     {
-      symbol = lookup_symbol (name, block, (domain_enum) domain,
+      domain_search_flags flags = from_scripting_domain (domain);
+      symbol = lookup_symbol (name, block, flags,
                              &is_a_field_of_this).symbol;
     }
   catch (const gdb_exception &ex)
@@ -654,7 +655,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
 
   try
     {
-      symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
+      domain_search_flags flags = from_scripting_domain (domain);
+      symbol = lookup_global_symbol (name, NULL, flags).symbol;
     }
   catch (const gdb_exception &ex)
     {
@@ -696,14 +698,15 @@ static const scheme_integer_constant symbol_integer_constants[] =
 #undef X
 
 #define DOMAIN(X) \
-  { "SYMBOL_" #X "_DOMAIN", X ## _DOMAIN },
+  { "SYMBOL_" #X "_DOMAIN", to_scripting_domain (X ## _DOMAIN) },      \
+  { "SEARCH_" #X "_DOMAIN", to_scripting_domain (SEARCH_ ## X ## _DOMAIN) },
 #include "sym-domains.def"
 #undef DOMAIN
 
-  /* These were never correct.  */
-  { "SYMBOL_VARIABLES_DOMAIN", VAR_DOMAIN },
-  { "SYMBOL_FUNCTIONS_DOMAIN", VAR_DOMAIN },
-  { "SYMBOL_TYPES_DOMAIN", VAR_DOMAIN },
+  /* Historical.  */
+  { "SYMBOL_VARIABLES_DOMAIN", to_scripting_domain (SEARCH_VAR_DOMAIN) },
+  { "SYMBOL_FUNCTIONS_DOMAIN", to_scripting_domain (SEARCH_FUNCTION_DOMAIN) },
+  { "SYMBOL_TYPES_DOMAIN", to_scripting_domain (SEARCH_TYPE_DOMAIN) },
 
   END_INTEGER_CONSTANTS
 };
index e99a1a8307076c9d711d49fee216d96462431278..8ccaf3326dc6a5606f2212ebab5f2e1eec0d8fb1 100644 (file)
@@ -8831,7 +8831,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
       struct breakpoint *bp;
 
       vsym = lookup_symbol_search_name (sym->search_name (),
-                                       b, VAR_DOMAIN);
+                                       b, SEARCH_VAR_DOMAIN);
       value = read_var_value (vsym.symbol, vsym.block, frame);
       /* If the value was optimized out, revert to the old behavior.  */
       if (! value->optimized_out ())
index 038559a34bf6d833a504ca886ed95539d19a5642..d6f6831c190924f0337c04f69f3d2c21ea15166e 100644 (file)
@@ -944,7 +944,8 @@ language_arch_info::bool_type () const
     {
       struct symbol *sym;
 
-      sym = lookup_symbol (m_bool_type_name, NULL, VAR_DOMAIN, NULL).symbol;
+      sym = lookup_symbol (m_bool_type_name, nullptr, SEARCH_TYPE_DOMAIN,
+                          nullptr).symbol;
       if (sym != nullptr)
        {
          struct type *type = sym->type ();
index 14a1ef6d4724227d37d69eb25f4d2e23541a443b..5bef965c2c8648676e8ca44e3190d7524562dc10 100644 (file)
@@ -513,7 +513,7 @@ struct language_defn
   virtual struct block_symbol lookup_symbol_nonlocal
        (const char *name,
         const struct block *block,
-        const domain_enum domain) const;
+        const domain_search_flags domain) const;
 
   /* Return an expression that can be used for a location
      watchpoint.  TYPE is a pointer type that points to the memory
index b9aca3cc6cebbf94945cecd4f4c6da4ddebf4625..4e43bf28a67617d90424eaeccb0ec40ab3fdb519 100644 (file)
@@ -3923,7 +3923,7 @@ find_label_symbols_in_block (const struct block *block,
 
       for (struct symbol *sym : block_iterator_range (block))
        {
-         if (sym->matches (LABEL_DOMAIN)
+         if (sym->domain () == LABEL_DOMAIN
              && cmp (sym->search_name (), name, name_len) == 0)
            {
              result->push_back ({sym, block});
@@ -3934,7 +3934,7 @@ find_label_symbols_in_block (const struct block *block,
   else
     {
       struct block_symbol label_sym
-       = lookup_symbol (name, block, LABEL_DOMAIN, 0);
+       = lookup_symbol (name, block, SEARCH_LABEL_DOMAIN, 0);
 
       if (label_sym.symbol != NULL)
        {
index 67252ef5684ed03631e8a070faa151018821fa5b..ce5a399477d401de2df80fb2edd69b92aa5eb7d8 100644 (file)
@@ -494,7 +494,7 @@ fblock      :       BLOCKNAME
                        { struct symbol *sym
                            = lookup_symbol (copy_name ($1).c_str (),
                                             pstate->expression_context_block,
-                                            VAR_DOMAIN, 0).symbol;
+                                            SEARCH_VFT, 0).symbol;
                          $$ = sym;}
        ;
                             
@@ -503,7 +503,7 @@ fblock      :       BLOCKNAME
 fblock :       block COLONCOLON BLOCKNAME
                        { struct symbol *tem
                            = lookup_symbol (copy_name ($3).c_str (), $1,
-                                            VAR_DOMAIN, 0).symbol;
+                                            SEARCH_VFT, 0).symbol;
                          if (!tem || tem->aclass () != LOC_BLOCK)
                            error (_("No function \"%s\" in specified context."),
                                   copy_name ($3).c_str ());
@@ -528,7 +528,7 @@ variable:   DOLLAR_VARIABLE
 variable:      block COLONCOLON NAME
                        { struct block_symbol sym
                            = lookup_symbol (copy_name ($3).c_str (), $1,
-                                            VAR_DOMAIN, 0);
+                                            SEARCH_VFT, 0);
 
                          if (sym.symbol == 0)
                            error (_("No symbol \"%s\" in specified context."),
@@ -549,7 +549,7 @@ variable:   NAME
                          sym
                            = lookup_symbol (name.c_str (),
                                             pstate->expression_context_block,
-                                            VAR_DOMAIN,
+                                            SEARCH_VFT,
                                             &is_a_field_of_this);
 
                          pstate->push_symbol (name.c_str (), sym);
@@ -927,7 +927,7 @@ yylex (void)
     if (lookup_symtab (tmp.c_str ()))
       return BLOCKNAME;
     sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
-                        VAR_DOMAIN, 0).symbol;
+                        SEARCH_VFT, 0).symbol;
     if (sym && sym->aclass () == LOC_BLOCK)
       return BLOCKNAME;
     if (lookup_typename (pstate->language (),
index 3cd9e09745805dd910bdea999693a79f9df57a75..d80739b1f39678e152ae98564ce73ecbeed2d366 100644 (file)
@@ -636,8 +636,9 @@ list_args_or_locals (const frame_print_options &fp_opts,
              struct frame_arg arg, entryarg;
 
              if (sym->is_argument ())
-               sym2 = lookup_symbol_search_name (sym->search_name (),
-                                                 block, VAR_DOMAIN).symbol;
+               sym2 = (lookup_symbol_search_name
+                       (sym->search_name (),
+                        block, SEARCH_VAR_DOMAIN).symbol);
              else
                sym2 = sym;
              gdb_assert (sym2 != NULL);
index 223cf09a561d792f9ca71380988053dc9fdeea86..4a80355ada55484d3551852da1465247054df64a 100644 (file)
@@ -226,7 +226,8 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
          plg_end = moxie_analyze_prologue (func_addr, 
                                            func_end, &cache, gdbarch);
          /* Found a function.  */
-         sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
+         sym = lookup_symbol (func_name, nullptr,
+                              SEARCH_FUNCTION_DOMAIN, nullptr).symbol;
          /* Don't use line number debug info for assembly source
             files.  */
          if (sym && sym->language () != language_asm)
index 10eb73a95cb289e55a0bccf4684c2c589658e821..2424e1e8530d8614518d848c7317f439e6dcaee7 100644 (file)
@@ -87,7 +87,7 @@ lookup_struct_typedef (const char *name, const struct block *block, int noerr)
 {
   struct symbol *sym;
 
-  sym = lookup_symbol (name, block, STRUCT_DOMAIN, 0).symbol;
+  sym = lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN, 0).symbol;
 
   if (sym == NULL)
     {
@@ -1129,7 +1129,7 @@ find_imps (const char *method, std::vector<const char *> *symbol_names)
      add the selector itself as a symbol, if it exists.  */
   if (selector_case && !symbol_names->empty ())
     {
-      struct symbol *sym = lookup_symbol (selector, NULL, VAR_DOMAIN,
+      struct symbol *sym = lookup_symbol (selector, NULL, SEARCH_VFT,
                                          0).symbol;
 
       if (sym != NULL) 
index 64f2b5ef6befb10690e29c9ce148eb4e6fada689..98e2355f7a96d96de09d6775c9c98b014e553257 100644 (file)
@@ -562,7 +562,7 @@ public:
      contains !TYPE_OPAQUE symbol prefer its compunit.  If it contains
      only TYPE_OPAQUE symbol(s), return at least that compunit.  */
   struct compunit_symtab *lookup_symbol (block_enum kind, const char *name,
-                                        domain_enum domain);
+                                        domain_search_flags domain);
 
   /* See quick_symbol_functions.  */
   void print_stats (bool print_bcache);
index 2b5eb6f30268c1e1eb127634c31c8316920e84b4..ea7eb8c8d7e1d517701b52eba6c18547a31c9b73 100644 (file)
@@ -629,9 +629,10 @@ block      :       block COLONCOLON name
                          std::string copy = copy_name ($3);
                          struct symbol *tem
                            = lookup_symbol (copy.c_str (), $1,
-                                            VAR_DOMAIN, NULL).symbol;
+                                            SEARCH_FUNCTION_DOMAIN,
+                                            nullptr).symbol;
 
-                         if (!tem || tem->aclass () != LOC_BLOCK)
+                         if (tem == nullptr)
                            error (_("No function \"%s\" in specified context."),
                                   copy.c_str ());
                          $$ = tem->value_block (); }
@@ -642,7 +643,7 @@ variable:   block COLONCOLON name
 
                          std::string copy = copy_name ($3);
                          sym = lookup_symbol (copy.c_str (), $1,
-                                              VAR_DOMAIN, NULL);
+                                              SEARCH_VFT, NULL);
                          if (sym.symbol == 0)
                            error (_("No symbol \"%s\" in specified context."),
                                   copy.c_str ());
@@ -672,7 +673,7 @@ variable:   qualified_name
 
                          struct block_symbol sym
                            = lookup_symbol (name.c_str (), nullptr,
-                                            VAR_DOMAIN, nullptr);
+                                            SEARCH_VFT, nullptr);
                          pstate->push_symbol (name.c_str (), sym);
                        }
        ;
@@ -1400,7 +1401,7 @@ yylex (void)
          static const char this_name[] = "this";
 
          if (lookup_symbol (this_name, pstate->expression_context_block,
-                            VAR_DOMAIN, NULL).symbol)
+                            SEARCH_VFT, NULL).symbol)
            {
              free (uptokstart);
              return THIS;
@@ -1440,7 +1441,7 @@ yylex (void)
       sym = NULL;
     else
       sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
-                          VAR_DOMAIN, &is_a_field_of_this).symbol;
+                          SEARCH_VFT, &is_a_field_of_this).symbol;
     /* second chance uppercased (as Free Pascal does).  */
     if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
       {
@@ -1456,7 +1457,7 @@ yylex (void)
         sym = NULL;
        else
         sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
-                             VAR_DOMAIN, &is_a_field_of_this).symbol;
+                             SEARCH_VFT, &is_a_field_of_this).symbol;
       }
     /* Third chance Capitalized (as GPC does).  */
     if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
@@ -1479,7 +1480,7 @@ yylex (void)
         sym = NULL;
        else
         sym = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
-                             VAR_DOMAIN, &is_a_field_of_this).symbol;
+                             SEARCH_VFT, &is_a_field_of_this).symbol;
       }
 
     if (is_a_field || (is_a_field_of_this.type != NULL))
@@ -1576,7 +1577,7 @@ yylex (void)
                      cur_sym
                        = lookup_symbol (ncopy,
                                         pstate->expression_context_block,
-                                        VAR_DOMAIN, NULL).symbol;
+                                        SEARCH_VFT, NULL).symbol;
                      if (cur_sym)
                        {
                          if (cur_sym->aclass () == LOC_TYPEDEF)
index 076ee08ab6e5aeb4002eb09f7f652b05b41f6275..2372cdf83ebf516baee51fc04a3c910c2aa1820b 100644 (file)
@@ -253,7 +253,7 @@ pascal_language::value_print_inner (struct value *val,
                {
                  const char *search_name = msymbol.minsym->search_name ();
                  wsym = lookup_symbol_search_name (search_name, NULL,
-                                                   VAR_DOMAIN).symbol;
+                                                   SEARCH_VFT).symbol;
                }
 
              if (wsym)
index 9209e3d8fa2d959098e39e20d0d0137a90ae0fa6..4b0eeaf5330557c42c3b5faffeb787997d905058 100644 (file)
@@ -225,7 +225,8 @@ parser_state::push_dollar (struct stoken str)
   /* On some systems, such as HP-UX and hppa-linux, certain system routines
      have names beginning with $ or $$.  Check for those, first.  */
 
-  sym = lookup_symbol (copy.c_str (), NULL, VAR_DOMAIN, NULL);
+  sym = lookup_symbol (copy.c_str (), nullptr,
+                      SEARCH_VAR_DOMAIN | SEARCH_FUNCTION_DOMAIN, nullptr);
   if (sym.symbol)
     {
       push_new<expr::var_value_operation> (sym);
index f4c79ed6d2470c92c39e5e106af50a5b79c5f56d..7f47f489a9430fdd09ec6cf7416c8ca092d5cd41 100644 (file)
@@ -1582,7 +1582,7 @@ info_address_command (const char *exp, int from_tty)
   if (exp == 0)
     error (_("Argument required."));
 
-  sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN,
+  sym = lookup_symbol (exp, get_selected_block (&context_pc), SEARCH_VFT,
                       &is_a_field_of_this).symbol;
   if (sym == NULL)
     {
index eb031d33f0d3e4fe55a66969d47727f18eb554c9..cb7a397afb1dba1636b32b3e3cd492d2387f37cb 100644 (file)
@@ -1507,7 +1507,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
 
                  sym = block_lookup_symbol (b, psym->ginfo.search_name (),
                                             symbol_name_match_type::SEARCH_NAME,
-                                            psym->domain);
+                                            to_search_flags (psym->domain));
                  if (!sym)
                    {
                      gdb_printf ("Static symbol `");
@@ -1522,7 +1522,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
                {
                  sym = block_lookup_symbol (b, psym->ginfo.search_name (),
                                             symbol_name_match_type::SEARCH_NAME,
-                                            psym->domain);
+                                            to_search_flags (psym->domain));
                  if (!sym)
                    {
                      gdb_printf ("Global symbol `");
index 95f15e00436bd576905766d1d7b014c4d0960bd6..a1061fc0d729ebdbc6645b2f78bfb07648458df5 100644 (file)
@@ -532,7 +532,8 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw)
 
          if (!block)
            block = get_frame_block (frame, NULL);
-         lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL);
+         lookup_sym = lookup_symbol (var_name.get (), block,
+                                     SEARCH_VFT, nullptr);
          var = lookup_sym.symbol;
          block = lookup_sym.block;
        }
index a3e55ffa3ebf0e24a11eb5037c1daf93c3f9ab09..ffdb7be4a9a1f2c1f1442de099781421c9ca3d34 100644 (file)
@@ -479,8 +479,9 @@ objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
+      domain_search_flags flags = from_scripting_domain (domain);
       struct symbol *sym = lookup_global_symbol_from_objfile
-       (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol;
+       (obj->objfile, GLOBAL_BLOCK, symbol_name, flags).symbol;
       if (sym == nullptr)
        Py_RETURN_NONE;
 
@@ -513,8 +514,9 @@ objfpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
+      domain_search_flags flags = from_scripting_domain (domain);
       struct symbol *sym = lookup_global_symbol_from_objfile
-       (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol;
+       (obj->objfile, STATIC_BLOCK, symbol_name, flags).symbol;
       if (sym == nullptr)
        Py_RETURN_NONE;
 
index a7d010f6d0c7d1e48e76405d6d2a0ecbb0fd926f..2fb68377bad462de6bfec4be874de4c186ab2294 100644 (file)
@@ -432,8 +432,8 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
-      symbol = lookup_symbol (name, block, (domain_enum) domain,
-                             &is_a_field_of_this).symbol;
+      domain_search_flags flags = from_scripting_domain (domain);
+      symbol = lookup_symbol (name, block, flags, &is_a_field_of_this).symbol;
     }
   catch (const gdb_exception &except)
     {
@@ -481,7 +481,8 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
-      symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol;
+      domain_search_flags flags = from_scripting_domain (domain);
+      symbol = lookup_global_symbol (name, NULL, flags).symbol;
     }
   catch (const gdb_exception &except)
     {
@@ -542,13 +543,14 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
+      domain_search_flags flags = from_scripting_domain (domain);
+
       if (block != nullptr)
        symbol
-         = lookup_symbol_in_static_block (name, block,
-                                          (domain_enum) domain).symbol;
+         = lookup_symbol_in_static_block (name, block, flags).symbol;
 
       if (symbol == nullptr)
-       symbol = lookup_static_symbol (name, (domain_enum) domain).symbol;
+       symbol = lookup_static_symbol (name, flags).symbol;
     }
   catch (const gdb_exception &except)
     {
@@ -592,6 +594,8 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
 
   try
     {
+      domain_search_flags flags = from_scripting_domain (domain);
+
       /* Expand any symtabs that contain potentially matching symbols.  */
       lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
       expand_symtabs_matching (NULL, lookup_name, NULL, NULL,
@@ -613,7 +617,7 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw)
              if (block != nullptr)
                {
                  symbol *symbol = lookup_symbol_in_static_block
-                   (name, block, (domain_enum) domain).symbol;
+                   (name, block, flags).symbol;
 
                  if (symbol != nullptr)
                    {
@@ -675,7 +679,9 @@ gdbpy_initialize_symbols (void)
 
 #define DOMAIN(X)                                                      \
   if (PyModule_AddIntConstant (gdb_module, "SYMBOL_" #X "_DOMAIN",     \
-                              X ## _DOMAIN) < 0)                       \
+                              to_scripting_domain (X ## _DOMAIN)) < 0  \
+      || PyModule_AddIntConstant (gdb_module, "SEARCH_" #X "_DOMAIN",  \
+                                 to_scripting_domain (SEARCH_ ## X ## _DOMAIN)) < 0) \
     return -1;
 #include "sym-domains.def"
 #undef DOMAIN
index ff1769c729657b9a24fa94ef0ed2d7b79647c528..11c7f13417ddb82309b868fb4f892f77680b4493 100644 (file)
@@ -1563,7 +1563,8 @@ rust_structop::evaluate_funcall (struct type *expect_type,
 
   const struct block *block = get_selected_block (0);
   struct block_symbol sym = lookup_symbol (name.c_str (), block,
-                                          VAR_DOMAIN, NULL);
+                                          SEARCH_VFT,
+                                          nullptr);
   if (sym.symbol == NULL)
     error (_("Could not find function named '%s'"), name.c_str ());
 
@@ -1699,7 +1700,7 @@ rust_language::is_string_type_p (struct type *type) const
 struct block_symbol
 rust_language::lookup_symbol_nonlocal
      (const char *name, const struct block *block,
-      const domain_enum domain) const
+      const domain_search_flags domain) const
 {
   struct block_symbol result = {};
 
@@ -1707,7 +1708,7 @@ rust_language::lookup_symbol_nonlocal
   symbol_lookup_debug_printf
     ("rust_lookup_symbol_non_local (%s, %s (scope %s), %s)",
      name, host_address_to_string (block), scope,
-     domain_name (domain));
+     domain_name (domain).c_str ());
 
   /* Look up bare names in the block's scope.  */
   std::string scopedname;
index d2270e66b4ad24d7e0ebcc606c2cb8f71129d679..e76a63ee0376044d96621ac0e6cc128bb4ab7d33 100644 (file)
@@ -151,7 +151,7 @@ public:
 
   struct block_symbol lookup_symbol_nonlocal
        (const char *name, const struct block *block,
-        const domain_enum domain) const override;
+        const domain_search_flags domain) const override;
 
   /* See language.h.  */
 
index 277a0793ea9485bcdc7c9fb153af1692c9a6354c..af1b76f738a1d6ca1be628e22ca026a3a58b7735 100644 (file)
@@ -308,7 +308,7 @@ struct rust_parser
   void update_innermost_block (struct block_symbol sym);
   struct block_symbol lookup_symbol (const char *name,
                                     const struct block *block,
-                                    const domain_enum domain);
+                                    const domain_search_flags domain);
   struct type *rust_lookup_type (const char *name);
 
   /* Clear some state.  This is only used for testing.  */
@@ -431,7 +431,7 @@ munge_name_and_block (const char **name, const struct block **block)
 
 struct block_symbol
 rust_parser::lookup_symbol (const char *name, const struct block *block,
-                           const domain_enum domain)
+                           const domain_search_flags domain)
 {
   struct block_symbol result;
 
@@ -454,7 +454,7 @@ rust_parser::rust_lookup_type (const char *name)
   const struct block *block = pstate->expression_context_block;
   munge_name_and_block (&name, &block);
 
-  result = ::lookup_symbol (name, block, STRUCT_DOMAIN, NULL);
+  result = ::lookup_symbol (name, block, SEARCH_STRUCT_DOMAIN, NULL);
   if (result.symbol != NULL)
     {
       update_innermost_block (result);
@@ -1221,7 +1221,7 @@ rust_parser::name_to_operation (const std::string &name)
 {
   struct block_symbol sym = lookup_symbol (name.c_str (),
                                           pstate->expression_context_block,
-                                          VAR_DOMAIN);
+                                          SEARCH_VFT);
   if (sym.symbol != nullptr && sym.symbol->aclass () != LOC_TYPEDEF)
     return make_operation<var_value_operation> (sym);
 
index 2c3bf91923bc08d8b6c6f35a95527e1abf1efd16..2c465a1251faef8ddaf3a13c4cde37025ea25bb1 100644 (file)
@@ -316,8 +316,9 @@ select_source_symtab ()
 
   /* Make the default place to list be the function `main'
      if one exists.  */
-  block_symbol bsym = lookup_symbol (main_name (), 0, VAR_DOMAIN, 0);
-  if (bsym.symbol != nullptr && bsym.symbol->aclass () == LOC_BLOCK)
+  block_symbol bsym = lookup_symbol (main_name (), nullptr,
+                                    SEARCH_FUNCTION_DOMAIN, nullptr);
+  if (bsym.symbol != nullptr)
     {
       symtab_and_line sal = find_function_start_sal (bsym.symbol, true);
       if (sal.symtab == NULL)
index 31b89342bd187051526c5f240a1cd1df37f36cfa..bf3158393efa8172c49acddc2efe2a9adec4ae7d 100644 (file)
@@ -817,7 +817,7 @@ print_frame_args (const frame_print_options &fp_opts,
              struct symbol *nsym;
 
              nsym = lookup_symbol_search_name (sym->search_name (),
-                                               b, VAR_DOMAIN).symbol;
+                                               b, SEARCH_VAR_DOMAIN).symbol;
              gdb_assert (nsym != NULL);
              if (nsym->aclass () == LOC_REGISTER
                  && !nsym->is_argument ())
@@ -2485,7 +2485,7 @@ iterate_over_block_arg_vars (const struct block *b,
 
          struct symbol *sym2
            = lookup_symbol_search_name (sym->search_name (),
-                                        b, VAR_DOMAIN).symbol;
+                                        b, SEARCH_VAR_DOMAIN).symbol;
          cb (sym->print_name (), sym2);
        }
     }
index 3f5df13a005bc07632c517dacfcdea9b03297b0f..30b02531b9c58e98c695e9bc7203aaf784f5fc55 100644 (file)
@@ -240,7 +240,8 @@ objfile::map_symtabs_matching_filename
 }
 
 struct compunit_symtab *
-objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
+objfile::lookup_symbol (block_enum kind, const char *name,
+                       domain_search_flags domain)
 {
   struct compunit_symtab *retval = nullptr;
 
@@ -248,7 +249,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
     gdb_printf (gdb_stdlog,
                "qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
                objfile_debug_name (this), kind, name,
-               domain_name (domain));
+               domain_name (domain).c_str ());
 
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
 
@@ -277,10 +278,6 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
     return true;
   };
 
-  domain_search_flags flags = to_search_flags (domain);
-  if (domain == VAR_DOMAIN)
-    flags |= SEARCH_TYPE_DOMAIN | SEARCH_FUNCTION_DOMAIN;
-
   for (const auto &iter : qf)
     {
       if (!iter->expand_symtabs_matching (this,
@@ -291,7 +288,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
                                          kind == GLOBAL_BLOCK
                                          ? SEARCH_GLOBAL_BLOCK
                                          : SEARCH_STATIC_BLOCK,
-                                         flags))
+                                         domain))
        break;
     }
 
index 17e1a64e77d4dc5a3c4b5d045086419bc6ab99ee..9d5ce7f6ad293d37896489222af752885f1adb5b 100644 (file)
@@ -1697,8 +1697,8 @@ set_initial_language_callback ()
     {
       const char *name = main_name ();
       struct symbol *sym
-       = lookup_symbol_in_language (name, NULL, VAR_DOMAIN, default_lang,
-                                    NULL).symbol;
+       = lookup_symbol_in_language (name, nullptr, SEARCH_FUNCTION_DOMAIN,
+                                    default_lang, nullptr).symbol;
 
       if (sym != NULL)
        lang = sym->language ();
index a973052f3389239ad4e8b35931df8717940de780..5735786ac44b450a0b5874e558f79f66e889eaeb 100644 (file)
@@ -85,7 +85,7 @@ static struct block_symbol
   lookup_symbol_aux (const char *name,
                     symbol_name_match_type match_type,
                     const struct block *block,
-                    const domain_enum domain,
+                    const domain_search_flags domain,
                     enum language language,
                     struct field_of_this_result *);
 
@@ -93,13 +93,14 @@ static
 struct block_symbol lookup_local_symbol (const char *name,
                                         symbol_name_match_type match_type,
                                         const struct block *block,
-                                        const domain_enum domain,
+                                        const domain_search_flags domain,
                                         enum language language);
 
 static struct block_symbol
   lookup_symbol_in_objfile (struct objfile *objfile,
                            enum block_enum block_index,
-                           const char *name, const domain_enum domain);
+                           const char *name,
+                           const domain_search_flags domain);
 
 static void set_main_name (program_space *pspace, const char *name,
                           language lang);
@@ -171,14 +172,14 @@ struct symbol_cache_slot
      lookup was saved in the cache, but cache space is pretty cheap.  */
   const struct objfile *objfile_context;
 
+  /* The domain that was searched for initially.  This must exactly
+     match.  */
+  domain_search_flags domain;
+
   union
   {
     struct block_symbol found;
-    struct
-    {
-      char *name;
-      domain_enum domain;
-    } not_found;
+    char *name;
   } value;
 };
 
@@ -188,7 +189,7 @@ static void
 symbol_cache_clear_slot (struct symbol_cache_slot *slot)
 {
   if (slot->state == SYMBOL_SLOT_NOT_FOUND)
-    xfree (slot->value.not_found.name);
+    xfree (slot->value.name);
   slot->state = SYMBOL_SLOT_UNUSED;
 }
 
@@ -1243,19 +1244,14 @@ matching_obj_sections (struct obj_section *obj_first,
 
 static unsigned int
 hash_symbol_entry (const struct objfile *objfile_context,
-                  const char *name, domain_enum domain)
+                  const char *name, domain_search_flags domain)
 {
   unsigned int hash = (uintptr_t) objfile_context;
 
   if (name != NULL)
     hash += htab_hash_string (name);
 
-  /* Because of symbol_matches_domain we need VAR_DOMAIN and STRUCT_DOMAIN
-     to map to the same slot.  */
-  if (domain == STRUCT_DOMAIN)
-    hash += VAR_DOMAIN * 7;
-  else
-    hash += domain * 7;
+  hash += domain * 7;
 
   return hash;
 }
@@ -1265,10 +1261,9 @@ hash_symbol_entry (const struct objfile *objfile_context,
 static int
 eq_symbol_entry (const struct symbol_cache_slot *slot,
                 const struct objfile *objfile_context,
-                const char *name, domain_enum domain)
+                const char *name, domain_search_flags domain)
 {
   const char *slot_name;
-  domain_enum slot_domain;
 
   if (slot->state == SYMBOL_SLOT_UNUSED)
     return 0;
@@ -1276,16 +1271,11 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
   if (slot->objfile_context != objfile_context)
     return 0;
 
+  domain_search_flags slot_domain = slot->domain;
   if (slot->state == SYMBOL_SLOT_NOT_FOUND)
-    {
-      slot_name = slot->value.not_found.name;
-      slot_domain = slot->value.not_found.domain;
-    }
+    slot_name = slot->value.name;
   else
-    {
-      slot_name = slot->value.found.symbol->search_name ();
-      slot_domain = slot->value.found.symbol->domain ();
-    }
+    slot_name = slot->value.found.symbol->search_name ();
 
   /* NULL names match.  */
   if (slot_name == NULL && name == NULL)
@@ -1301,18 +1291,18 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
         the first time through.  If the slot records a found symbol,
         then this means using the symbol name comparison function of
         the symbol's language with symbol->search_name ().  See
-        dictionary.c.  It also means using symbol_matches_domain for
-        found symbols.  See block.c.
+        dictionary.c.
 
         If the slot records a not-found symbol, then require a precise match.
         We could still be lax with whitespace like strcmp_iw though.  */
 
+      if (slot_domain != domain)
+       return 0;
+
       if (slot->state == SYMBOL_SLOT_NOT_FOUND)
        {
          if (strcmp (slot_name, name) != 0)
            return 0;
-         if (slot_domain != domain)
-           return 0;
        }
       else
        {
@@ -1321,9 +1311,6 @@ eq_symbol_entry (const struct symbol_cache_slot *slot,
 
          if (!symbol_matches_search_name (sym, lookup_name))
            return 0;
-
-         if (!symbol_matches_domain (sym->language (), slot_domain, domain))
-           return 0;
        }
     }
   else
@@ -1443,7 +1430,7 @@ set_symbol_cache_size_handler (const char *args, int from_tty,
 static struct block_symbol
 symbol_cache_lookup (struct symbol_cache *cache,
                     struct objfile *objfile_context, enum block_enum block,
-                    const char *name, domain_enum domain,
+                    const char *name, domain_search_flags domain,
                     struct block_symbol_cache **bsc_ptr,
                     struct symbol_cache_slot **slot_ptr)
 {
@@ -1474,7 +1461,7 @@ symbol_cache_lookup (struct symbol_cache *cache,
                                  block == GLOBAL_BLOCK ? "Global" : "Static",
                                  slot->state == SYMBOL_SLOT_NOT_FOUND
                                  ? " (not found)" : "", name,
-                                 domain_name (domain));
+                                 domain_name (domain).c_str ());
       ++bsc->hits;
       if (slot->state == SYMBOL_SLOT_NOT_FOUND)
        return SYMBOL_LOOKUP_FAILED;
@@ -1485,7 +1472,7 @@ symbol_cache_lookup (struct symbol_cache *cache,
 
   symbol_lookup_debug_printf ("%s block symbol cache miss for %s, %s",
                              block == GLOBAL_BLOCK ? "Global" : "Static",
-                             name, domain_name (domain));
+                             name, domain_name (domain).c_str ());
   ++bsc->misses;
   return {};
 }
@@ -1500,7 +1487,8 @@ symbol_cache_mark_found (struct block_symbol_cache *bsc,
                         struct symbol_cache_slot *slot,
                         struct objfile *objfile_context,
                         struct symbol *symbol,
-                        const struct block *block)
+                        const struct block *block,
+                        domain_search_flags domain)
 {
   if (bsc == NULL)
     return;
@@ -1513,6 +1501,7 @@ symbol_cache_mark_found (struct block_symbol_cache *bsc,
   slot->objfile_context = objfile_context;
   slot->value.found.symbol = symbol;
   slot->value.found.block = block;
+  slot->domain = domain;
 }
 
 /* Mark symbol NAME, DOMAIN as not found in SLOT.
@@ -1523,7 +1512,7 @@ static void
 symbol_cache_mark_not_found (struct block_symbol_cache *bsc,
                             struct symbol_cache_slot *slot,
                             struct objfile *objfile_context,
-                            const char *name, domain_enum domain)
+                            const char *name, domain_search_flags domain)
 {
   if (bsc == NULL)
     return;
@@ -1534,8 +1523,8 @@ symbol_cache_mark_not_found (struct block_symbol_cache *bsc,
     }
   slot->state = SYMBOL_SLOT_NOT_FOUND;
   slot->objfile_context = objfile_context;
-  slot->value.not_found.name = xstrdup (name);
-  slot->value.not_found.domain = domain;
+  slot->value.name = xstrdup (name);
+  slot->domain = domain;
 }
 
 /* Flush the symbol cache of PSPACE.  */
@@ -1620,8 +1609,8 @@ symbol_cache_dump (const struct symbol_cache *cache)
            case SYMBOL_SLOT_NOT_FOUND:
              gdb_printf ("  [%4u] = %s, %s %s (not found)\n", i,
                          host_address_to_string (slot->objfile_context),
-                         slot->value.not_found.name,
-                         domain_name (slot->value.not_found.domain));
+                         slot->value.name,
+                         domain_name (slot->domain).c_str ());
              break;
            case SYMBOL_SLOT_FOUND:
              {
@@ -1984,7 +1973,8 @@ search_name_hash (enum language language, const char *search_name)
 
 struct block_symbol
 lookup_symbol_in_language (const char *name, const struct block *block,
-                          const domain_enum domain, enum language lang,
+                          const domain_search_flags domain,
+                          enum language lang,
                           struct field_of_this_result *is_a_field_of_this)
 {
   SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
@@ -2002,7 +1992,7 @@ lookup_symbol_in_language (const char *name, const struct block *block,
 
 struct block_symbol
 lookup_symbol (const char *name, const struct block *block,
-              domain_enum domain,
+              domain_search_flags domain,
               struct field_of_this_result *is_a_field_of_this)
 {
   return lookup_symbol_in_language (name, block, domain,
@@ -2014,7 +2004,7 @@ lookup_symbol (const char *name, const struct block *block,
 
 struct block_symbol
 lookup_symbol_search_name (const char *search_name, const struct block *block,
-                          domain_enum domain)
+                          domain_search_flags domain)
 {
   return lookup_symbol_aux (search_name, symbol_name_match_type::SEARCH_NAME,
                            block, domain, language_asm, NULL);
@@ -2039,7 +2029,7 @@ lookup_language_this (const struct language_defn *lang,
 
       sym = block_lookup_symbol (block, lang->name_of_this (),
                                 symbol_name_match_type::SEARCH_NAME,
-                                VAR_DOMAIN);
+                                SEARCH_VFT);
       if (sym != NULL)
        {
          symbol_lookup_debug_printf_v
@@ -2108,7 +2098,7 @@ check_field (struct type *type, const char *name,
 static struct block_symbol
 lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
                   const struct block *block,
-                  const domain_enum domain, enum language language,
+                  const domain_search_flags domain, enum language language,
                   struct field_of_this_result *is_a_field_of_this)
 {
   SYMBOL_LOOKUP_SCOPED_DEBUG_ENTER_EXIT;
@@ -2127,7 +2117,7 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
         objfile != NULL ? objfile_debug_name (objfile) : "NULL");
       symbol_lookup_debug_printf
        ("domain name = \"%s\", language = \"%s\")",
-        domain_name (domain), language_str (language));
+        domain_name (domain).c_str (), language_str (language));
     }
 
   /* Make sure we do something sensible with is_a_field_of_this, since
@@ -2157,7 +2147,7 @@ lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
   /* Don't do this check if we are searching for a struct.  It will
      not be found by check_field, but will be found by other
      means.  */
-  if (is_a_field_of_this != NULL && domain != STRUCT_DOMAIN)
+  if (is_a_field_of_this != NULL && (domain & SEARCH_STRUCT_DOMAIN) == 0)
     {
       result = lookup_language_this (langdef, block);
 
@@ -2213,7 +2203,7 @@ static struct block_symbol
 lookup_local_symbol (const char *name,
                     symbol_name_match_type match_type,
                     const struct block *block,
-                    const domain_enum domain,
+                    const domain_search_flags domain,
                     enum language language)
 {
   if (block == nullptr)
@@ -2258,7 +2248,7 @@ lookup_local_symbol (const char *name,
 struct symbol *
 lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
                        const struct block *block,
-                       const domain_enum domain)
+                       const domain_search_flags domain)
 {
   struct symbol *sym;
 
@@ -2271,7 +2261,7 @@ lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
        ("lookup_symbol_in_block (%s, %s (objfile %s), %s)",
         name, host_address_to_string (block),
         objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
-        domain_name (domain));
+        domain_name (domain).c_str ());
     }
 
   sym = block_lookup_symbol (block, name, match_type, domain);
@@ -2292,7 +2282,7 @@ struct block_symbol
 lookup_global_symbol_from_objfile (struct objfile *main_objfile,
                                   enum block_enum block_index,
                                   const char *name,
-                                  const domain_enum domain)
+                                  const domain_search_flags domain)
 {
   gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
 
@@ -2316,7 +2306,7 @@ lookup_global_symbol_from_objfile (struct objfile *main_objfile,
 static struct block_symbol
 lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
                                  enum block_enum block_index, const char *name,
-                                 const domain_enum domain)
+                                 const domain_search_flags domain)
 {
   gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
 
@@ -2324,7 +2314,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
     ("lookup_symbol_in_objfile_symtabs (%s, %s, %s, %s)",
      objfile_debug_name (objfile),
      block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
-     name, domain_name (domain));
+     name, domain_name (domain).c_str ());
 
   struct block_symbol other;
   other.symbol = NULL;
@@ -2383,7 +2373,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
 static struct block_symbol
 lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
                                            const char *linkage_name,
-                                           domain_enum domain)
+                                           domain_search_flags domain)
 {
   enum language lang = current_language->la_language;
   struct objfile *main_objfile;
@@ -2435,7 +2425,7 @@ Internal: %s symbol `%s' found in %s psymtab but not in symtab.\n\
 static struct block_symbol
 lookup_symbol_via_quick_fns (struct objfile *objfile,
                             enum block_enum block_index, const char *name,
-                            const domain_enum domain)
+                            const domain_search_flags domain)
 {
   struct compunit_symtab *cust;
   const struct blockvector *bv;
@@ -2446,7 +2436,7 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
     ("lookup_symbol_via_quick_fns (%s, %s, %s, %s)",
      objfile_debug_name (objfile),
      block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
-     name, domain_name (domain));
+     name, domain_name (domain).c_str ());
 
   cust = objfile->lookup_symbol (block_index, name, domain);
   if (cust == NULL)
@@ -2477,7 +2467,7 @@ lookup_symbol_via_quick_fns (struct objfile *objfile,
 struct block_symbol
 language_defn::lookup_symbol_nonlocal (const char *name,
                                       const struct block *block,
-                                      const domain_enum domain) const
+                                      const domain_search_flags domain) const
 {
   struct block_symbol result;
 
@@ -2495,7 +2485,7 @@ language_defn::lookup_symbol_nonlocal (const char *name,
      shared libraries we could search all of them only to find out the
      builtin type isn't defined in any of them.  This is common for types
      like "void".  */
-  if (domain == VAR_DOMAIN)
+  if ((domain & SEARCH_TYPE_DOMAIN) != 0)
     {
       struct gdbarch *gdbarch;
 
@@ -2518,7 +2508,7 @@ language_defn::lookup_symbol_nonlocal (const char *name,
 struct block_symbol
 lookup_symbol_in_static_block (const char *name,
                               const struct block *block,
-                              const domain_enum domain)
+                              const domain_search_flags domain)
 {
   if (block == nullptr)
     return {};
@@ -2538,7 +2528,7 @@ lookup_symbol_in_static_block (const char *name,
        ("lookup_symbol_in_static_block (%s, %s (objfile %s), %s)",
         name, host_address_to_string (block),
         objfile != nullptr ? objfile_debug_name (objfile) : "NULL",
-        domain_name (domain));
+        domain_name (domain).c_str ());
     }
 
   sym = lookup_symbol_in_block (name,
@@ -2557,7 +2547,7 @@ lookup_symbol_in_static_block (const char *name,
 
 static struct block_symbol
 lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
-                         const char *name, const domain_enum domain)
+                         const char *name, const domain_search_flags domain)
 {
   struct block_symbol result;
 
@@ -2567,7 +2557,7 @@ lookup_symbol_in_objfile (struct objfile *objfile, enum block_enum block_index,
                              objfile_debug_name (objfile),
                              block_index == GLOBAL_BLOCK
                              ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
-                             name, domain_name (domain));
+                             name, domain_name (domain).c_str ());
 
   result = lookup_symbol_in_objfile_symtabs (objfile, block_index,
                                             name, domain);
@@ -2598,7 +2588,7 @@ static struct block_symbol
 lookup_global_or_static_symbol (const char *name,
                                enum block_enum block_index,
                                struct objfile *objfile,
-                               const domain_enum domain)
+                               const domain_search_flags domain)
 {
   struct symbol_cache *cache = get_symbol_cache (current_program_space);
   struct block_symbol result;
@@ -2632,7 +2622,8 @@ lookup_global_or_static_symbol (const char *name,
        objfile);
 
   if (result.symbol != NULL)
-    symbol_cache_mark_found (bsc, slot, objfile, result.symbol, result.block);
+    symbol_cache_mark_found (bsc, slot, objfile, result.symbol, result.block,
+                            domain);
   else
     symbol_cache_mark_not_found (bsc, slot, objfile, name, domain);
 
@@ -2642,7 +2633,7 @@ lookup_global_or_static_symbol (const char *name,
 /* See symtab.h.  */
 
 struct block_symbol
-lookup_static_symbol (const char *name, const domain_enum domain)
+lookup_static_symbol (const char *name, const domain_search_flags domain)
 {
   return lookup_global_or_static_symbol (name, STATIC_BLOCK, nullptr, domain);
 }
@@ -2652,7 +2643,7 @@ lookup_static_symbol (const char *name, const domain_enum domain)
 struct block_symbol
 lookup_global_symbol (const char *name,
                      const struct block *block,
-                     const domain_enum domain)
+                     const domain_search_flags domain)
 {
   /* If a block was passed in, we want to search the corresponding
      global block first.  This yields "more expected" behavior, and is
@@ -2761,7 +2752,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
   const struct block *block;
   struct symbol *sym;
 
-  cust = objfile->lookup_symbol (block_index, name, STRUCT_DOMAIN);
+  cust = objfile->lookup_symbol (block_index, name, SEARCH_STRUCT_DOMAIN);
   if (cust == NULL)
     return NULL;
 
@@ -2769,7 +2760,7 @@ basic_lookup_transparent_type_quick (struct objfile *objfile,
   block = bv->block (block_index);
 
   lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
-  sym = block_find_symbol (block, lookup_name, STRUCT_DOMAIN, nullptr);
+  sym = block_find_symbol (block, lookup_name, SEARCH_STRUCT_DOMAIN, nullptr);
   if (sym == nullptr)
     error_in_psymtab_expansion (block_index, name, cust);
   gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
@@ -2794,7 +2785,8 @@ basic_lookup_transparent_type_1 (struct objfile *objfile,
     {
       bv = cust->blockvector ();
       block = bv->block (block_index);
-      sym = block_find_symbol (block, lookup_name, STRUCT_DOMAIN, nullptr);
+      sym = block_find_symbol (block, lookup_name, SEARCH_STRUCT_DOMAIN,
+                              nullptr);
       if (sym != nullptr)
        {
          gdb_assert (!TYPE_IS_OPAQUE (sym->type ()));
@@ -4888,7 +4880,7 @@ global_symbol_searcher::expand_symtabs
                         (msymbol->value_address (objfile)) == NULL)
                      : (lookup_symbol_in_objfile_from_linkage_name
                         (objfile, msymbol->linkage_name (),
-                         VAR_DOMAIN)
+                         SEARCH_VFT)
                         .symbol == NULL))
                    found_msymbol = true;
                }
@@ -5026,7 +5018,7 @@ global_symbol_searcher::add_matching_msymbols
                {
                  if (lookup_symbol_in_objfile_from_linkage_name
                      (objfile, msymbol->linkage_name (),
-                      VAR_DOMAIN).symbol == NULL)
+                      SEARCH_VFT).symbol == NULL)
                    {
                      /* Matching msymbol, add it to the results list.  */
                      if (results->size () < m_max_search_results)
index 25117b9218ccffd78a39e0e4872dc65850f50f27..8e1d219281b769b0882856f472460e9351b190cc 100644 (file)
@@ -2112,7 +2112,7 @@ struct field_of_this_result
 extern struct block_symbol
   lookup_symbol_in_language (const char *,
                             const struct block *,
-                            const domain_enum,
+                            const domain_search_flags,
                             enum language,
                             struct field_of_this_result *);
 
@@ -2120,7 +2120,7 @@ extern struct block_symbol
 
 extern struct block_symbol lookup_symbol (const char *,
                                          const struct block *,
-                                         const domain_enum,
+                                         const domain_search_flags,
                                          struct field_of_this_result *);
 
 /* Find the definition for a specified symbol search name in domain
@@ -2132,9 +2132,10 @@ extern struct block_symbol lookup_symbol (const char *,
    pointer, or NULL if no symbol is found.  The symbol's section is
    fixed up if necessary.  */
 
-extern struct block_symbol lookup_symbol_search_name (const char *search_name,
-                                                     const struct block *block,
-                                                     domain_enum domain);
+extern struct block_symbol lookup_symbol_search_name
+     (const char *search_name,
+      const struct block *block,
+      domain_search_flags domain);
 
 /* Some helper functions for languages that need to write their own
    lookup_symbol_nonlocal functions.  */
@@ -2146,13 +2147,13 @@ extern struct block_symbol lookup_symbol_search_name (const char *search_name,
 extern struct block_symbol
   lookup_symbol_in_static_block (const char *name,
                                 const struct block *block,
-                                const domain_enum domain);
+                                const domain_search_flags domain);
 
 /* Search all static file-level symbols for NAME from DOMAIN.
    Upon success fixes up the symbol's section if necessary.  */
 
-extern struct block_symbol lookup_static_symbol (const char *name,
-                                                const domain_enum domain);
+extern struct block_symbol lookup_static_symbol
+     (const char *name, const domain_search_flags domain);
 
 /* Lookup a symbol in all files' global blocks.
 
@@ -2168,7 +2169,7 @@ extern struct block_symbol lookup_static_symbol (const char *name,
 extern struct block_symbol
   lookup_global_symbol (const char *name,
                        const struct block *block,
-                       const domain_enum domain);
+                       const domain_search_flags domain);
 
 /* Lookup a symbol in block BLOCK.
    Upon success fixes up the symbol's section if necessary.  */
@@ -2177,7 +2178,7 @@ extern struct symbol *
   lookup_symbol_in_block (const char *name,
                          symbol_name_match_type match_type,
                          const struct block *block,
-                         const domain_enum domain);
+                         const domain_search_flags domain);
 
 /* Look up the `this' symbol for LANG in BLOCK.  Return the symbol if
    found, or NULL if not found.  */
@@ -2724,7 +2725,7 @@ extern struct block_symbol
   lookup_global_symbol_from_objfile (struct objfile *main_objfile,
                                     enum block_enum block_index,
                                     const char *name,
-                                    const domain_enum domain);
+                                    const domain_search_flags domain);
 
 /* Return 1 if the supplied producer string matches the ARM RealView
    compiler (armcc).  */
index 93e2dfedad08739e3f3da149bed7a3e4944e9977..e2694f0c32b2fa59c158d02fdfe0bb71fb2045be 100644 (file)
@@ -118,15 +118,9 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
 {
   struct block_symbol sym;
 
-  sym = lookup_symbol (name, 0, VAR_DOMAIN, 0);
+  sym = lookup_symbol (name, nullptr, SEARCH_TYPE_DOMAIN, nullptr);
   if (sym.symbol != NULL)
     {
-      if (sym.symbol->aclass () != LOC_BLOCK)
-       {
-         error (_("\"%s\" exists in this program but is not a function."),
-                name);
-       }
-
       if (objf_p)
        *objf_p = sym.symbol->objfile ();
 
@@ -3708,7 +3702,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
            {
              struct symbol *s = 
                lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
-                              0, VAR_DOMAIN, 0).symbol;
+                              0, SEARCH_FUNCTION_DOMAIN, 0).symbol;
 
              if (s == NULL)
                return NULL;
@@ -3739,7 +3733,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
            {
              struct symbol *s = 
                lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
-                              0, VAR_DOMAIN, 0).symbol;
+                              0, SEARCH_FUNCTION_DOMAIN, 0).symbol;
 
              if (s == NULL)
                return NULL;
@@ -3819,7 +3813,7 @@ value_maybe_namespace_elt (const struct type *curtype,
   struct value *result;
 
   sym = cp_lookup_symbol_namespace (namespace_name, name,
-                                   get_selected_block (0), VAR_DOMAIN);
+                                   get_selected_block (0), SEARCH_VFT);
 
   if (sym.symbol == NULL)
     return NULL;
index 4ec9babcce8d4c7ce5f42c2deb42a00cca53f78c..ccaef9fd80fa6bb81e3c440f3d1b9f8b905462af 100644 (file)
@@ -2922,7 +2922,8 @@ value_static_field (struct type *type, int fieldno)
     {
       const char *phys_name = type->field (fieldno).loc_physname ();
       /* type->field (fieldno).name (); */
-      struct block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0);
+      struct block_symbol sym = lookup_symbol (phys_name, nullptr,
+                                              SEARCH_VAR_DOMAIN, nullptr);
 
       if (sym.symbol == NULL)
        {
@@ -3113,7 +3114,8 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
   struct symbol *sym;
   struct bound_minimal_symbol msym;
 
-  sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0).symbol;
+  sym = lookup_symbol (physname, nullptr, SEARCH_FUNCTION_DOMAIN,
+                      nullptr).symbol;
   if (sym == nullptr)
     {
       msym = lookup_bound_minimal_symbol (physname);
index 71339c502d2b76ae0e346d385d1db38b8533a954..b19c9491fd0fc52ad1101d5abf66baa28e27cede 100644 (file)
@@ -423,7 +423,8 @@ xstormy16_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
        return plg_end;
 
       /* Found a function.  */
-      sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL).symbol;
+      sym = lookup_symbol (func_name, NULL, SEARCH_FUNCTION_DOMAIN,
+                          nullptr).symbol;
       /* Don't use line number debug info for assembly source files.  */
       if (sym && sym->language () != language_asm)
        {