+2021-03-20 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.c (dwarf2_base_index_functions::print_stats): Add
+ print_bcache parameter.
+ * symfile-debug.c (objfile::print_stats): Add print_bcache
+ parameter.
+ * quick-symbol.h (struct quick_symbol_functions)
+ <print_stats>: Add print_bcache parameter.
+ * symmisc.c (print_symbol_bcache_statistics, count_psyms): Move
+ code to psymtab.c.
+ (print_objfile_statistics): Move psymtab code to psymtab.c.
+ * psymtab.c (count_psyms): Move from symmisc.c.
+ (psymbol_functions::print_stats): Print partial symbol and bcache
+ statistics. Add print_bcache parameter.
+ * objfiles.h (print_symbol_bcache_statistics): Don't declare.
+ (struct objfile) <print_stats>: Add print_bcache parameter.
+ * maint.c (maintenance_print_statistics): Update.
+
2021-03-20 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_bfd) <psymtabs_addrmap>: New
return language_unknown;
}
- void print_stats (struct objfile *objfile) override;
+ void print_stats (struct objfile *objfile, bool print_bcache) override;
void expand_all_symtabs (struct objfile *objfile) override;
}
void
-dwarf2_base_index_functions::print_stats (struct objfile *objfile)
+dwarf2_base_index_functions::print_stats (struct objfile *objfile,
+ bool print_bcache)
{
+ if (print_bcache)
+ return;
+
dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
int total = (per_objfile->per_bfd->all_comp_units.size ()
+ per_objfile->per_bfd->all_type_units.size ());
maintenance_print_statistics (const char *args, int from_tty)
{
print_objfile_statistics ();
- print_symbol_bcache_statistics ();
}
static void
#define OBJSTAT(objfile, expr) (objfile -> stats.expr)
#define OBJSTATS struct objstats stats
extern void print_objfile_statistics (void);
-extern void print_symbol_bcache_statistics (void);
/* Number of entries in the minimal symbol hash table. */
#define MINIMAL_SYMBOL_HASH_SIZE 2039
domain_enum domain);
/* See quick_symbol_functions. */
- void print_stats ();
+ void print_stats (bool print_bcache);
/* See quick_symbol_functions. */
void dump ();
domain_enum domain,
bool *symbol_found_p) override;
- void print_stats (struct objfile *objfile) override;
+ void print_stats (struct objfile *objfile, bool print_bcache) override;
void dump (struct objfile *objfile) override;
fprintf_filtered (outfile, "\n");
}
+/* Count the number of partial symbols in OBJFILE. */
+
+static int
+count_psyms (struct objfile *objfile)
+{
+ int count = 0;
+ for (partial_symtab *pst : objfile->psymtabs ())
+ {
+ count += pst->global_psymbols.size ();
+ count += pst->static_psymbols.size ();
+ }
+ return count;
+}
+
/* Psymtab version of print_stats. See its definition in
the definition of quick_symbol_functions in symfile.h. */
void
-psymbol_functions::print_stats (struct objfile *objfile)
+psymbol_functions::print_stats (struct objfile *objfile, bool print_bcache)
{
int i;
- i = 0;
- for (partial_symtab *ps : require_partial_symbols (objfile, true))
+ if (!print_bcache)
+ {
+ int n_psyms = count_psyms (objfile);
+ if (n_psyms > 0)
+ printf_filtered (_(" Number of \"partial\" symbols read: %d\n"),
+ n_psyms);
+
+ i = 0;
+ for (partial_symtab *ps : require_partial_symbols (objfile, true))
+ {
+ if (!ps->readin_p (objfile))
+ i++;
+ }
+ printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"),
+ i);
+ printf_filtered (_(" Total memory used for psymbol cache: %d\n"),
+ objfile->partial_symtabs->psymbol_cache.memory_used ());
+ }
+ else
{
- if (!ps->readin_p (objfile))
- i++;
+ printf_filtered (_("Psymbol byte cache statistics:\n"));
+ objfile->partial_symtabs->psymbol_cache.print_statistics
+ ("partial symbol cache");
}
- printf_filtered (_(" Number of psym tables (not yet expanded): %d\n"), i);
}
/* Psymtab version of dump. See its definition in
/* Print statistics about any indices loaded for OBJFILE. The
statistics should be printed to gdb_stdout. This is used for
- "maint print statistics". */
- virtual void print_stats (struct objfile *objfile) = 0;
+ "maint print statistics". Statistics are printed in two
+ sections. PRINT_BCACHE is false when printing the first section
+ of general statistics, and true when printing bcache statistics. */
+ virtual void print_stats (struct objfile *objfile, bool print_bcache) = 0;
/* Dump any indices loaded for OBJFILE. The dump should go to
gdb_stdout. This is used for "maint print objfiles". */
}
void
-objfile::print_stats ()
+objfile::print_stats (bool print_bcache)
{
if (debug_symfile)
- fprintf_filtered (gdb_stdlog, "qf->print_stats (%s)\n",
- objfile_debug_name (this));
+ fprintf_filtered (gdb_stdlog, "qf->print_stats (%s, %d)\n",
+ objfile_debug_name (this), print_bcache);
if (qf != nullptr)
- qf->print_stats (this);
+ qf->print_stats (this, print_bcache);
}
void
#include "source.h"
#include "readline/tilde.h"
-#include "psymtab.h"
-#include "psympriv.h"
-
/* Prototypes for local functions */
static int block_depth (const struct block *);
int depth, ui_file *outfile);
\f
-void
-print_symbol_bcache_statistics (void)
-{
- for (struct program_space *pspace : program_spaces)
- for (objfile *objfile : pspace->objfiles ())
- {
- QUIT;
- printf_filtered (_("Byte cache statistics for '%s':\n"),
- objfile_name (objfile));
- objfile->partial_symtabs->psymbol_cache.print_statistics
- ("partial symbol cache");
- objfile->per_bfd->string_cache.print_statistics ("string cache");
- }
-}
-
-/* Count the number of partial symbols in OBJFILE. */
-
-static int
-count_psyms (struct objfile *objfile)
-{
- int count = 0;
- for (partial_symtab *pst : objfile->psymtabs ())
- {
- count += pst->global_psymbols.size ();
- count += pst->static_psymbols.size ();
- }
- return count;
-}
-
void
print_objfile_statistics (void)
{
if (objfile->per_bfd->n_minsyms > 0)
printf_filtered (_(" Number of \"minimal\" symbols read: %d\n"),
objfile->per_bfd->n_minsyms);
-
- int n_psyms = count_psyms (objfile);
- if (n_psyms > 0)
- printf_filtered (_(" Number of \"partial\" symbols read: %d\n"),
- n_psyms);
if (OBJSTAT (objfile, n_syms) > 0)
printf_filtered (_(" Number of \"full\" symbols read: %d\n"),
OBJSTAT (objfile, n_syms));
if (OBJSTAT (objfile, n_types) > 0)
printf_filtered (_(" Number of \"types\" defined: %d\n"),
OBJSTAT (objfile, n_types));
- objfile->print_stats ();
+
i = linetables = 0;
for (compunit_symtab *cu : objfile->compunits ())
{
printf_filtered (_(" Number of symbol tables with blockvectors: %d\n"),
blockvectors);
+ objfile->print_stats (false);
+
if (OBJSTAT (objfile, sz_strtab) > 0)
printf_filtered (_(" Space used by string tables: %d\n"),
OBJSTAT (objfile, sz_strtab));
printf_filtered (_(" Total memory used for BFD obstack: %s\n"),
pulongest (obstack_memory_used (&objfile->per_bfd
->storage_obstack)));
- printf_filtered
- (_(" Total memory used for psymbol cache: %d\n"),
- objfile->partial_symtabs->psymbol_cache.memory_used ());
+
printf_filtered (_(" Total memory used for string cache: %d\n"),
objfile->per_bfd->string_cache.memory_used ());
+ printf_filtered (_("Byte cache statistics for '%s':\n"),
+ objfile_name (objfile));
+ objfile->per_bfd->string_cache.print_statistics ("string cache");
+ objfile->print_stats (true);
}
}
+2021-03-20 Tom Tromey <tom@tromey.com>
+
+ * gdb.base/maint.exp: Update "maint print statistics" output.
+
2021-03-19 Kevin Buettner <kevinb@redhat.com>
* lib/gdbserver-support.exp (gdbserver_exit): Use the
send_gdb "maint print statistics\n"
gdb_expect {
- -re "Statistics for\[^\n\r\]*maint\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n( Number of \"partial\" symbols read: $decimal\r\n)? Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n( Number of psym tables \\(not yet expanded\\): $decimal\r\n)?( Number of read CUs: $decimal\r\n Number of unread CUs: $decimal\r\n)? Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for BFD obstack: $decimal\r\n Total memory used for psymbol cache: $decimal\r\n Total memory used for string cache: $decimal\r\n" {
+ -re "Statistics for\[^\n\r\]*maint\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n( Number of read CUs: $decimal\r\n Number of unread CUs: $decimal\r\n)? Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n( Number of \"partial\" symbols read: $decimal\r\n)?( Number of psym tables \\(not yet expanded\\): $decimal\r\n)? Total memory used for psymbol cache: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for BFD obstack: $decimal\r\n Total memory used for string cache: $decimal\r\n" {
gdb_expect {
-re "$gdb_prompt $" {
pass "maint print statistics"