public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb/origin/users/ssbssa/pdb-reader-preview] PDB: cache types
@ 2022-04-11 17:40 Hannes Domani
0 siblings, 0 replies; only message in thread
From: Hannes Domani @ 2022-04-11 17:40 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e4405d097d465efe60f42992bcd2067ca530eb45
commit e4405d097d465efe60f42992bcd2067ca530eb45
Author: Hannes Domani <ssbssa@yahoo.de>
Date: Mon Apr 11 17:27:46 2022 +0200
PDB: cache types
Diff:
---
gdb/windows-nat.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 59fbae765cd..e7930e931ef 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -3297,6 +3297,7 @@ struct pdb_line_info
SymGetTypeInfo_ftype *fSymGetTypeInfo;
DWORD64 addr;
DWORD64 max_addr;
+ std::vector<type *> cache;
};
@@ -3315,7 +3316,9 @@ static const char *wchar_to_objfile (pdb_line_info *pli, WCHAR *nameW)
return pli->objfile->intern (name.get ());
}
-static type *get_pdb_type (pdb_line_info *pli, DWORD type_index)
+static type *get_pdb_type (pdb_line_info *pli, DWORD type_index);
+
+static type *get_pdb_type_cached (pdb_line_info *pli, DWORD type_index)
{
const struct objfile_type *ot = objfile_type (pli->objfile);
@@ -3451,6 +3454,8 @@ static type *get_pdb_type (pdb_line_info *pli, DWORD type_index)
type *t = alloc_type (pli->objfile);
INIT_CPLUS_SPECIFIC (t);
+ pli->cache[type_index] = t;
+
t->set_name (wchar_to_objfile (pli, nameW));
if (udtkind == UdtUnion)
@@ -3517,6 +3522,19 @@ static type *get_pdb_type (pdb_line_info *pli, DWORD type_index)
return ot->builtin_void;
}
+static type *get_pdb_type (pdb_line_info *pli, DWORD type_index)
+{
+ if (type_index >= pli->cache.size ())
+ pli->cache.resize (type_index + 1, nullptr);
+ else if (pli->cache[type_index] != nullptr)
+ return pli->cache[type_index];
+
+ type *t = get_pdb_type_cached (pli, type_index);
+ pli->cache[type_index] = t;
+
+ return t;
+}
+
static BOOL CALLBACK symbol_callback(PSYMBOL_INFO si,
ULONG /*SymbolSize*/, PVOID UserContext)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-11 17:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 17:40 [binutils-gdb/origin/users/ssbssa/pdb-reader-preview] PDB: cache types Hannes Domani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).