diff options
-rw-r--r-- | gdb/dwarf2/read.c | 8 | ||||
-rw-r--r-- | gdb/psymtab.c | 5 | ||||
-rw-r--r-- | gdb/quick-symbol.h | 2 | ||||
-rw-r--r-- | gdb/symfile-debug.c | 3 |
4 files changed, 15 insertions, 3 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9292e52..97f9d88 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -4319,7 +4319,9 @@ dwarf2_gdb_index::expand_symtabs_matching dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher); - if (symbol_matcher == NULL && lookup_name == NULL) + /* This invariant is documented in quick-functions.h. */ + gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); + if (lookup_name == nullptr) { for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) { @@ -5307,7 +5309,9 @@ dwarf2_debug_names_index::expand_symtabs_matching dw_expand_symtabs_matching_file_matcher (per_objfile, file_matcher); - if (symbol_matcher == NULL && lookup_name == NULL) + /* This invariant is documented in quick-functions.h. */ + gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); + if (lookup_name == nullptr) { for (const auto &per_cu : per_objfile->per_bfd->all_comp_units) { diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 069052d..7c3017d 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1130,6 +1130,9 @@ psymbol_functions::expand_symtabs_matching if (lookup_name != nullptr) psym_lookup_name = lookup_name->make_ignore_params (); + /* This invariant is documented in quick-functions.h. */ + gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); + for (partial_symtab *ps : m_partial_symtabs->range ()) { QUIT; @@ -1157,7 +1160,7 @@ psymbol_functions::expand_symtabs_matching continue; } - if ((symbol_matcher == NULL && lookup_name == NULL) + if (lookup_name == nullptr || recursively_search_psymtabs (ps, objfile, search_flags, domain, search, *psym_lookup_name, diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h index 7af0aeb..5eb7c84 100644 --- a/gdb/quick-symbol.h +++ b/gdb/quick-symbol.h @@ -167,6 +167,8 @@ struct quick_symbol_functions If the symbol name does not match LOOKUP_NAME, the symbol is skipped. If SYMBOL_MATCHER returns false, then the symbol is skipped. + Note that if SYMBOL_MATCHER is non-NULL, then LOOKUP_NAME must + also be provided. Otherwise, the symbol's symbol table is expanded and the notification function is called. If the notification function diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index a10af68..f3d5a68 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -405,6 +405,9 @@ objfile::expand_symtabs_matching domain_enum domain, enum search_domain kind) { + /* This invariant is documented in quick-functions.h. */ + gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); + if (debug_symfile) fprintf_filtered (gdb_stdlog, "qf->expand_symtabs_matching (%s, %s, %s, %s, %s)\n", |