aboutsummaryrefslogtreecommitdiff
path: root/gdb/symmisc.c
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-05-19 21:42:39 +0100
committerAndrew Burgess <aburgess@redhat.com>2023-07-04 12:07:16 +0100
commitb8c2de06bcbc13a1a6b93163cf675272d7eada9f (patch)
treeb8a35c8831b8aae1f4029a65cca03fe393d277d5 /gdb/symmisc.c
parenta34339a82fab6aacb87d0b2338fcf8812260286b (diff)
downloadgdb-b8c2de06bcbc13a1a6b93163cf675272d7eada9f.zip
gdb-b8c2de06bcbc13a1a6b93163cf675272d7eada9f.tar.gz
gdb-b8c2de06bcbc13a1a6b93163cf675272d7eada9f.tar.bz2
gdb: have mdict_size always return a symbol count
In the next commit we would like to have mdict_size return the number of symbols in the dictionary, currently mdict_size is just a heuristic, sometimes it returns the number of symbols, and sometimes the number of buckets in a hashing dictionary (see size_hashed in dictionary.c). Currently this vague notion of size is good enough, the only place mdict_size is used is in a maintenance command in order to print a message containing the size of the dictionary ... so we don't really care that the value isn't correct. However, in the next commit we do want the size returned to be the number of symbols in the dictionary, so this commit makes mdict_size return the symbol count in all cases. The new use is still not on a hot path -- it's going to be a Python __repr__ method, so all I do in this commit is have size_hashed walk the dictionary and count the entries, obviously this could be slow if we have a large number of symbols, but for now I'm not worrying about that case. We could always store the symbol count if we wanted, but that would increase the size of every dictionary for a use case that isn't going to be hit that often. I've updated the text in 'maint print symbols' so that we don't talk about the size being 'syms/buckets', but just 'symbols' now.
Diffstat (limited to 'gdb/symmisc.c')
-rw-r--r--gdb/symmisc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index a2f9027..a65552a 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, "..");