[ProcessWindows] Implement breakpoint stop / resume on Windows.

This patch implements basic support for stopping at breakpoints
and resuming later.  While a breakpoint is stopped at, LLDB will
cease to process events in the debug loop, effectively suspending
the process, and then resume later when ProcessWindows::DoResume
is called.

As a side effect, this also correctly handles the loader breakpoint
(i.e. the initial stop) so that LLDB goes through the correct state
sequence during the initial process launch.

llvm-svn: 221642
This commit is contained in:
Zachary Turner
2014-11-11 00:00:14 +00:00
parent 6cc5f73e38
commit dcd80377f3
10 changed files with 173 additions and 11 deletions

View File

@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "DebuggerThread.h"
#include "ExceptionRecord.h"
#include "IDebugDelegate.h"
#include "ProcessMessages.h"
@@ -97,6 +98,12 @@ DebuggerThread::DebuggerThreadRoutine(const ProcessLaunchInfo &launch_info)
return 0;
}
void
DebuggerThread::ContinueAsyncException(ExceptionResult result)
{
m_exception.SetValue(result, eBroadcastAlways);
}
void
DebuggerThread::DebugLoop()
{
@@ -108,8 +115,17 @@ DebuggerThread::DebugLoop()
switch (dbe.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
continue_status = HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId);
{
ExceptionResult status = HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId);
m_exception.SetValue(status, eBroadcastNever);
m_exception.WaitForValueNotEqualTo(ExceptionResult::WillHandle, status);
if (status == ExceptionResult::Handled)
continue_status = DBG_CONTINUE;
else if (status == ExceptionResult::NotHandled)
continue_status = DBG_EXCEPTION_NOT_HANDLED;
break;
}
case CREATE_THREAD_DEBUG_EVENT:
continue_status = HandleCreateThreadEvent(dbe.u.CreateThread, dbe.dwThreadId);
break;
@@ -143,10 +159,12 @@ DebuggerThread::DebugLoop()
}
}
DWORD
ExceptionResult
DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, DWORD thread_id)
{
return DBG_CONTINUE;
bool first_chance = (info.dwFirstChance != 0);
ProcessMessageException message(m_process, ExceptionRecord(info.ExceptionRecord), first_chance);
return m_debug_delegate->OnDebugException(message);
}
DWORD