aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-06-21 14:10:41 -0600
committerTom Tromey <tom@tromey.com>2021-07-16 13:54:01 -0600
commit4f348ca808af86c9698ef11595832018103f9492 (patch)
tree6fb82f3c099c1cdf2227986cd8da2f74a586113b /gdb/psymtab.c
parentcc9d6997a5b23d0c8e1960f6c0b5f5cdf456d4e9 (diff)
downloadgdb-4f348ca808af86c9698ef11595832018103f9492.zip
gdb-4f348ca808af86c9698ef11595832018103f9492.tar.gz
gdb-4f348ca808af86c9698ef11595832018103f9492.tar.bz2
Document quick_symbol_functions::expand_symtabs_matching invariant
While working on my series to replace the DWARF psymbol reader, I noticed that the expand_symtabs_matching has an undocumented invariant. I think that, if this invariant is not followed, then GDB will crash. So, this patch documents this in the relevant spots and introduces some asserts to make it clear. Regression tested on x86-64 Fedora 32.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c5
1 files changed, 4 insertions, 1 deletions
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,