aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-04-17 09:35:04 -0600
committerTom Tromey <tom@tromey.com>2021-04-17 09:35:05 -0600
commit3bfa51a75fc18775ea043efb248d0e2c35103202 (patch)
tree25e27a3c0ccf85f992657dde16c25277c163f0ac /gdb/psymtab.c
parent03a8ea51c31d8f27ec717ddb1ff68f5f5d0732ab (diff)
downloadfsf-binutils-gdb-3bfa51a75fc18775ea043efb248d0e2c35103202.zip
fsf-binutils-gdb-3bfa51a75fc18775ea043efb248d0e2c35103202.tar.gz
fsf-binutils-gdb-3bfa51a75fc18775ea043efb248d0e2c35103202.tar.bz2
Add 'domain' parameter to expand_symtabs_matching
Currently, expand_symtabs_matching only accepts a search_domain parameter. However, lookup_symbol uses a domain_enum instead, and the two, confusingly, do quite different things -- one cannot emulate the other. So, this patch adds a domain_enum parameter to expand_symtabs_matching, with UNDEF_DOMAIN used as a wildcard. This is another step toward replacing lookup_symbol with expand_symtabs_matching. gdb/ChangeLog 2021-04-17 Tom Tromey <tom@tromey.com> * symtab.c (global_symbol_searcher::expand_symtabs): Update. * symmisc.c (maintenance_expand_symtabs): Update. * symfile.c (expand_symtabs_matching): Update. * symfile-debug.c (objfile::expand_symtabs_matching): Add 'domain' parameter. * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_matching>: Add 'domain' parameter. * psymtab.c (recursively_search_psymtabs) (psymbol_functions::expand_symtabs_matching): Add 'domain' parameter. * psympriv.h (struct psymbol_functions) <expand_symtabs_matching>: Add 'domain' parameter. * objfiles.h (struct objfile) <expand_symtabs_matching>: Add 'domain' parameter. * linespec.c (iterate_over_all_matching_symtabs): Update. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_matching>: Add 'domain' parameter. (struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add 'domain' parameter. (dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching) (dw2_debug_names_iterator) (dwarf2_debug_names_index::expand_symtabs_matching): Add 'domain' parameter.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index c346116..c766107 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1208,7 +1208,8 @@ recursively_search_psymtabs
(struct partial_symtab *ps,
struct objfile *objfile,
block_search_flags search_flags,
- enum search_domain domain,
+ domain_enum domain,
+ enum search_domain search,
const lookup_name_info &lookup_name,
gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
{
@@ -1230,7 +1231,7 @@ recursively_search_psymtabs
continue;
r = recursively_search_psymtabs (ps->dependencies[i],
- objfile, search_flags, domain,
+ objfile, search_flags, domain, search,
lookup_name, sym_matcher);
if (r != 0)
{
@@ -1278,16 +1279,19 @@ recursively_search_psymtabs
{
QUIT;
- if ((domain == ALL_DOMAIN
- || (domain == MODULES_DOMAIN
- && (*psym)->domain == MODULE_DOMAIN)
- || (domain == VARIABLES_DOMAIN
- && (*psym)->aclass != LOC_TYPEDEF
- && (*psym)->aclass != LOC_BLOCK)
- || (domain == FUNCTIONS_DOMAIN
- && (*psym)->aclass == LOC_BLOCK)
- || (domain == TYPES_DOMAIN
- && (*psym)->aclass == LOC_TYPEDEF))
+ if ((domain == UNDEF_DOMAIN
+ || symbol_matches_domain ((*psym)->ginfo.language (),
+ (*psym)->domain, domain))
+ && (search == ALL_DOMAIN
+ || (search == MODULES_DOMAIN
+ && (*psym)->domain == MODULE_DOMAIN)
+ || (search == VARIABLES_DOMAIN
+ && (*psym)->aclass != LOC_TYPEDEF
+ && (*psym)->aclass != LOC_BLOCK)
+ || (search == FUNCTIONS_DOMAIN
+ && (*psym)->aclass == LOC_BLOCK)
+ || (search == TYPES_DOMAIN
+ && (*psym)->aclass == LOC_TYPEDEF))
&& psymbol_name_matches (*psym, lookup_name)
&& (sym_matcher == NULL
|| sym_matcher ((*psym)->ginfo.search_name ())))
@@ -1315,7 +1319,8 @@ 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,
- enum search_domain domain)
+ domain_enum domain,
+ enum search_domain search)
{
/* Clear the search flags. */
for (partial_symtab *ps : require_partial_symbols (objfile))
@@ -1353,7 +1358,8 @@ psymbol_functions::expand_symtabs_matching
}
if ((symbol_matcher == NULL && lookup_name == NULL)
- || recursively_search_psymtabs (ps, objfile, search_flags, domain,
+ || recursively_search_psymtabs (ps, objfile, search_flags,
+ domain, search,
*psym_lookup_name,
symbol_matcher))
{