[Lldb-commits] [PATCH] D121480: [lldb] Move Module::FindTypes scoped timer to SymbolFileDWARFDebugMap

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 11 11:23:12 PST 2022


kastiglione created this revision.
kastiglione added reviewers: aprantl, augusto2112, JDevlieghere.
kastiglione added projects: All, LLDB.
kastiglione requested review of this revision.

When debugging via debug map, `Module::FindTypes` is called for very frequently
due to lookups happening over the possibly large set of object files.

Where a scoped timer is useful, it can placed in `SymbolFile` subclasses. This
change adds a scoped timer to `SymbolFileDWARFDebugMap::FindTypes`.

Also, deletes some nearby long commented out code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121480

Files:
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1167,25 +1167,13 @@
     llvm::ArrayRef<CompilerContext> context, LanguageSet languages,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
+  LLDB_SCOPED_TIMER();
   ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
     oso_dwarf->FindTypes(context, languages, searched_symbol_files, types);
     return false;
   });
 }
 
-//
-// uint32_t
-// SymbolFileDWARFDebugMap::FindTypes (const SymbolContext& sc, const
-// RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding
-// encoding, lldb::user_id_t udt_uid, TypeList& types)
-//{
-//  SymbolFileDWARF *oso_dwarf = GetSymbolFile (sc);
-//  if (oso_dwarf)
-//      return oso_dwarf->FindTypes (sc, regex, append, max_matches, encoding,
-//      udt_uid, types);
-//  return 0;
-//}
-
 CompilerDeclContext SymbolFileDWARFDebugMap::FindNamespace(
     lldb_private::ConstString name,
     const CompilerDeclContext &parent_decl_ctx) {
Index: lldb/source/Core/Module.cpp
===================================================================
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1025,7 +1025,9 @@
     llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
-  LLDB_SCOPED_TIMER();
+  // If a scoped timer is needed, place it in a SymbolFile::FindTypes override.
+  // A timer here is too high volume for some cases, for example when calling
+  // FindTypes on each object file.
   if (SymbolFile *symbols = GetSymbolFile())
     symbols->FindTypes(pattern, languages, searched_symbol_files, types);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121480.414710.patch
Type: text/x-patch
Size: 1939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220311/8c540580/attachment-0001.bin>


More information about the lldb-commits mailing list