+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * dwarf2/read.c (struct dwarf2_base_index_functions)
+ <has_unexpanded_symtabs>: Declare.
+ (dwarf2_base_index_functions::has_unexpanded_symtabs): Define new
+ function.
+ * objfiles.h (struct objfile) <has_unexpanded_symtabs>: Declare.
+ * psympriv.h (struct psymbol_functions) <has_unexpanded_symtabs>:
+ Declare.
+ * psymtab.c (psymbol_functions::has_unexpanded_symtabs): Define
+ new function.
+ * quick-symbol.h (struct quick_symbol_functions)
+ <has_unexpanded_symtabs>: Declare.
+ * symfile-debug.c (objfile::has_unexpanded_symtabs): Define new
+ function.
+
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
* infcall.c (call_function_by_hand_dummy): Add missing 'else' when
{
bool has_symbols (struct objfile *objfile) override;
+ bool has_unexpanded_symtabs (struct objfile *objfile) override;
+
struct symtab *find_last_source_symtab (struct objfile *objfile) override;
void forget_cached_source_info (struct objfile *objfile) override;
return true;
}
+/* See quick_symbol_functions::has_unexpanded_symtabs in quick-symbol.h. */
+
+bool
+dwarf2_base_index_functions::has_unexpanded_symtabs (struct objfile *objfile)
+{
+ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
+
+ for (const auto &per_cu : per_objfile->per_bfd->all_comp_units)
+ {
+ /* Is this already expanded? */
+ if (per_objfile->symtab_set_p (per_cu.get ()))
+ continue;
+
+ /* It has not yet been expanded. */
+ return true;
+ }
+
+ return false;
+}
+
/* DWARF-5 debug_names reader. */
/* DWARF-5 augmentation string for GDB's DW_IDX_GNU_* extension. */
bool has_partial_symbols ();
+ /* Return true if this objfile has any unexpanded symbols. A return
+ value of false indicates either, that this objfile has all its
+ symbols fully expanded (i.e. fully read in), or that this objfile has
+ no symbols at all (i.e. no debug information). */
+ bool has_unexpanded_symtabs ();
+
/* See quick_symbol_functions. */
struct symtab *find_last_source_symtab ();
bool has_symbols (struct objfile *objfile) override;
+ bool has_unexpanded_symtabs (struct objfile *objfile) override;
+
struct symtab *find_last_source_symtab (struct objfile *objfile) override;
void forget_cached_source_info (struct objfile *objfile) override;
return m_partial_symtabs->psymtabs != NULL;
}
+/* See quick_symbol_functions::has_unexpanded_symtabs in quick-symbol.h. */
+
+bool
+psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile)
+{
+ for (partial_symtab *psymtab : require_partial_symbols (objfile))
+ {
+ /* Is this already expanded? */
+ if (psymtab->readin_p (objfile))
+ continue;
+
+ /* It has not yet been expanded. */
+ return true;
+ }
+
+ return false;
+}
+
/* Helper function for psym_find_compunit_symtab_by_address that fills
in m_psymbol_map for a given range of psymbols. */
available. */
virtual bool has_symbols (struct objfile *objfile) = 0;
+ /* Return true if OBJFILE has any unexpanded symtabs. A return value of
+ false indicates there are no unexpanded symtabs, this might mean that
+ all of the symtabs have been expanded (full debug has been read in),
+ or it might been that OBJFILE has no debug information. */
+ virtual bool has_unexpanded_symtabs (struct objfile *objfile) = 0;
+
/* Return the symbol table for the "last" file appearing in
OBJFILE. */
virtual struct symtab *find_last_source_symtab (struct objfile *objfile) = 0;
return retval;
}
+/* See objfiles.h. */
+bool
+objfile::has_unexpanded_symtabs ()
+{
+ if (debug_symfile)
+ fprintf_filtered (gdb_stdlog, "qf->has_unexpanded_symtabs (%s)\n",
+ objfile_debug_name (this));
+
+ bool result = false;
+ for (const auto &iter : qf)
+ {
+ if (iter->has_unexpanded_symtabs (this))
+ {
+ result = true;
+ break;
+ }
+ }
+
+ if (debug_symfile)
+ fprintf_filtered (gdb_stdlog, "qf->has_unexpanded_symtabs (%s) = %d\n",
+ objfile_debug_name (this), (result ? 1 : 0));
+
+ return result;
+}
+
struct symtab *
objfile::find_last_source_symtab ()
{