Initially, we added a sect_off field to partial_symbol, but that turned out
to make the bcache aspect of partial symbols ineffective, changing the
"percentage of duplicates" for "partial symbol cache" as reported by "maint
print statistics" from 95% to 0%.
This showed up both as a slow down and more memory usage.
At least parts of the slow down could possibly be addressed by removing the
bcache aspect entirely (given that there are no duplicates), but that wouldn't
address the increase in memory usage.
Instead, implement the sect_off field as a side table.
#include "objfiles.h"
#include "gdbsupport/gdb_string_view.h"
+#include <unordered_map>
+
/* A partial_symbol records the name, domain, and address class of
symbols whose types we have not parsed yet. For functions, it also
contains their memory address, so we can find them from a PC value.
std::vector<partial_symbol *> static_psymbols;
+ /* The sect_offset corresponding to the partial symbols in this partial
+ symbol table. */
+ std::unordered_map<partial_symbol *, sect_offset> sect_off;
+
/* True iff objfile->psymtabs_addrmap is properly populated for this
partial_symtab. For discontiguous overlapping psymtabs is the only usable
info in PSYMTABS_ADDRMAP. */