diff --git a/gdb/dictionary.c b/gdb/dictionary.c index 4f8df240a3e..f3dfe092830 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -650,7 +650,18 @@ insert_symbol_hashed (struct dictionary *dict, static int size_hashed (const struct dictionary *dict) { - return DICT_HASHED_NBUCKETS (dict); + int nbuckets = DICT_HASHED_NBUCKETS (dict); + int total = 0; + + for (int i = 0; i < nbuckets; ++i) + { + for (struct symbol *sym = DICT_HASHED_BUCKET (dict, i); + sym != nullptr; + sym = sym->hash_next) + total++; + } + + return total; } /* Functions only for DICT_HASHED_EXPANDABLE. */ diff --git a/gdb/dictionary.h b/gdb/dictionary.h index d982396cb31..44bd075fcf2 100644 --- a/gdb/dictionary.h +++ b/gdb/dictionary.h @@ -159,8 +159,7 @@ extern struct symbol * extern struct symbol *mdict_iter_match_next (const lookup_name_info &name, struct mdict_iterator *miterator); -/* Return some notion of the size of the multidictionary: the number of - symbols if we have that, the number of hash buckets otherwise. */ +/* Return the number of symbols in multidictionary MDICT. */ extern int mdict_size (const struct multidictionary *mdict); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index a2f90277227..a65552aa2d2 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -286,7 +286,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) /* drow/2002-07-10: We could save the total symbols count even if we're using a hashtable, but nothing else but this message wants it. */ - gdb_printf (outfile, ", %d syms/buckets in ", + gdb_printf (outfile, ", %d symbols in ", mdict_size (b->multidict ())); gdb_puts (paddress (gdbarch, b->start ()), outfile); gdb_printf (outfile, "..");