+2020-11-01 Tom Tromey <tom@tromey.com>
+
+ * symmisc.c (count_psyms): New function.
+ (print_objfile_statistics): Use it.
+ * psymtab.c (append_psymbol_to_list): Remove.
+ (partial_symtab::add_psymbol): Inline append_psymbol_to_list.
+ * objfiles.h (struct objstats) <n_psyms>: Remove.
+
2020-11-01 Tom Tromey <tom@tromey.com>
* dbxread.c (dbx_end_psymtab): Update.
(&psymbol, sizeof (struct partial_symbol), added));
}
-/* Helper function, adds partial symbol to the given partial symbol list. */
-
-static void
-append_psymbol_to_list (std::vector<partial_symbol *> &list,
- struct partial_symbol *psym,
- struct objfile *objfile)
-{
- list.push_back (psym);
- OBJSTAT (objfile, n_psyms++);
-}
-
/* See psympriv.h. */
void
= (where == psymbol_placement::STATIC
? static_psymbols
: global_psymbols);
- append_psymbol_to_list (list, psym, objfile);
+ list.push_back (psym);
}
/* See psympriv.h. */
#include "readline/tilde.h"
#include "psymtab.h"
+#include "psympriv.h"
/* Unfortunately for debugging, stderr is usually a macro. This is painful
when calling functions that take FILE *'s from the debugger.
}
}
+/* 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);
- if (OBJSTAT (objfile, n_psyms) > 0)
+
+ int n_psyms = count_psyms (objfile);
+ if (n_psyms > 0)
printf_filtered (_(" Number of \"partial\" symbols read: %d\n"),
- OBJSTAT (objfile, n_psyms));
+ n_psyms);
if (OBJSTAT (objfile, n_syms) > 0)
printf_filtered (_(" Number of \"full\" symbols read: %d\n"),
OBJSTAT (objfile, n_syms));