[binutils-gdb] Convert default_collect_symbol_completion_matches_break_on
Tom Tromey
tromey@sourceware.org
Wed Sep 10 22:18:22 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5b66439bc8b0ce287852f62378cbfca28927ffd0
commit 5b66439bc8b0ce287852f62378cbfca28927ffd0
Author: Tom Tromey <tom@tromey.com>
Date: Wed Dec 18 19:18:22 2024 -0700
Convert default_collect_symbol_completion_matches_break_on
This converts default_collect_symbol_completion_matches_break_on to
the callback approach, merging the search loop and the call to
expand_symtabs_matching.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998
Acked-By: Simon Marchi <simon.marchi@efficios.com>
Diff:
---
gdb/symtab.c | 33 ++++++++++++++-------------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 13416075200..9f6797118b5 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6120,25 +6120,20 @@ default_collect_symbol_completion_matches_break_on
/* Add completions for all currently loaded symbol tables. */
for (objfile *objfile : current_program_space->objfiles ())
{
- for (compunit_symtab *cust : objfile->compunits ())
- add_symtab_completions (cust, tracker, mode, lookup_name,
- sym_text, word, code);
- }
-
- /* Look through the partial symtabs for all symbols which begin by
- matching SYM_TEXT. Expand all CUs that you find to the list. */
- expand_symtabs_matching (NULL,
- lookup_name,
- NULL,
- [&] (compunit_symtab *symtab) /* expansion notify */
- {
- add_symtab_completions (symtab,
- tracker, mode, lookup_name,
- sym_text, word, code);
- return true;
- },
- SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
- SEARCH_ALL_DOMAINS);
+ /* Look through the partial symtabs for all symbols which begin by
+ matching SYM_TEXT. Expand all CUs that you find to the list. */
+ objfile->expand_symtabs_matching
+ (nullptr, &lookup_name, nullptr,
+ [&] (compunit_symtab *symtab)
+ {
+ add_symtab_completions (symtab,
+ tracker, mode, lookup_name,
+ sym_text, word, code);
+ return true;
+ },
+ SEARCH_GLOBAL_BLOCK | SEARCH_STATIC_BLOCK,
+ SEARCH_ALL_DOMAINS);
+ }
/* Search upwards from currently selected frame (so that we can
complete on local vars). Also catch fields of types defined in
More information about the Gdb-cvs
mailing list