From d1eef86d12f5aa2f8461add1180df9db4b59a39d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 20 Mar 2021 17:23:40 -0600 Subject: Introduce objfile::require_partial_symbols This adds a new method, objfile::require_partial_symbols. This reuses most of the code from the old function in psymtab.c. That function is now made static, and simplified. gdb/ChangeLog 2021-03-20 Tom Tromey * symfile.c (read_symbols): Use objfile method. * symfile-debug.c (objfile::require_partial_symbols): New method. * psymtab.h (require_partial_symbols): Don't declare. * psymtab.c (require_partial_symbols): Use objfile method. Now static. (psymbol_functions::map_symtabs_matching_filename, OBJFILE) (psymbol_functions::lookup_symbol) (psymbol_functions::lookup_global_symbol_language) (psymbol_functions::find_last_source_symtab) (psymbol_functions::forget_cached_source_info) (psymbol_functions::print_stats) (psymbol_functions::expand_symtabs_for_function) (psymbol_functions::expand_all_symtabs) (psymbol_functions::expand_symtabs_with_fullname) (psymbol_functions::map_symbol_filenames) (psymbol_functions::map_matching_symbols) (psymbol_functions::expand_symtabs_matching) (psymbol_functions::find_compunit_symtab_by_address) (maintenance_print_psymbols, maintenance_info_psymtabs) (maintenance_check_psymtabs): Update. * objfiles.h (struct objfile) : Declare new method. --- gdb/symfile-debug.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gdb/symfile-debug.c') diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 94559c7..9997453 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -357,6 +357,27 @@ objfile::lookup_global_symbol_language (const char *name, return result; } +void +objfile::require_partial_symbols (bool verbose) +{ + if ((flags & OBJF_PSYMTABS_READ) == 0) + { + flags |= OBJF_PSYMTABS_READ; + + if (qf->can_lazily_read_symbols ()) + { + if (verbose) + printf_filtered (_("Reading symbols from %s...\n"), + objfile_name (this)); + qf->read_partial_symbols (this); + + if (verbose && !objfile_has_symbols (this)) + printf_filtered (_("(No debugging symbols found in %s)\n"), + objfile_name (this)); + } + } +} + /* Debugging version of struct sym_probe_fns. */ -- cgit v1.1