From 536a40f3a8d2c18aae18a9137b838ff2accdfc08 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 17 Apr 2021 09:35:04 -0600 Subject: Remove quick_symbol_functions::map_symtabs_matching_filename This replaces quick_symbol_functions::map_symtabs_matching_filename with a call to expand_symtabs_matching. As with the previous patch, rather than update all callers, the implementation is consolidated in objfile::map_symtabs_matching_filename. gdb/ChangeLog 2021-04-17 Tom Tromey * symfile-debug.c (objfile::map_symtabs_matching_filename): Rewrite. * quick-symbol.h (struct quick_symbol_functions) : Remove. * psymtab.c (partial_map_expand_apply) (psymbol_functions::map_symtabs_matching_filename): Remove. * psympriv.h (struct psymbol_functions) : Remove. * objfiles.h (struct objfile) : Update comment. * dwarf2/read.c (struct dwarf2_base_index_functions) : Remove. (dw2_map_expand_apply) (dwarf2_base_index_functions::map_symtabs_matching_filename): Remove. --- gdb/psymtab.c | 90 ----------------------------------------------------------- 1 file changed, 90 deletions(-) (limited to 'gdb/psymtab.c') diff --git a/gdb/psymtab.c b/gdb/psymtab.c index b9b7c7d..be523a7 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -87,96 +87,6 @@ psymbol_functions::require_partial_symbols (struct objfile *objfile) return m_partial_symtabs->range (); } -/* Helper function for psym_map_symtabs_matching_filename that - expands the symtabs and calls the iterator. */ - -static bool -partial_map_expand_apply (struct objfile *objfile, - const char *name, - const char *real_path, - struct partial_symtab *pst, - gdb::function_view callback) -{ - struct compunit_symtab *last_made = objfile->compunit_symtabs; - - /* Shared psymtabs should never be seen here. Instead they should - be handled properly by the caller. */ - gdb_assert (pst->user == NULL); - - /* Don't visit already-expanded psymtabs. */ - if (pst->readin_p (objfile)) - return 0; - - /* This may expand more than one symtab, and we want to iterate over - all of them. */ - psymtab_to_symtab (objfile, pst); - - return iterate_over_some_symtabs (name, real_path, objfile->compunit_symtabs, - last_made, callback); -} - -/* Psymtab version of map_symtabs_matching_filename. See its definition in - the definition of quick_symbol_functions in symfile.h. */ - -bool -psymbol_functions::map_symtabs_matching_filename - (struct objfile *objfile, - const char *name, - const char *real_path, - gdb::function_view callback) -{ - const char *name_basename = lbasename (name); - - for (partial_symtab *pst : require_partial_symbols (objfile)) - { - /* Anonymous psymtabs don't have a file name. */ - if (pst->anonymous) - continue; - - if (compare_filenames_for_search (pst->filename, name)) - { - while (pst->user) - pst = pst->user; - - if (partial_map_expand_apply (objfile, name, real_path, - pst, callback)) - return true; - continue; - } - - /* Before we invoke realpath, which can get expensive when many - files are involved, do a quick comparison of the basenames. */ - if (! basenames_may_differ - && FILENAME_CMP (name_basename, lbasename (pst->filename)) != 0) - continue; - - if (compare_filenames_for_search (psymtab_to_fullname (pst), name)) - { - if (partial_map_expand_apply (objfile, name, real_path, - pst, callback)) - return true; - continue; - } - - /* If the user gave us an absolute path, try to find the file in - this symtab and use its absolute path. */ - if (real_path != NULL) - { - gdb_assert (IS_ABSOLUTE_PATH (real_path)); - gdb_assert (IS_ABSOLUTE_PATH (name)); - if (filename_cmp (psymtab_to_fullname (pst), real_path) == 0) - { - if (partial_map_expand_apply (objfile, name, real_path, - pst, callback)) - return true; - continue; - } - } - } - - return false; -} - /* Find which partial symtab contains PC and SECTION starting at psymtab PST. We may find a different psymtab than PST. See FIND_PC_SECT_PSYMTAB. */ -- cgit v1.1