summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp')
-rw-r--r--lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp
new file mode 100644
index 00000000000..33b5fd1973c
--- /dev/null
+++ b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp
@@ -0,0 +1,95 @@
+//===-- TargetThreadWindows.cpp----------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "TargetThreadWindows.h"
+#include "ProcessWindows.h"
+#include "lldb/Host/HostNativeThreadBase.h"
+#include "lldb/Host/windows/HostThreadWindows.h"
+#include "lldb/Host/windows/windows.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+TargetThreadWindows::TargetThreadWindows(ProcessWindows &process, const HostThread &thread)
+ : Thread(process, ((HostThreadWindows &)thread.GetNativeThread()).GetThreadId())
+ , m_host_thread(thread)
+{
+}
+
+TargetThreadWindows::~TargetThreadWindows()
+{
+ DestroyThread();
+}
+
+void
+TargetThreadWindows::RefreshStateAfterStop()
+{
+}
+
+void
+TargetThreadWindows::WillResume(lldb::StateType resume_state)
+{
+}
+
+void
+TargetThreadWindows::DidStop()
+{
+}
+
+RegisterContextSP
+TargetThreadWindows::GetRegisterContext()
+{
+ return RegisterContextSP();
+}
+
+RegisterContextSP
+TargetThreadWindows::CreateRegisterContextForFrame(StackFrame *frame)
+{
+ return RegisterContextSP();
+}
+
+bool
+TargetThreadWindows::CalculateStopInfo()
+{
+ return false;
+}
+
+bool
+TargetThreadWindows::DoResume()
+{
+ StateType resume_state = GetResumeState();
+ StateType current_state = GetState();
+ if (resume_state == current_state)
+ return true;
+
+ bool success = false;
+ DWORD suspend_count = 0;
+ switch (resume_state)
+ {
+ case eStateRunning:
+ SetState(resume_state);
+ do
+ {
+ suspend_count = ::ResumeThread(m_host_thread.GetNativeThread().GetSystemHandle());
+ } while (suspend_count > 1 && suspend_count != (DWORD)-1);
+ success = (suspend_count != (DWORD)-1);
+ break;
+ case eStateStopped:
+ case eStateSuspended:
+ if (current_state != eStateStopped && current_state != eStateSuspended)
+ {
+ suspend_count = SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
+ success = (suspend_count != (DWORD)-1);
+ }
+ break;
+ default:
+ success = false;
+ }
+ return success;
+}
OpenPOWER on IntegriCloud