[Lldb-commits] [lldb] fa593b0 - Revert "[lldb] parallelize calling of Module::PreloadSymbols()"

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon May 9 02:11:07 PDT 2022


Author: Pavel Labath
Date: 2022-05-09T11:11:01+02:00
New Revision: fa593b079b76f1c30d684cfe42a662fed157e2e5

URL: https://github.com/llvm/llvm-project/commit/fa593b079b76f1c30d684cfe42a662fed157e2e5
DIFF: https://github.com/llvm/llvm-project/commit/fa593b079b76f1c30d684cfe42a662fed157e2e5.diff

LOG: Revert "[lldb] parallelize calling of Module::PreloadSymbols()"

This reverts commit b7d807dbcff0d9df466e0312b4fef57178d207be -- it
breaks TestMultipleDebuggers.py.

Added: 
    

Modified: 
    lldb/source/Target/Target.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index d6ad333957e11..ed733f2645c3a 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -62,7 +62,6 @@
 
 #include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SetVector.h"
-#include "llvm/Support/ThreadPool.h"
 
 #include <memory>
 #include <mutex>
@@ -1624,17 +1623,6 @@ void Target::NotifyModulesRemoved(lldb_private::ModuleList &module_list) {
 void Target::ModulesDidLoad(ModuleList &module_list) {
   const size_t num_images = module_list.GetSize();
   if (m_valid && num_images) {
-    if (GetPreloadSymbols()) {
-      // Try to preload symbols in parallel.
-      llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
-      auto preload_symbols_fn = [&](size_t idx) {
-        ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
-        module_sp->PreloadSymbols();
-      };
-      for (size_t idx = 0; idx < num_images; ++idx)
-        task_group.async(preload_symbols_fn, idx);
-      task_group.wait();
-    }
     for (size_t idx = 0; idx < num_images; ++idx) {
       ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
       LoadScriptingResourceForModule(module_sp, this);
@@ -2182,6 +2170,11 @@ ModuleSP Target::GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
           });
         }
 
+        // Preload symbols outside of any lock, so hopefully we can do this for
+        // each library in parallel.
+        if (GetPreloadSymbols())
+          module_sp->PreloadSymbols();
+
         llvm::SmallVector<ModuleSP, 1> replaced_modules;
         for (ModuleSP &old_module_sp : old_modules) {
           if (m_images.GetIndexForModule(old_module_sp.get()) !=


        


More information about the lldb-commits mailing list