Introduce method wrappers for quick_symbol_functions

This introduces wrappers for each function in quick_symbol_functions.
The wrappers are methods on objfile, and are defined in
symfile-debug.c, so that they can use the symfile_debug variable.
Places that call the quick functions are all updated to call these new
wrapper methods.

gdb/ChangeLog
2021-03-20  Tom Tromey  <tom@tromey.com>

	* symtab.c (iterate_over_symtabs, expand_symtab_containing_pc)
	(lookup_symbol_via_quick_fns, find_quick_global_symbol_language)
	(basic_lookup_transparent_type_quick)
	(find_pc_sect_compunit_symtab, find_symbol_at_address)
	(find_line_symtab, global_symbol_searcher::expand_symtabs):
	Update.
	* symmisc.c (print_objfile_statistics, dump_objfile)
	(maintenance_expand_symtabs): Update.
	* symfile.c (symbol_file_add_with_addrs)
	(expand_symtabs_matching, map_symbol_filenames): Update.
	* symfile-debug.c (objfile::has_partial_symbols)
	(objfile::find_last_source_symtab)
	(objfile::forget_cached_source_info)
	(objfile::map_symtabs_matching_filename, objfile::lookup_symbol)
	(objfile::print_stats, objfile::dump)
	(objfile::expand_symtabs_for_function)
	(objfile::expand_all_symtabs)
	(objfile::expand_symtabs_with_fullname)
	(objfile::map_matching_symbols)
	(objfile::expand_symtabs_matching)
	(objfile::find_pc_sect_compunit_symtab)
	(objfile::map_symbol_filenames)
	(objfile::find_compunit_symtab_by_address)
	(objfile::lookup_global_symbol_language): New methods.
	(debug_sym_quick_functions): Remove.
	(debug_sym_fns, install_symfile_debug_logging): Update.
	* source.c (forget_cached_source_info_for_objfile)
	(select_source_symtab): Update.
	* objfiles.h (struct objfile): Add methods corresponding to
	quick_symbol_functions.
	* objfiles.c (objfile::has_partial_symbols): Move to
	symfile-debug.c.
	* linespec.c (iterate_over_all_matching_symtabs): Update.
	* cp-support.c (add_symbol_overload_list_qualified): Update.
	* ada-lang.c (add_nonlocal_symbols): Update.
This commit is contained in:
Tom Tromey
2021-03-20 17:23:40 -06:00
parent fae2120ba0
commit 4d080b4687
11 changed files with 363 additions and 363 deletions

View File

@@ -415,8 +415,8 @@ private:
GDB typically reads symbols twice -- first an initial scan which just
reads "partial symbols"; these are partial information for the
static/global symbols in a symbol file. When later looking up symbols,
objfile->sf->qf->lookup_symbol is used to check if we only have a partial
static/global symbols in a symbol file. When later looking up
symbols, lookup_symbol is used to check if we only have a partial
symbol and if so, read and expand the full compunit. */
struct objfile
@@ -552,6 +552,71 @@ public:
bool has_partial_symbols ();
/* See quick_symbol_functions. */
struct symtab *find_last_source_symtab ();
/* See quick_symbol_functions. */
void forget_cached_source_info ();
/* See quick_symbol_functions. */
bool map_symtabs_matching_filename
(const char *name, const char *real_path,
gdb::function_view<bool (symtab *)> callback);
/* See quick_symbol_functions. */
struct compunit_symtab *lookup_symbol (block_enum kind, const char *name,
domain_enum domain);
/* See quick_symbol_functions. */
void print_stats ();
/* See quick_symbol_functions. */
void dump ();
/* See quick_symbol_functions. */
void expand_symtabs_for_function (const char *func_name);
/* See quick_symbol_functions. */
void expand_all_symtabs ();
/* See quick_symbol_functions. */
void expand_symtabs_with_fullname (const char *fullname);
/* See quick_symbol_functions. */
void map_matching_symbols
(const lookup_name_info &name, domain_enum domain,
int global,
gdb::function_view<symbol_found_callback_ftype> callback,
symbol_compare_ftype *ordered_compare);
/* See quick_symbol_functions. */
void expand_symtabs_matching
(gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
const lookup_name_info *lookup_name,
gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
enum search_domain kind);
/* See quick_symbol_functions. */
struct compunit_symtab *find_pc_sect_compunit_symtab
(struct bound_minimal_symbol msymbol,
CORE_ADDR pc,
struct obj_section *section,
int warn_if_readin);
/* See quick_symbol_functions. */
void map_symbol_filenames (symbol_filename_ftype *fun, void *data,
int need_fullname);
/* See quick_symbol_functions. */
struct compunit_symtab *find_compunit_symtab_by_address (CORE_ADDR address);
/* See quick_symbol_functions. */
enum language lookup_global_symbol_language (const char *name,
domain_enum domain,
bool *symbol_found_p);
/* The object file's original name as specified by the user,
made absolute, and tilde-expanded. However, it is not canonicalized
(i.e., it has not been passed through gdb_realpath).