diff options
author | Tom Tromey <tom@tromey.com> | 2021-03-20 17:23:40 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-03-20 17:23:43 -0600 |
commit | 4829711b6ba57568d5fec3c2e8c747a2edb2aa8f (patch) | |
tree | b5b258588ea8fec7c998f3ac22281befc70fc076 /gdb/psymtab.c | |
parent | efd7398ee26dc8f810243fc893590df4a8cd3238 (diff) | |
download | gdb-4829711b6ba57568d5fec3c2e8c747a2edb2aa8f.zip gdb-4829711b6ba57568d5fec3c2e8c747a2edb2aa8f.tar.gz gdb-4829711b6ba57568d5fec3c2e8c747a2edb2aa8f.tar.bz2 |
Move psymtab statistics printing to psymtab.c
This moves all the psymtab statistics printing code form symmisc.c to
psymtab.c. This changes the formatting of the output a little, but
considering that it is a maint command (and, I assume, a rarely used
one), this seems fine to me.
This change helps further dissociate the psymtab from the objfile. In
the end there will be no direct connect -- only via the
quick_symbol_functions interface.
gdb/ChangeLog
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.
gdb/testsuite/ChangeLog
2021-03-20 Tom Tromey <tom@tromey.com>
* gdb.base/maint.exp: Update "maint print statistics" output.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r-- | gdb/psymtab.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 45a4db7..867b715 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -975,21 +975,52 @@ dump_psymtab (struct objfile *objfile, struct partial_symtab *psymtab, 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 |