From: Tom de Vries Date: Mon, 21 Jun 2021 10:19:00 +0000 (+0200) Subject: [gdb/symtab] Add sect_off map to partial_symtab X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3d638484949f751aa8c7a8612faf49b6c761812;p=thirdparty%2Fbinutils-gdb.git [gdb/symtab] Add sect_off map to partial_symtab 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. --- diff --git a/gdb/psympriv.h b/gdb/psympriv.h index 59dd66f57e5..246891d65d2 100644 --- a/gdb/psympriv.h +++ b/gdb/psympriv.h @@ -24,6 +24,8 @@ #include "objfiles.h" #include "gdbsupport/gdb_string_view.h" +#include + /* 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. @@ -343,6 +345,10 @@ struct partial_symtab std::vector static_psymbols; + /* The sect_offset corresponding to the partial symbols in this partial + symbol table. */ + std::unordered_map 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. */