Use domain_search_flags in lookup_global_symbol_language

This changes quick_symbol_functions::lookup_global_symbol_language to
accept domain_search_flags rather than just a domain_enum, and fixes
up the fallout.

To avoid introducing any regressions, any code passing VAR_DOMAIN now
uses SEARCH_VFT.

That is, no visible changes should result from this patch.  However,
it sets the stage to refine some searches later on.
This commit is contained in:
Tom Tromey
2023-03-11 07:55:42 -07:00
parent 88ff5355ad
commit 6c01521494
18 changed files with 113 additions and 158 deletions

View File

@@ -1265,7 +1265,7 @@ write_object_renaming (struct parser_state *par_state,
name = obstack_strndup (&temp_parse_space, renamed_entity,
renamed_entity_len);
ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
ada_lookup_encoded_symbol (name, orig_left_context, SEARCH_VFT, &sym_info);
if (sym_info.symbol == NULL)
error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ());
else if (sym_info.symbol->aclass () == LOC_TYPEDEF)
@@ -1334,7 +1334,7 @@ write_object_renaming (struct parser_state *par_state,
renaming_expr = end;
ada_lookup_encoded_symbol (index_name, orig_left_context,
VAR_DOMAIN, &index_sym_info);
SEARCH_VFT, &index_sym_info);
if (index_sym_info.symbol == NULL)
error (_("Could not find %s"), index_name);
else if (index_sym_info.symbol->aclass () == LOC_TYPEDEF)
@@ -1404,7 +1404,7 @@ block_lookup (const struct block *context, const char *raw_name)
}
std::vector<struct block_symbol> syms
= ada_lookup_symbol_list (name, context, VAR_DOMAIN);
= ada_lookup_symbol_list (name, context, SEARCH_VFT);
if (context == NULL
&& (syms.empty () || syms[0].symbol->aclass () != LOC_BLOCK))
@@ -1483,7 +1483,7 @@ find_primitive_type (struct parser_state *par_state, const char *name)
(char *) alloca (strlen (name) + sizeof ("standard__"));
strcpy (expanded_name, "standard__");
strcat (expanded_name, name);
sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN).symbol;
sym = ada_lookup_symbol (expanded_name, NULL, SEARCH_VFT).symbol;
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
type = sym->type ();
}
@@ -1670,7 +1670,8 @@ write_var_or_type (struct parser_state *par_state,
encoded_name[tail_index] = terminator;
std::vector<struct block_symbol> syms
= ada_lookup_symbol_list (decoded_name.c_str (), block, VAR_DOMAIN);
= ada_lookup_symbol_list (decoded_name.c_str (), block,
SEARCH_VFT);
type_sym = select_possible_type_sym (syms);
@@ -1876,7 +1877,7 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
std::vector<struct block_symbol> syms
= ada_lookup_symbol_list (name.ptr,
par_state->expression_context_block,
VAR_DOMAIN);
SEARCH_VFT);
if (syms.size () != 1 || syms[0].symbol->aclass () == LOC_TYPEDEF)
pstate->push_new<ada_string_operation> (copy_name (name));

View File

