https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/210010
Recreating the module everytime causes the path to be canonicalized. This does not work well with subst drives, because the newly created module will not have the correct drive path, causing breakpoints to be unresolved. This patch fixes this by first attempting to reuse the existing module if it exists. >From 550f1a9574f605e3d567d80eb26af4421f3b98fa Mon Sep 17 00:00:00 2001 From: Charles Zablit <[email protected]> Date: Thu, 16 Jul 2026 09:52:18 +0100 Subject: [PATCH] [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); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
