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
commit03a8ea51c31d8f27ec717ddb1ff68f5f5d0732ab (patch)
tree6ed01e407a3d78440abf03c9b37b40df98e3d24b /gdb/psymtab.c
parentdf35e6262da99acc80bb88d669975f0b52e33876 (diff)
downloadgdb-03a8ea51c31d8f27ec717ddb1ff68f5f5d0732ab.zip
gdb-03a8ea51c31d8f27ec717ddb1ff68f5f5d0732ab.tar.gz
gdb-03a8ea51c31d8f27ec717ddb1ff68f5f5d0732ab.tar.bz2
Add search_flags to expand_symtabs_matching
This adds a block search flags parameter to expand_symtabs_matching. All callers are updated to search both the static and global blocks, as that was the implied behavior before this patch. This is a 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) (default_collect_symbol_completion_matches_break_on): Update. * symmisc.c (maintenance_expand_symtabs): Update. * symfile.h (expand_symtabs_matching): Add search_flags parameter. * symfile.c (expand_symtabs_matching): Add search_flags parameter. * symfile-debug.c (objfile::expand_symtabs_matching): Add search_flags parameter. * quick-symbol.h (struct quick_symbol_functions) <expand_symtabs_matching>: Add search_flags parameter. * python/py-symbol.c (gdbpy_lookup_static_symbols): Update. * psymtab.c (recursively_search_psymtabs) (psymbol_functions::expand_symtabs_matching): Add search_flags parameter. * psympriv.h (struct psymbol_functions) <expand_symtabs_matching>: Add search_flags parameter. * objfiles.h (struct objfile) <expand_symtabs_matching>: Add search_flags parameter. * linespec.c (iterate_over_all_matching_symtabs): Update. * dwarf2/read.c (struct dwarf2_gdb_index) <expand_symtabs_matching>: Add search_flags parameter. (struct dwarf2_debug_names_index) <expand_symtabs_matching>: Add search_flags parameter. (dw2_map_matching_symbols): Update. (dw2_expand_marked_cus, dw2_expand_symtabs_matching) (dwarf2_gdb_index::expand_symtabs_matching): Add search_flags parameter. (dw2_debug_names_iterator): Change block_index to search flags. <m_block_index>: Likewise. (dw2_debug_names_iterator::next) (dwarf2_debug_names_index::lookup_symbol) (dwarf2_debug_names_index::expand_symtabs_for_function) (dwarf2_debug_names_index::map_matching_symbols) (dwarf2_debug_names_index::map_matching_symbols): Update. (dwarf2_debug_names_index::expand_symtabs_matching): Add search_flags parameter. * ada-lang.c (ada_add_global_exceptions) (collect_symbol_completion_matches): Update.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 6e7bf24..c346116 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1207,6 +1207,7 @@ static bool
recursively_search_psymtabs
(struct partial_symtab *ps,
struct objfile *objfile,
+ block_search_flags search_flags,
enum search_domain domain,
const lookup_name_info &lookup_name,
gdb::function_view<expand_symtabs_symbol_matcher_ftype> sym_matcher)
@@ -1229,8 +1230,8 @@ recursively_search_psymtabs
continue;
r = recursively_search_psymtabs (ps->dependencies[i],
- objfile, domain, lookup_name,
- sym_matcher);
+ objfile, search_flags, domain,
+ lookup_name, sym_matcher);
if (r != 0)
{
ps->searched_flag = PST_SEARCHED_AND_FOUND;
@@ -1247,11 +1248,24 @@ recursively_search_psymtabs
/* Go through all of the symbols stored in a partial
symtab in one loop. */
partial_symbol **psym = ps->global_psymbols.data ();
+
+ if ((search_flags & SEARCH_GLOBAL_BLOCK) == 0)
+ {
+ if (ps->static_psymbols.empty ())
+ keep_going = 0;
+ else
+ {
+ psym = ps->static_psymbols.data ();
+ bound = sbound;
+ }
+ }
+
while (keep_going)
{
if (psym >= bound)
{
- if (bound == gbound && !ps->static_psymbols.empty ())
+ if (bound == gbound && !ps->static_psymbols.empty ()
+ && (search_flags & SEARCH_STATIC_BLOCK) != 0)
{
psym = ps->static_psymbols.data ();
bound = sbound;
@@ -1300,6 +1314,7 @@ psymbol_functions::expand_symtabs_matching
const lookup_name_info *lookup_name,
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)
{
/* Clear the search flags. */
@@ -1338,7 +1353,7 @@ psymbol_functions::expand_symtabs_matching
}
if ((symbol_matcher == NULL && lookup_name == NULL)
- || recursively_search_psymtabs (ps, objfile, domain,
+ || recursively_search_psymtabs (ps, objfile, search_flags, domain,
*psym_lookup_name,
symbol_matcher))
{