diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb7b2de0b58..d9d5b4f9cb7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-02 Tom Tromey + + * ada-lang.c (add_nonlocal_symbols): Handle case where objfile->sf + is null. + 2021-02-27 Lancelot Six PR gdb/27393 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 419347f776d..91a2a5ce1df 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5629,10 +5629,11 @@ add_nonlocal_symbols (struct obstack *obstackp, { data.objfile = objfile; - objfile->sf->qf->map_matching_symbols (objfile, lookup_name, - domain, global, callback, - (is_wild_match - ? NULL : compare_names)); + if (objfile->sf != nullptr) + objfile->sf->qf->map_matching_symbols (objfile, lookup_name, + domain, global, callback, + (is_wild_match + ? NULL : compare_names)); for (compunit_symtab *cu : objfile->compunits ()) { @@ -5654,9 +5655,10 @@ add_nonlocal_symbols (struct obstack *obstackp, for (objfile *objfile : current_program_space->objfiles ()) { data.objfile = objfile; - objfile->sf->qf->map_matching_symbols (objfile, name1, - domain, global, callback, - compare_names); + if (objfile->sf != nullptr) + objfile->sf->qf->map_matching_symbols (objfile, name1, + domain, global, callback, + compare_names); } } }