https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/206469
The launch thread blocks on that event in `WaitForDebuggerConnection()` and, once released, returns, immediately starts serving GDB-remote packets. If the state were still `eStateInvalid` at that point, a `continue` would race past the state transition and be rejected by `CanResume()`. This fixes flakyness in the following tests: ``` lldb-api :: commands/process/reverse-continue/TestReverseContinue.py lldb-api :: functionalities/reverse-execution/TestReverseContinueBreakpoints.py lldb-api :: functionalities/reverse-execution/TestReverseContinueWatchpoints.py lldb-api :: tools/lldb-server/TestGdbRemoteAttach.py lldb-api :: tools/lldb-server/TestGdbRemoteExitCode.py lldb-api :: tools/lldb-server/TestGdbRemoteExpeditedRegisters.py lldb-api :: tools/lldb-server/TestGdbRemoteThreadsInStopReply.py lldb-api :: tools/lldb-server/TestGdbRemote_qThreadStopInfo.py lldb-api :: tools/lldb-server/TestLldbGdbServer.py lldb-api :: tools/lldb-server/TestNonStop.py lldb-api :: tools/lldb-server/register-reading/TestGdbRemoteGPacket.py ``` >From e8f38e7b314ba7952f29c9fcbf44fc5531970004 Mon Sep 17 00:00:00 2001 From: Charles Zablit <[email protected]> Date: Mon, 29 Jun 2026 13:16:18 +0100 Subject: [PATCH] [lldb][Windows] handle exception first to keep track of the stop reason Co-Authored-By: Raphael Isemann <[email protected]> --- .../Windows/Common/NativeProcessWindows.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index 889a2e743c07f..ce4fa3d1f0152 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -653,19 +653,26 @@ NativeProcessWindows::OnDebugException(bool first_chance, const ExceptionRecord &record) { llvm::sys::ScopedLock lock(m_mutex); - // Let the debugger establish the internal status. - ProcessDebugger::OnDebugException(first_chance, record); - + // Handle the exception first to keep track of the stop reason. + ExceptionResult result; switch (record.GetExceptionValue()) { case DWORD(STATUS_SINGLE_STEP): case STATUS_WX86_SINGLE_STEP: - return HandleSingleStepException(record); + result = HandleSingleStepException(record); + break; case DWORD(STATUS_BREAKPOINT): case STATUS_WX86_BREAKPOINT: - return HandleBreakpointException(record); + result = HandleBreakpointException(record); + break; default: - return HandleGenericException(first_chance, record); + result = HandleGenericException(first_chance, record); + break; } + + // Let the debugger establish the internal status. + ProcessDebugger::OnDebugException(first_chance, record); + + return result; } void NativeProcessWindows::OnCreateThread(const HostThread &new_thread) { _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
