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/symmisc.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/symmisc.c')
-rw-r--r-- | gdb/symmisc.c | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 0aab30d..9ea5cb5 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -38,9 +38,6 @@ #include "source.h" #include "readline/tilde.h" -#include "psymtab.h" -#include "psympriv.h" - /* Prototypes for local functions */ static int block_depth (const struct block *); @@ -50,35 +47,6 @@ static void print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, 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) { int i, linetables, blockvectors; @@ -94,18 +62,13 @@ 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 ()) { @@ -124,6 +87,8 @@ print_objfile_statistics (void) 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)); @@ -133,11 +98,13 @@ print_objfile_statistics (void) 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); } } |