Skip to content

Commit 5ad1a98

Browse files
committed
chore: process debugger events as possible
1 parent 2138286 commit 5ad1a98

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,26 @@ void DebuggerThread::DebugLoop() {
307307
LLDB_LOG(log,
308308
"Breakpoint exception is cue to detach from process {0:x}",
309309
m_pid_to_detach.load());
310+
311+
// detaching with leaving breakpoint exception event on the queue may
312+
// cause target process to crash so process events as possible since
313+
// target threads are running at this time, there is possibility to
314+
// have some breakpoint exception between last WaitForDebugEvent and
315+
// DebugActiveProcessStop but ignore for now.
316+
while (WaitForDebugEvent(&dbe, 0)) {
317+
continue_status = DBG_CONTINUE;
318+
if (dbe.dwDebugEventCode == EXCEPTION_DEBUG_EVENT &&
319+
!(dbe.u.Exception.ExceptionRecord.ExceptionCode ==
320+
EXCEPTION_BREAKPOINT ||
321+
dbe.u.Exception.ExceptionRecord.ExceptionCode ==
322+
STATUS_WX86_BREAKPOINT ||
323+
dbe.u.Exception.ExceptionRecord.ExceptionCode ==
324+
EXCEPTION_SINGLE_STEP))
325+
continue_status = DBG_EXCEPTION_NOT_HANDLED;
326+
::ContinueDebugEvent(dbe.dwProcessId, dbe.dwThreadId,
327+
continue_status);
328+
}
329+
310330
::DebugActiveProcessStop(m_pid_to_detach);
311331
m_detached = true;
312332
}

0 commit comments

Comments
 (0)