[Lldb-commits] [lldb] [lldb][Windows] Reuse preloaded exe module on launch (PR #210010)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 17 08:11:53 PDT 2026
https://github.com/charles-zablit updated https://github.com/llvm/llvm-project/pull/210010
>From 550f1a9574f605e3d567d80eb26af4421f3b98fa Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 16 Jul 2026 09:52:18 +0100
Subject: [PATCH 1/2] [lldb][Windows] Reuse preloaded exe module on launch
---
.../Process/Windows/Common/ProcessWindows.cpp | 29 +++++++++----------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 08a5d24b3db9d..4161cf50a2398 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -645,22 +645,21 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) {
LLDB_LOG(log, "Debugger connected to process {0}. Image base = {1:x}",
debugger->GetProcess().GetProcessId(), image_base);
- ModuleSP module;
- // During attach, we won't have the executable module, so find it now.
- const DWORD pid = debugger->GetProcess().GetProcessId();
- const std::string file_name = GetProcessExecutableName(pid);
- if (file_name.empty()) {
- return;
- }
-
- FileSpec executable_file(file_name);
- FileSystem::Instance().Resolve(executable_file);
- ModuleSpec module_spec(executable_file);
- Status error;
- module =
- GetTarget().GetOrCreateModule(module_spec, true /* notify */, &error);
+ ModuleSP module = GetTarget().GetExecutableModule();
if (!module) {
- return;
+ const DWORD pid = debugger->GetProcess().GetProcessId();
+ const std::string file_name = GetProcessExecutableName(pid);
+ if (file_name.empty())
+ return;
+
+ FileSpec executable_file(file_name);
+ FileSystem::Instance().Resolve(executable_file);
+ ModuleSpec module_spec(executable_file);
+ Status error;
+ module =
+ GetTarget().GetOrCreateModule(module_spec, /*notify=*/true, &error);
+ if (!module)
+ return;
}
GetTarget().SetExecutableModule(module, eLoadDependentsNo);
>From 5ecd6753b76ebc8955f52b79517960dd08a7ee4a Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Fri, 17 Jul 2026 17:11:36 +0200
Subject: [PATCH 2/2] fixup! [lldb][Windows] Reuse preloaded exe module on
launch
---
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 4161cf50a2398..7a196820cf744 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -660,10 +660,9 @@ void ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) {
GetTarget().GetOrCreateModule(module_spec, /*notify=*/true, &error);
if (!module)
return;
+ GetTarget().SetExecutableModule(module, eLoadDependentsNo);
}
- GetTarget().SetExecutableModule(module, eLoadDependentsNo);
-
if (auto dyld = GetDynamicLoader())
dyld->OnLoadModule(module, ModuleSpec(), image_base);
More information about the lldb-commits
mailing list