]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/symtab] Add sect_off map to partial_symtab
authorTom de Vries <tdevries@suse.de>
Mon, 21 Jun 2021 10:19:00 +0000 (12:19 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 24 Jun 2021 15:44:35 +0000 (17:44 +0200)
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.

gdb/psympriv.h

index 59dd66f57e5d58dc94f1bd5935a4fd74ac3a15d2..246891d65d2f1edb10efd35ca3fe5a8c17941c3a 100644 (file)
@@ -24,6 +24,8 @@
 #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.
@@ -343,6 +345,10 @@ struct partial_symtab
 
   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.  */