aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile-debug.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-04-17 09:35:04 -0600
committerTom Tromey <tom@tromey.com>2021-04-17 09:35:06 -0600
commit536a40f3a8d2c18aae18a9137b838ff2accdfc08 (patch)
treed498eab42e09269d72816d31091eb55e083cc1b1 /gdb/symfile-debug.c
parent84d865e39c3739097d7a3481b9c9b6b6fecb2b06 (diff)
downloadgdb-536a40f3a8d2c18aae18a9137b838ff2accdfc08.zip
gdb-536a40f3a8d2c18aae18a9137b838ff2accdfc08.tar.gz
gdb-536a40f3a8d2c18aae18a9137b838ff2accdfc08.tar.bz2
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 <tom@tromey.com> * symfile-debug.c (objfile::map_symtabs_matching_filename): Rewrite. * quick-symbol.h (struct quick_symbol_functions) <map_symtabs_matching_filename>: Remove. * psymtab.c (partial_map_expand_apply) (psymbol_functions::map_symtabs_matching_filename): Remove. * psympriv.h (struct psymbol_functions) <map_symtabs_matching_filename>: Remove. * objfiles.h (struct objfile) <map_symtabs_matching_filename>: Update comment. * dwarf2/read.c (struct dwarf2_base_index_functions) <map_symtabs_matching_filename>: Remove. (dw2_map_expand_apply) (dwarf2_base_index_functions::map_symtabs_matching_filename): Remove.
Diffstat (limited to 'gdb/symfile-debug.c')
-rw-r--r--gdb/symfile-debug.c53
1 files changed, 47 insertions, 6 deletions
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 0535f41..cc31fc0 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -33,6 +33,7 @@
#include "symtab.h"
#include "symfile.h"
#include "block.h"
+#include "filenames.h"
/* We need to save a pointer to the real symbol functions.
Plus, the debug versions are malloc'd because we have to NULL out the
@@ -146,13 +147,51 @@ objfile::map_symtabs_matching_filename
real_path ? real_path : NULL,
host_address_to_string (&callback));
- bool retval = false;
+ bool retval = true;
+ const char *name_basename = lbasename (name);
+
+ auto match_one_filename = [&] (const char *filename, bool basenames)
+ {
+ if (compare_filenames_for_search (filename, name))
+ return true;
+ if (basenames && FILENAME_CMP (name_basename, filename) == 0)
+ return true;
+ if (real_path != nullptr && IS_ABSOLUTE_PATH (filename)
+ && IS_ABSOLUTE_PATH (real_path))
+ return filename_cmp (filename, real_path) == 0;
+ return false;
+ };
+
+ compunit_symtab *last_made = this->compunit_symtabs;
+
+ auto on_expansion = [&] (compunit_symtab *symtab)
+ {
+ /* The callback to iterate_over_some_symtabs returns false to keep
+ going and true to continue, so we have to invert the result
+ here, for expand_symtabs_matching. */
+ bool result = !iterate_over_some_symtabs (name, real_path,
+ this->compunit_symtabs,
+ last_made,
+ callback);
+ last_made = this->compunit_symtabs;
+ return result;
+ };
+
for (const auto &iter : qf)
{
- retval = (iter->map_symtabs_matching_filename
- (this, name, real_path, callback));
- if (retval)
- break;
+ if (!iter->expand_symtabs_matching (this,
+ match_one_filename,
+ nullptr,
+ nullptr,
+ on_expansion,
+ (SEARCH_GLOBAL_BLOCK
+ | SEARCH_STATIC_BLOCK),
+ UNDEF_DOMAIN,
+ ALL_DOMAIN))
+ {
+ retval = false;
+ break;
+ }
}
if (debug_symfile)
@@ -160,7 +199,9 @@ objfile::map_symtabs_matching_filename
"qf->map_symtabs_matching_filename (...) = %d\n",
retval);
- return retval;
+ /* We must re-invert the return value here to match the caller's
+ expectations. */
+ return !retval;
}
struct compunit_symtab *