From dcd80377f3f8af50d844241cad1f9f710358ae96 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 11 Nov 2014 00:00:14 +0000 Subject: [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 --- .../Plugins/Process/Windows/ProcessWindows.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/Process/Windows/ProcessWindows.cpp') diff --git a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp index db410c35a20..511dd356bf0 100644 --- a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -28,6 +28,7 @@ #include "lldb/Target/Target.h" #include "DebuggerThread.h" +#include "ExceptionRecord.h" #include "LocalDebugDelegate.h" #include "ProcessMessages.h" #include "ProcessWindows.h" @@ -144,6 +145,7 @@ ProcessWindows::DoLaunch(Module *exe_module, launch_info.SetProcessID(process.GetProcessId()); SetID(process.GetProcessId()); + return result; } @@ -151,6 +153,11 @@ Error ProcessWindows::DoResume() { Error error; + if (!m_active_exception) + return error; + + m_debugger->ContinueAsyncException(ExceptionResult::Handled); + SetPrivateState(eStateRunning); return error; } @@ -240,6 +247,7 @@ void ProcessWindows::OnExitProcess(const ProcessMessageExitProcess &message) { SetProcessExitStatus(nullptr, GetID(), true, 0, message.GetExitCode()); + SetPrivateState(eStateExited); } void @@ -248,9 +256,20 @@ ProcessWindows::OnDebuggerConnected(const ProcessMessageDebuggerConnected &messa ::SetEvent(m_data_up->m_launched_event); } -void +ExceptionResult ProcessWindows::OnDebugException(const ProcessMessageException &message) { + ExceptionResult result = ExceptionResult::Handled; + const ExceptionRecord &record = message.GetExceptionRecord(); + m_active_exception.reset(new ExceptionRecord(record)); + switch (record.GetExceptionCode()) + { + case EXCEPTION_BREAKPOINT: + SetPrivateState(eStateStopped); + result = ExceptionResult::WillHandle; + break; + } + return result; } void -- cgit v1.2.3