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
96 lines
2.3 KiB
C++
96 lines
2.3 KiB
C++
//===-- 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;
|
|
}
|