@@ -98,12 +98,12 @@ static struct value *make_array_descriptor (struct type *, struct value *);
static void ada_add_block_symbols (std::vector<struct block_symbol> &,
const struct block *,
const lookup_name_info &lookup_name,
domain_enum, struct objfile *);
domain_search_flags, struct objfile *);
static void ada_add_all_symbols (std::vector<struct block_symbol> &,
const struct block *,
const lookup_name_info &lookup_name,
domain_enum, int, int *);
domain_search_flags, int, int *);
static int is_nonfunction (const std::vector<struct block_symbol> &);
@@ -176,9 +176,6 @@ static LONGEST pos_atr (struct value *);
static struct value *val_atr (struct type *, LONGEST);
static struct symbol *standard_lookup (const char *, const struct block *,
domain_enum);
static struct value *ada_search_struct_field (const char *, struct value *, int,
struct type *);
@@ -335,7 +332,7 @@ struct cache_entry
/* The name used to perform the lookup. */
std::string name;
/* The namespace used during the lookup. */
domain_enum domain = UNDEF_DOMAIN;
domain_search_flags domain = 0;
/* The symbol returned by the lookup, or NULL if no matching symbol
was found. */
struct symbol *sym = nullptr;
@@ -349,7 +346,7 @@ struct cache_entry
struct cache_entry_search
{
const char *name;
domain_enum domain;
domain_search_flags domain;
hashval_t hash () const
{
@@ -3751,7 +3748,7 @@ ada_find_operator_symbol (enum exp_opcode op, bool parse_completion,
{
std::vector<struct block_symbol> candidates
= ada_lookup_symbol_list (ada_decoded_op_name (op),
NULL, VAR_DOMAIN);
NULL, SEARCH_VFT);
int i = ada_resolve_function (candidates, argvec,
nargs, ada_decoded_op_name (op), NULL,
@@ -3772,7 +3769,7 @@ ada_resolve_funcall (struct symbol *sym, const struct block *block,
innermost_block_tracker *tracker)
{
std::vector<struct block_symbol> candidates
= ada_lookup_symbol_list (sym->linkage_name (), block, VAR_DOMAIN);
= ada_lookup_symbol_list (sym->linkage_name (), block, SEARCH_VFT);
int i;
if (candidates.size () == 1)
@@ -3838,7 +3835,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block,
innermost_block_tracker *tracker)
{
std::vector<struct block_symbol> candidates
= ada_lookup_symbol_list (sym->linkage_name (), block, VAR_DOMAIN);
= ada_lookup_symbol_list (sym->linkage_name (), block, SEARCH_VFT);
if (std::any_of (candidates.begin (),
candidates.end (),
@@ -4708,7 +4705,7 @@ ada_clear_symbol_cache (program_space *pspace)
SYM. Same principle for BLOCK if not NULL. */
static int
lookup_cached_symbol (const char *name, domain_enum domain,
lookup_cached_symbol (const char *name, domain_search_flags domain,
struct symbol **sym, const struct block **block)
{
htab_t tab = get_ada_pspace_data (current_program_space);
@@ -4731,8 +4728,8 @@ lookup_cached_symbol (const char *name, domain_enum domain,
in domain DOMAIN, save this result in our symbol cache. */
static void
cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
const struct block *block)
cache_symbol (const char *name, domain_search_flags domain,
struct symbol *sym, const struct block *block)
{
/* Symbols for builtin types don't have a block.
For now don't cache such symbols. */
@@ -4789,7 +4786,7 @@ name_match_type_from_name (const char *lookup_name)
static struct symbol *
standard_lookup (const char *name, const struct block *block,
domain_enum domain)
domain_search_flags domain)
{
/* Initialize it just to avoid a GCC false warning. */
struct block_symbol sym = {};
@@ -5192,7 +5189,7 @@ is_package_name (const char *name)
/* If it is a function that has not been defined at library level,
then we should be able to look it up in the symbols. */
if (standard_lookup (name, NULL, VAR_DOMAIN) != NULL)
if (standard_lookup (name, NULL, SEARCH_VFT) != NULL)
return 0;
/* Library-level function names start with "_ada_". See if function
@@ -5205,7 +5202,7 @@ is_package_name (const char *name)
std::string fun_name = string_printf ("_ada_%s", name);
return (standard_lookup (fun_name.c_str (), NULL, VAR_DOMAIN) == NULL);
return (standard_lookup (fun_name.c_str (), NULL, SEARCH_VFT) == NULL);
}
/* Return nonzero if SYM corresponds to a renaming entity that is
@@ -5365,7 +5362,7 @@ remove_irrelevant_renamings (std::vector<struct block_symbol> *syms,
static void
ada_add_local_symbols (std::vector<struct block_symbol> &result,
const lookup_name_info &lookup_name,
const struct block *block, domain_enum domain)
const struct block *block, domain_search_flags domain)
{
while (block != NULL)
{
@@ -5439,7 +5436,7 @@ static int
ada_add_block_renamings (std::vector<struct block_symbol> &result,
const struct block *block,
const lookup_name_info &lookup_name,
domain_enum domain)
domain_search_flags domain)
{
struct using_direct *renaming;
int defns_mark = result.size ();
@@ -5504,7 +5501,7 @@ ada_lookup_name (const lookup_name_info &lookup_name)
static void
map_matching_symbols (struct objfile *objfile,
const lookup_name_info &lookup_name,
domain_enum domain,
domain_search_flags domain,
int global,
match_data &data)
{
@@ -5514,7 +5511,7 @@ map_matching_symbols (struct objfile *objfile,
global
? SEARCH_GLOBAL_BLOCK
: SEARCH_STATIC_BLOCK,
domain, SEARCH_ALL);
domain);
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
for (compunit_symtab *symtab : objfile->compunits ())
@@ -5535,7 +5532,7 @@ map_matching_symbols (struct objfile *objfile,
static void
add_nonlocal_symbols (std::vector<struct block_symbol> &result,
const lookup_name_info &lookup_name,
domain_enum domain, int global)
domain_search_flags domain, int global)
{
struct match_data data (&result);
@@ -5588,7 +5585,7 @@ static void
ada_add_all_symbols (std::vector<struct block_symbol> &result,
const struct block *block,
const lookup_name_info &lookup_name,
domain_enum domain,
domain_search_flags domain,
int full_search,
int *made_global_lookup_p)
{
@@ -5668,7 +5665,7 @@ ada_add_all_symbols (std::vector<struct block_symbol> &result,
static std::vector<struct block_symbol>
ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
const struct block *block,
domain_enum domain,
domain_search_flags domain,
int full_search)
{
int syms_from_global_search;
@@ -5697,7 +5694,7 @@ ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name,
std::vector<struct block_symbol>
ada_lookup_symbol_list (const char *name, const struct block *block,
domain_enum domain)
domain_search_flags domain)
{
symbol_name_match_type name_match_type = name_match_type_from_name (name);
lookup_name_info lookup_name (name, name_match_type);
@@ -5714,7 +5711,7 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
void
ada_lookup_encoded_symbol (const char *name, const struct block *block,
domain_enum domain,
domain_search_flags domain,
struct block_symbol *info)
{
/* Since we already have an encoded name, wrap it in '<>' to force a
@@ -5736,7 +5733,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
struct block_symbol
ada_lookup_symbol (const char *name, const struct block *block0,
domain_enum domain)
domain_search_flags domain)
{
std::vector<struct block_symbol> candidates
= ada_lookup_symbol_list (name, block0, domain);
@@ -6008,7 +6005,7 @@ static void
ada_add_block_symbols (std::vector<struct block_symbol> &result,
const struct block *block,
const lookup_name_info &lookup_name,
domain_enum domain, struct objfile *objfile)
domain_search_flags domain, struct objfile *objfile)
{
/* A matching argument symbol, if any. */
struct symbol *arg_sym;
@@ -7441,11 +7438,11 @@ ada_find_any_type_symbol (const char *name)
{
struct symbol *sym;
sym = standard_lookup (name, get_selected_block (NULL), VAR_DOMAIN);
sym = standard_lookup (name, get_selected_block (NULL), SEARCH_VFT);
if (sym != NULL && sym->aclass () == LOC_TYPEDEF)
return sym;
sym = standard_lookup (name, NULL, STRUCT_DOMAIN);
sym = standard_lookup (name, NULL, SEARCH_STRUCT_DOMAIN);
return sym;
}
@@ -11323,7 +11320,7 @@ get_var_value (const char *name, const char *err_msg)
std::vector<struct block_symbol> syms
= ada_lookup_symbol_list_worker (lookup_name,
get_selected_block (0),
VAR_DOMAIN, 1);
SEARCH_VFT, 1);
if (syms.size () != 1)
{
@@ -11626,7 +11623,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
that should be compiled with debugging information. As a result, we
expect to find that symbol in the symtabs. */
sym = standard_lookup (einfo->catch_exception_sym, NULL, VAR_DOMAIN);
sym = standard_lookup (einfo->catch_exception_sym, NULL, SEARCH_VFT);
if (sym == NULL)
{
/* Perhaps we did not find our symbol because the Ada runtime was
@@ -11660,7 +11657,7 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
error (_("Symbol \"%s\" is not a function (class = %d)"),
sym->linkage_name (), sym->aclass ());
sym = standard_lookup (einfo->catch_handlers_sym, NULL, VAR_DOMAIN);
sym = standard_lookup (einfo->catch_handlers_sym, NULL, SEARCH_VFT);
if (sym == NULL)
{
struct bound_minimal_symbol msym
@@ -12627,7 +12624,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex)
/* Then lookup the function on which we will break in order to catch
the Ada exceptions requested by the user. */
sym_name = ada_exception_sym_name (ex);
sym = standard_lookup (sym_name, NULL, VAR_DOMAIN);
sym = standard_lookup (sym_name, NULL, SEARCH_VFT);
if (sym == NULL)
throw_error (NOT_FOUND_ERROR, _("Catchpoint symbol not found: %s"),
@@ -13445,7 +13442,7 @@ public:
bool iterate_over_symbols
(const struct block *block, const lookup_name_info &name,
domain_enum domain,
domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback) const override
{
std::vector<struct block_symbol> results
@@ -13682,11 +13679,15 @@ public:
{
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 ()),
domain);
flags);
if (sym.symbol != NULL)
return sym;

View File

@@ -230,14 +230,14 @@ extern std::string ada_decode (const char *name, bool wrap = true,
bool wide = true);
extern std::vector<struct block_symbol> ada_lookup_symbol_list
(const char *, const struct block *, domain_enum);
(const char *, const struct block *, domain_search_flags);
extern struct block_symbol ada_lookup_symbol (const char *,
const struct block *,
domain_enum);
domain_search_flags);
extern void ada_lookup_encoded_symbol
(const char *name, const struct block *block, domain_enum domain,
(const char *name, const struct block *block, domain_search_flags domain,
struct block_symbol *symbol_info);
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *,

View File

@@ -137,28 +137,6 @@ struct cooked_index_entry : public allocate_on_obstack
return false;
}
/* Return true if this entry matches DOMAIN. */
bool matches (domain_enum domain) const
{
/* Just reject type declarations. */
if ((flags & IS_TYPE_DECLARATION) != 0)
return false;
switch (domain)
{
case LABEL_DOMAIN:
return false;
case MODULE_DOMAIN:
return tag == DW_TAG_module;
case COMMON_BLOCK_DOMAIN:
return tag == DW_TAG_common_block;
}
return true;
}
/* Return true if this entry matches KIND. */
bool matches (domain_search_flags kind) const;
@@ -775,8 +753,7 @@ struct cooked_index_functions : public dwarf2_base_index_functions
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind) override;
domain_search_flags domain) override;
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct objfile *objfile, struct bound_minimal_symbol msymbol,

View File

@@ -146,8 +146,7 @@ struct dwarf2_gdb_index : public dwarf2_base_index_functions
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind) override;
domain_search_flags domain) override;
};
/* This dumps minimal information about the index.
@@ -272,8 +271,7 @@ dwarf2_gdb_index::expand_symtabs_matching
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind)
domain_search_flags domain)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -306,7 +304,7 @@ dwarf2_gdb_index::expand_symtabs_matching
[&] (offset_type idx)
{
if (!dw2_expand_marked_cus (per_objfile, idx, file_matcher,
expansion_notify, search_flags, kind))
expansion_notify, search_flags, domain))
return false;
return true;
}, per_objfile);

View File

@@ -1637,8 +1637,7 @@ struct readnow_functions : public dwarf2_base_index_functions
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind) override
domain_search_flags domain) override
{
return true;
}
@@ -16624,8 +16623,7 @@ cooked_index_functions::expand_symtabs_matching
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind)
domain_search_flags domain)
{
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
@@ -16688,8 +16686,7 @@ cooked_index_functions::expand_symtabs_matching
/* See if the symbol matches the type filter. */
if (!entry->matches (search_flags)
|| !entry->matches (domain)
|| !entry->matches (kind))
|| !entry->matches (domain))
continue;
/* We've found the base name of the symbol; now walk its

View File

@@ -839,7 +839,7 @@ struct dwarf2_base_index_functions : public quick_symbol_functions
enum language lookup_global_symbol_language (struct objfile *objfile,
const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p) override
{
*symbol_found_p = false;

View File

@@ -369,7 +369,7 @@ struct language_defn
used as the definition. */
virtual bool iterate_over_symbols
(const struct block *block, const lookup_name_info &name,
domain_enum domain,
domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback) const
{
return ::iterate_over_symbols (block, name, domain, callback);

View File

@@ -350,7 +350,7 @@ struct linespec_parser
static void iterate_over_file_blocks
(struct symtab *symtab, const lookup_name_info &name,
domain_enum domain,
domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback);
static void initialize_defaults (struct symtab **default_symtab,
@@ -1154,8 +1154,7 @@ static void
iterate_over_all_matching_symtabs
(struct linespec_state *state,
const lookup_name_info &lookup_name,
const domain_enum name_domain,
domain_search_flags domain_search_flags,
const domain_search_flags domain,
struct program_space *search_pspace, bool include_inline,
gdb::function_view<symbol_found_callback_ftype> callback)
{
@@ -1173,15 +1172,13 @@ iterate_over_all_matching_symtabs
objfile->expand_symtabs_matching (NULL, &lookup_name, NULL, NULL,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
UNDEF_DOMAIN,
domain_search_flags);
domain);
for (compunit_symtab *cu : objfile->compunits ())
{
struct symtab *symtab = cu->primary_filetab ();
iterate_over_file_blocks (symtab, lookup_name, name_domain,
callback);
iterate_over_file_blocks (symtab, lookup_name, domain, callback);
if (include_inline)
{
@@ -1193,7 +1190,7 @@ iterate_over_all_matching_symtabs
{
block = bv->block (i);
state->language->iterate_over_symbols
(block, lookup_name, name_domain,
(block, lookup_name, domain,
[&] (block_symbol *bsym)
{
/* Restrict calls to CALLBACK to symbols
@@ -1226,7 +1223,8 @@ get_current_search_block (void)
static void
iterate_over_file_blocks
(struct symtab *symtab, const lookup_name_info &name,
domain_enum domain, gdb::function_view<symbol_found_callback_ftype> callback)
domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback)
{
const struct block *block;
@@ -3450,10 +3448,10 @@ lookup_prefix_sym (struct linespec_state *state,
if (elt == nullptr)
{
iterate_over_all_matching_symtabs (state, lookup_name,
STRUCT_DOMAIN, SEARCH_ALL,
SEARCH_STRUCT_DOMAIN,
NULL, false, collector);
iterate_over_all_matching_symtabs (state, lookup_name,
VAR_DOMAIN, SEARCH_ALL,
SEARCH_VFT,
NULL, false, collector);
}
else
@@ -3464,8 +3462,12 @@ lookup_prefix_sym (struct linespec_state *state,
gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
iterate_over_file_blocks (elt, lookup_name, STRUCT_DOMAIN, collector);
iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN, collector);
iterate_over_file_blocks (elt, lookup_name,
SEARCH_STRUCT_DOMAIN,
collector);
iterate_over_file_blocks (elt, lookup_name,
SEARCH_VFT,
collector);
}
}
@@ -3799,12 +3801,16 @@ find_function_symbols (struct linespec_state *state,
/* Try NAME as an Objective-C selector. */
find_imps (name, &symbol_names);
domain_search_flags flags = SEARCH_FUNCTION_DOMAIN;
if (state->list_mode)
flags = SEARCH_VFT;
if (!symbol_names.empty ())
add_all_symbol_names_from_pspace (&info, state->search_pspace,
symbol_names, SEARCH_FUNCTION_DOMAIN);
symbol_names, flags);
else
add_matching_symbols_to_info (name, name_match_type,
SEARCH_FUNCTION_DOMAIN,
add_matching_symbols_to_info (name, name_match_type, flags,
&info, state->search_pspace);
}
@@ -4334,7 +4340,7 @@ add_matching_symbols_to_info (const char *name,
if (elt == nullptr)
{
iterate_over_all_matching_symtabs (info->state, lookup_name,
VAR_DOMAIN, domain_search_flags,
domain_search_flags,
pspace, true,
[&] (block_symbol *bsym)
{ return info->add_symbol (bsym); });
@@ -4349,7 +4355,7 @@ add_matching_symbols_to_info (const char *name,
program_space *elt_pspace = elt->compunit ()->objfile ()->pspace;
gdb_assert (!elt_pspace->executing_startup);
set_current_program_space (elt_pspace);
iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN,
iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT,
[&] (block_symbol *bsym)
{ return info->add_symbol (bsym); });

View File

@@ -591,8 +591,7 @@ public:
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind);
domain_search_flags domain);
/* See quick_symbol_functions. */
struct compunit_symtab *find_pc_sect_compunit_symtab
@@ -613,7 +612,7 @@ public:
/* See quick_symbol_functions. */
enum language lookup_global_symbol_language (const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p);
/* Return the relocation offset applied to SECTION. */

View File

@@ -42,7 +42,7 @@ static struct partial_symbol *lookup_partial_symbol (struct objfile *,
struct partial_symtab *,
const lookup_name_info &,
int,
domain_enum);
domain_search_flags);
static const char *psymtab_to_fullname (struct partial_symtab *ps);
@@ -279,7 +279,7 @@ find_pc_sect_psymbol (struct objfile *objfile,
enum language
psymbol_functions::lookup_global_symbol_language (struct objfile *objfile,
const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p)
{
*symbol_found_p = false;
@@ -325,7 +325,7 @@ static struct partial_symbol *
lookup_partial_symbol (struct objfile *objfile,
struct partial_symtab *pst,
const lookup_name_info &lookup_name,
int global, domain_enum domain)
int global, domain_search_flags domain)
{
struct partial_symbol **start, **psym;
struct partial_symbol **top, **real_top, **bottom, **center;
@@ -385,8 +385,7 @@ lookup_partial_symbol (struct objfile *objfile,
while (top <= real_top && symbol_matches_search_name (&(*top)->ginfo,
lookup_name))
{
if (symbol_matches_domain ((*top)->ginfo.language (),
(*top)->domain, domain))
if (search_flags_matches (domain, (*top)->domain))
return *top;
top++;
}
@@ -399,8 +398,7 @@ lookup_partial_symbol (struct objfile *objfile,
{
for (psym = start; psym < start + length; psym++)
{
if (symbol_matches_domain ((*psym)->ginfo.language (),
(*psym)->domain, domain)
if (search_flags_matches (domain, (*psym)->domain)
&& symbol_matches_search_name (&(*psym)->ginfo, lookup_name))
return *psym;
}
@@ -802,8 +800,7 @@ recursively_search_psymtabs
(struct partial_symtab *ps,
struct objfile *objfile,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags search,
domain_search_flags domain,
const lookup_name_info &lookup_name,
gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
{
@@ -825,7 +822,7 @@ recursively_search_psymtabs
continue;
r = recursively_search_psymtabs (ps->dependencies[i],
objfile, search_flags, domain, search,
objfile, search_flags, domain,
lookup_name, sym_matcher);
if (r != 0)
{
@@ -873,19 +870,7 @@ recursively_search_psymtabs
{
QUIT;
if ((domain == UNDEF_DOMAIN
|| symbol_matches_domain ((*psym)->ginfo.language (),
(*psym)->domain, domain))
&& (search == SEARCH_ALL
|| (search == SEARCH_MODULE_DOMAIN
&& (*psym)->domain == MODULE_DOMAIN)
|| (search == SEARCH_VAR_DOMAIN
&& (*psym)->aclass != LOC_TYPEDEF
&& (*psym)->aclass != LOC_BLOCK)
|| (search == SEARCH_FUNCTION_DOMAIN
&& (*psym)->aclass == LOC_BLOCK)
|| (search == SEARCH_TYPE_DOMAIN
&& (*psym)->aclass == LOC_TYPEDEF))
if (search_flags_matches (domain, (*psym)->domain)
&& psymbol_name_matches (*psym, lookup_name)
&& (sym_matcher == NULL
|| sym_matcher ((*psym)->ginfo.search_name ())))
@@ -913,8 +898,7 @@ psymbol_functions::expand_symtabs_matching
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags search)
domain_search_flags domain)
{
/* Clear the search flags. */
for (partial_symtab *ps : partial_symbols (objfile))
@@ -956,8 +940,7 @@ psymbol_functions::expand_symtabs_matching
if (lookup_name == nullptr
|| recursively_search_psymtabs (ps, objfile, search_flags,
domain, search,
*psym_lookup_name,
domain, *psym_lookup_name,
symbol_matcher))
{
compunit_symtab *cust = psymtab_to_symtab (objfile, ps);

View File

@@ -617,7 +617,7 @@ struct psymbol_functions : public quick_symbol_functions
enum language lookup_global_symbol_language (struct objfile *objfile,
const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p) override;
void print_stats (struct objfile *objfile, bool print_bcache) override;
@@ -633,7 +633,6 @@ struct psymbol_functions : public quick_symbol_functions
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind) override;
struct compunit_symtab *find_pc_sect_compunit_symtab

View File

@@ -96,14 +96,14 @@ struct quick_symbol_functions
/* Check to see if the global symbol is defined in a "partial" symbol table
of OBJFILE. NAME is the name of the symbol to look for. DOMAIN
indicates what sort of symbol to search for.
indicates what sorts of symbols to search for.
If found, sets *symbol_found_p to true and returns the symbol language.
defined, or NULL if no such symbol table exists. */
virtual enum language lookup_global_symbol_language
(struct objfile *objfile,
const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p) = 0;
/* Print statistics about any indices loaded for OBJFILE. The
@@ -134,8 +134,7 @@ struct quick_symbol_functions
Otherwise, individual symbols are considered.
If DOMAIN or KIND do not match, the symbol is skipped.
If DOMAIN is UNDEF_DOMAIN, that is treated as a wildcard.
If DOMAIN does not match, the symbol is skipped.
If the symbol name does not match LOOKUP_NAME, the symbol is skipped.
@@ -155,8 +154,7 @@ struct quick_symbol_functions
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind) = 0;
domain_search_flags domain) = 0;
/* Return the comp unit from OBJFILE that contains PC and
SECTION. Return NULL if there is no such compunit. This

View File

@@ -222,7 +222,6 @@ objfile::map_symtabs_matching_filename
on_expansion,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
UNDEF_DOMAIN,
SEARCH_ALL))
{
retval = false;
@@ -278,6 +277,10 @@ 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,
@@ -288,8 +291,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain)
kind == GLOBAL_BLOCK
? SEARCH_GLOBAL_BLOCK
: SEARCH_STATIC_BLOCK,
domain,
SEARCH_ALL))
flags))
break;
}
@@ -343,8 +345,7 @@ objfile::expand_symtabs_for_function (const char *func_name)
nullptr,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
VAR_DOMAIN,
SEARCH_ALL);
SEARCH_VFT);
}
void
@@ -380,7 +381,6 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
nullptr,
(SEARCH_GLOBAL_BLOCK
| SEARCH_STATIC_BLOCK),
UNDEF_DOMAIN,
SEARCH_ALL);
}
@@ -391,8 +391,7 @@ objfile::expand_symtabs_matching
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_enum domain,
domain_search_flags kind)
domain_search_flags domain)
{
/* This invariant is documented in quick-functions.h. */
gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr);
@@ -404,12 +403,12 @@ objfile::expand_symtabs_matching
host_address_to_string (&file_matcher),
host_address_to_string (&symbol_matcher),
host_address_to_string (&expansion_notify),
domain_name (kind).c_str ());
domain_name (domain).c_str ());
for (const auto &iter : qf)
if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name,
symbol_matcher, expansion_notify,
search_flags, domain, kind))
search_flags, domain))
return false;
return true;
}
@@ -504,7 +503,7 @@ objfile::find_compunit_symtab_by_address (CORE_ADDR address)
enum language
objfile::lookup_global_symbol_language (const char *name,
domain_enum domain,
domain_search_flags domain,
bool *symbol_found_p)
{
enum language result = language_unknown;

View File

@@ -3769,7 +3769,7 @@ expand_symtabs_matching
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
block_search_flags search_flags,
domain_search_flags kind)
domain_search_flags domain)
{
for (objfile *objfile : current_program_space->objfiles ())
if (!objfile->expand_symtabs_matching (file_matcher,
@@ -3777,8 +3777,7 @@ expand_symtabs_matching
symbol_matcher,
expansion_notify,
search_flags,
UNDEF_DOMAIN,
kind))
domain))
return false;
return true;
}

View File

@@ -919,7 +919,6 @@ maintenance_expand_symtabs (const char *args, int from_tty)
NULL,
NULL,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
UNDEF_DOMAIN,
SEARCH_ALL);
}

View File

@@ -2864,7 +2864,7 @@ basic_lookup_transparent_type (const char *name)
bool
iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
const domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback)
{
for (struct symbol *sym : block_iterator_range (block, &name))
@@ -2886,7 +2886,7 @@ bool
iterate_over_symbols_terminated
(const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
const domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback)
{
if (!iterate_over_symbols (block, name, domain, callback))
@@ -4846,7 +4846,6 @@ global_symbol_searcher::expand_symtabs
},
NULL,
SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
UNDEF_DOMAIN,
kind);
/* Here, we search through the minimal symbol tables for functions and
@@ -6502,7 +6501,7 @@ find_main_name (void)
[&symbol_found_p, pspace] (objfile *obj)
{
language lang
= obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
= obj->lookup_global_symbol_language ("main", SEARCH_VFT,
&symbol_found_p);
if (symbol_found_p)
{

View File

@@ -2817,7 +2817,7 @@ typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
bool iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
const domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback);
/* Like iterate_over_symbols, but if all calls to CALLBACK return
@@ -2827,7 +2827,7 @@ bool iterate_over_symbols (const struct block *block,
bool iterate_over_symbols_terminated
(const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
const domain_search_flags domain,
gdb::function_view<symbol_found_callback_ftype> callback);
/* Storage type used by demangle_for_lookup. demangle_for_lookup