22#include <llvm/Support/ConvertUTF.h>
38 DWORD previous_suspend_count =
39 ::SuspendThread(
m_host_thread.GetNativeThread().GetSystemHandle());
40 if (previous_suspend_count ==
static_cast<DWORD
>(-1))
53 if (resume_state == current_state)
59 uint32_t flags_index =
62 uint64_t flags_value =
67 case llvm::Triple::x86:
68 case llvm::Triple::x86_64:
71 case llvm::Triple::aarch64:
72 case llvm::Triple::arm:
73 case llvm::Triple::thumb:
74 flags_value |= 0x200000;
77 LLDB_LOG(log,
"single stepping unsupported on this architecture");
84 DWORD previous_suspend_count = 0;
91 previous_suspend_count = ::ResumeThread(thread_handle);
93 if (previous_suspend_count ==
static_cast<DWORD
>(-1))
96 }
while (previous_suspend_count > 1);
106 s_get_thread_description{L
"Kernel32.dll",
"GetThreadDescription"};
107 if (!s_get_thread_description)
109 auto GetThreadDescription = *s_get_thread_description;
112 if (SUCCEEDED(GetThreadDescription(
113 m_host_thread.GetNativeThread().GetSystemHandle(), &pszThreadName))) {
114 LLDB_LOGF(log,
"GetThreadDescription: %ls", pszThreadName);
116 llvm::convertUTF16ToUTF8String(
117 llvm::ArrayRef(
reinterpret_cast<char *
>(pszThreadName),
118 wcslen(pszThreadName) *
sizeof(
wchar_t)),
120 ::LocalFree(pszThreadName);
127 std::string description) {
134 std::string &description) {
155 log->
Printf(
"NativeThreadWindows::%s tid %" PRIu64
156 " in state %s cannot answer stop reason",
161 llvm_unreachable(
"unhandled StateType!");
165 uint32_t watch_flags,
bool hardware) {
185 uint32_t wp_index = wp->second;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
An architecture specification class.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
void void Printf(const char *format,...) __attribute__((format(printf
Prefer using LLDB_LOGF whenever possible.
virtual const ArchSpec & GetArchitecture() const =0
const ArchSpec & GetArchitecture() const override
virtual void InvalidateAllRegisters()
static std::unique_ptr< NativeRegisterContextWindows > CreateHostNativeRegisterContextWindows(const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const
lldb::addr_t ReadRegisterAsUnsigned(uint32_t reg, lldb::addr_t fail_value)
Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval)
NativeProcessProtocol & GetProcess()
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid)
lldb::tid_t GetID() const
ThreadStopInfo m_stop_info
IndexMap m_watchpoint_index_map
std::string m_stop_description
std::string GetName() override
Status RemoveWatchpoint(lldb::addr_t addr) override
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
void SetStopReason(ThreadStopInfo stop_info, std::string description)
Status DoResume(lldb::StateType resume_state)
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
NativeRegisterContextWindows & GetRegisterContext() override
lldb::StateType GetState() override
NativeThreadWindows(NativeProcessWindows &process, const HostThread &thread)
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
std::unique_ptr< NativeRegisterContextWindows > m_reg_context_up
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
static Status FromErrorString(const char *str)
#define LLDB_INVALID_INDEX32
#define LLDB_REGNUM_GENERIC_FLAGS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
StateType
Process and Thread States.
@ eStateUnloaded
Process is object is valid, but not currently loaded.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateDetached
Process has been detached and can't be examined.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateLaunching
Process is in the process of launching.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
@ eErrorTypeWin32
Standard Win32 error codes.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target