[Lldb-commits] [PATCH] D137900: Make only one function that needs to be implemented when searching for types.
Greg Clayton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 14 13:39:12 PST 2022
clayborg added a comment.
I just got time to run a quick comparison to see how much more efficient this patch is over what we currently have when doing lookups. Since we only resolve types whose context matches now, we parse many orders of magnitude fewer types. I added the following log line into SymbolFileDWARF::ParseType(...):
LLDB_LOG(GetLog(LLDBLog::Symbols), "ParseType for die @ {0:x} {1} (\"{2}\")", die.GetOffset(), die.GetTagAsCString(), die.GetName());
And in this fixed LLDB we see we find resolve 10 types when searching a debug version of LLDB when searching for "llvm::StringRef::iterator":
(lldb) target create "../Debug/bin/lldb"
Current executable set to '/Users/gclayton/Documents/src/lldb/main/Debug/bin/lldb' (arm64).
(lldb) log enable lldb symbol
(lldb) type lookup llvm::StringRef::iterator
ParseType for die @ 0x2265 DW_TAG_typedef ("iterator")
ParseType for die @ 0x2187 DW_TAG_class_type ("StringRef")
ParseType for die @ 0x12e DW_TAG_typedef ("iterator")
ParseType for die @ 0x50 DW_TAG_class_type ("StringRef")
ParseType for die @ 0x8fb0d DW_TAG_pointer_type ("")
ParseType for die @ 0x8fb12 DW_TAG_const_type ("")
ParseType for die @ 0x8fb18 DW_TAG_base_type ("char")
ParseType for die @ 0x28efa DW_TAG_pointer_type ("")
ParseType for die @ 0x28eff DW_TAG_const_type ("")
ParseType for die @ 0x28f05 DW_TAG_base_type ("char")
const char *
const char *
(lldb) quit
So we parse 10 types now, where as before we parsed 2242541 types. I picked the typename "llvm::StringRef::iterator" because the previous code would have done a lookup on "iterator" and then weed out the resolved types before returning to the user. The old LLDB will every single "iterator" in any STL class, or any LLVM classes. And along the way it will resolve the containing classes and all of the types needed for the methods in the class, etc.
So this type lookup is 5 orders of magnitude better than we used to be!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137900/new/
https://reviews.llvm.org/D137900
More information about the lldb-commits
mailing list