mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 23:38:59 -04:00

*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
82 lines
2.6 KiB
C++
82 lines
2.6 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 "lldb/Core/Log.h"
|
|
#include "lldb/Core/Logging.h"
|
|
#include "lldb/Core/State.h"
|
|
#include "lldb/Host/HostInfo.h"
|
|
#include "lldb/Host/HostNativeThreadBase.h"
|
|
#include "lldb/Host/windows/HostThreadWindows.h"
|
|
#include "lldb/Host/windows/windows.h"
|
|
#include "lldb/Target/RegisterContext.h"
|
|
|
|
#include "ProcessWindows.h"
|
|
#include "ProcessWindowsLog.h"
|
|
#include "TargetThreadWindows.h"
|
|
#include "UnwindLLDB.h"
|
|
|
|
using namespace lldb;
|
|
using namespace lldb_private;
|
|
|
|
TargetThreadWindows::TargetThreadWindows(ProcessWindows &process,
|
|
const HostThread &thread)
|
|
: Thread(process, thread.GetNativeThread().GetThreadId()),
|
|
m_host_thread(thread) {}
|
|
|
|
TargetThreadWindows::~TargetThreadWindows() { DestroyThread(); }
|
|
|
|
void TargetThreadWindows::RefreshStateAfterStop() {
|
|
::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle());
|
|
SetState(eStateStopped);
|
|
GetRegisterContext()->InvalidateIfNeeded(false);
|
|
}
|
|
|
|
void TargetThreadWindows::WillResume(lldb::StateType resume_state) {}
|
|
|
|
void TargetThreadWindows::DidStop() {}
|
|
|
|
bool TargetThreadWindows::CalculateStopInfo() {
|
|
SetStopInfo(m_stop_info_sp);
|
|
return true;
|
|
}
|
|
|
|
Unwind *TargetThreadWindows::GetUnwinder() {
|
|
// FIXME: Implement an unwinder based on the Windows unwinder exposed through
|
|
// DIA SDK.
|
|
if (m_unwinder_ap.get() == NULL)
|
|
m_unwinder_ap.reset(new UnwindLLDB(*this));
|
|
return m_unwinder_ap.get();
|
|
}
|
|
|
|
bool TargetThreadWindows::DoResume() {
|
|
StateType resume_state = GetTemporaryResumeState();
|
|
StateType current_state = GetState();
|
|
if (resume_state == current_state)
|
|
return true;
|
|
|
|
if (resume_state == eStateStepping) {
|
|
uint32_t flags_index =
|
|
GetRegisterContext()->ConvertRegisterKindToRegisterNumber(
|
|
eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS);
|
|
uint64_t flags_value =
|
|
GetRegisterContext()->ReadRegisterAsUnsigned(flags_index, 0);
|
|
flags_value |= 0x100; // Set the trap flag on the CPU
|
|
GetRegisterContext()->WriteRegisterFromUnsigned(flags_index, flags_value);
|
|
}
|
|
|
|
if (resume_state == eStateStepping || resume_state == eStateRunning) {
|
|
DWORD previous_suspend_count = 0;
|
|
HANDLE thread_handle = m_host_thread.GetNativeThread().GetSystemHandle();
|
|
do {
|
|
previous_suspend_count = ::ResumeThread(thread_handle);
|
|
} while (previous_suspend_count > 0);
|
|
}
|
|
return true;
|
|
}
|