[Lldb-commits] [lldb] [lldb][Windows] Register the shadow listener in PlatformWindows (PR #227277)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 29 04:20:39 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
`PlatformWindows::DebugProcess` and `PlatformWindows::Attach` create the Process and hijack its events, but never call `Process::SetShadowListener` with the listener from the launch or attach info. `PlatformPOSIX`, `PlatformRemoteGDBServer` and `Target::Launch`'s all do.
On Windows a shadow listener set with `SBLaunchInfo::SetShadowListener` therefore never gets an event, which is why `TestEvents.test_shadow_listener` failed on every run (`"Shadow listener got event too"`) on both the lldb-server and the in-process backend.
Call `SetShadowListener` in both, and in Attach only touch `process_sp` once it is known to be non-null (HijackProcessEvents was called before the null check).
I was able to reproduce the failure at desk on a machine that's under load. The issue no longer reproduces after this patch.
Fixes https://github.com/llvm/llvm-project/issues/37721.
---
Full diff: https://github.com/llvm/llvm-project/pull/227277.diff
1 Files Affected:
- (modified) lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp (+5-2)
``````````diff
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 0e1938b080bba..d977d60b9a766 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -632,6 +632,7 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo &launch_info,
return nullptr;
process_sp->HijackProcessEvents(launch_info.GetHijackListener());
+ process_sp->SetShadowListener(launch_info.GetShadowListener());
// We need to launch and attach to the process.
launch_info.GetFlags().Set(eLaunchFlagDebug);
@@ -678,9 +679,11 @@ lldb::ProcessSP PlatformWindows::Attach(ProcessAttachInfo &attach_info,
target->CreateProcess(attach_info.GetListenerForProcess(debugger),
attach_info.GetProcessPluginName(), nullptr, false);
- process_sp->HijackProcessEvents(attach_info.GetHijackListener());
- if (process_sp)
+ if (process_sp) {
+ process_sp->HijackProcessEvents(attach_info.GetHijackListener());
+ process_sp->SetShadowListener(attach_info.GetShadowListener());
error = process_sp->Attach(attach_info);
+ }
return process_sp;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/227277
More information about the lldb-commits
mailing list