From 7c55db45bb857359569193093a85cebfde969301 Mon Sep 17 00:00:00 2001 From: Charles Zablit Date: Fri, 15 May 2026 17:12:05 +0200 Subject: [PATCH] [lldb][windows] Fix second-chance exception delivery on lldb-server --- .../Process/Windows/Common/NativeProcessWindows.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp index 0c95130147d1b..79e37f91018c2 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp @@ -458,9 +458,6 @@ NativeProcessWindows::OnDebugException(bool first_chance, ProcessDebugger::OnDebugException(first_chance, record); static bool initial_stop = false; - if (!first_chance) { - SetState(eStateStopped, false); - } switch (record.GetExceptionCode()) { case DWORD(STATUS_SINGLE_STEP): @@ -582,6 +579,9 @@ NativeProcessWindows::OnDebugException(bool first_chance, record.GetExceptionCode(), record.GetExceptionAddress(), first_chance); + if (first_chance) + return ExceptionResult::SendToApplication; + std::string desc; llvm::raw_string_ostream desc_stream(desc); desc_stream << "Exception " @@ -593,12 +593,7 @@ NativeProcessWindows::OnDebugException(bool first_chance, SetState(eStateStopped, true); - // For non-breakpoints, give the application a chance to handle the - // exception first. - if (first_chance) - return ExceptionResult::SendToApplication; - else - return ExceptionResult::BreakInDebugger; + return ExceptionResult::BreakInDebugger; } } }