diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-11 07:55:42 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-28 10:58:16 -0700 |
commit | 6c0152149476085e6c4c5c812bfc3a06fff7c938 (patch) | |
tree | 176aaa96a5ecfadea04a57996c530bb8ebbc9e95 /gdb/linespec.c | |
parent | 88ff5355adfee1c015ce98f0d79475f53678a7bb (diff) | |
download | gdb-6c0152149476085e6c4c5c812bfc3a06fff7c938.zip gdb-6c0152149476085e6c4c5c812bfc3a06fff7c938.tar.gz gdb-6c0152149476085e6c4c5c812bfc3a06fff7c938.tar.bz2 |
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.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r-- | gdb/linespec.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c index 1d8cbc5..b9aca3c 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -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); }); |