summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2014-11-17 17:46:43 +0000
committerZachary Turner <zturner@google.com>2014-11-17 17:46:43 +0000
commit119767db851033a09030e416dcc62bf1d5118485 (patch)
treed9371f6caf50eec39e96008d96c8605d26988d9d /lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp
parenta2fc3a4090bf1f7110712460a8194e169a210e9f (diff)
downloadbcm5719-llvm-119767db851033a09030e416dcc62bf1d5118485.tar.gz
bcm5719-llvm-119767db851033a09030e416dcc62bf1d5118485.zip
[ProcessWindows] Create a TargetThreadWindows class.
This creates a TargetThreadWindows class and updates the thread list of the Process with the main thread. Additionally, we fill out a few more overrides of Process base class methods. We do not yet update the thread list as threads are created and/or destroyed, and we do not yet propagate stop reasons to threads as their states change. llvm-svn: 222148
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