================
@@ -401,15 +409,24 @@ DebuggerThread::HandleExceptionEvent(const
EXCEPTION_DEBUG_INFO &info,
bool first_chance = (info.dwFirstChance != 0);
- m_active_exception.reset(
- new ExceptionRecord(info.ExceptionRecord, thread_id));
+ ExceptionRecordSP active_exception =
+ std::make_shared<ExceptionRecord>(info.ExceptionRecord, thread_id);
+ {
+ std::lock_guard<std::mutex> guard(m_active_exception_mutex);
+ m_active_exception = active_exception;
+ }
+ m_exception_pred.SetValue(ExceptionResult::BreakInDebugger, eBroadcastNever);
+
LLDB_LOG(log, "encountered {0} chance exception {1:x} on thread {2:x}",
first_chance ? "first" : "second",
info.ExceptionRecord.ExceptionCode, thread_id);
ExceptionResult result =
- m_debug_delegate->OnDebugException(first_chance, *m_active_exception);
- m_exception_pred.SetValue(result, eBroadcastNever);
+ m_debug_delegate->OnDebugException(first_chance, *active_exception);
+ // If the delegate dealt with the exception itself, continue it now. This is
+ // a no-op if the other thread got there first, in which case its result
wins.
+ if (result != ExceptionResult::BreakInDebugger)
+ ContinueAsyncException(result);
----------------
Nerixyz wrote:
Why do we need this here now? I'm assuming the delegate will always call
`ContinueAsyncException` if it returns something other than `BreakInDebugger`.
https://github.com/llvm/llvm-project/pull/213075
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits