18#include <llvm/Support/ConvertUTF.h>
20#if defined(__x86_64__) || defined(_M_AMD64)
22#elif defined(__i386__) || defined(_M_IX86)
24#elif defined(__aarch64__) || defined(_M_ARM64)
26#elif defined(__arm__) || defined(_M_ARM)
35 :
Thread(process, thread.GetNativeThread().GetThreadId()),
41 ::SuspendThread(
m_host_thread.GetNativeThread().GetSystemHandle());
60 uint32_t concrete_frame_idx = 0;
66 if (concrete_frame_idx == 0) {
68 ArchSpec arch = HostInfo::GetArchitecture();
70 case llvm::Triple::arm:
71 case llvm::Triple::thumb:
72#if defined(__arm__) || defined(_M_ARM)
74 new RegisterContextWindows_arm(*
this, concrete_frame_idx));
76 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
80 case llvm::Triple::aarch64:
81#if defined(__aarch64__) || defined(_M_ARM64)
83 new RegisterContextWindows_arm64(*
this, concrete_frame_idx));
85 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
89 case llvm::Triple::x86:
90#if defined(__i386__) || defined(_M_IX86)
92 new RegisterContextWindows_x86(*
this, concrete_frame_idx));
94 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
98 case llvm::Triple::x86_64:
99#if defined(__x86_64__) || defined(_M_AMD64)
101 new RegisterContextWindows_x64(*
this, concrete_frame_idx));
103 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
127 if (resume_state == current_state)
133 uint32_t flags_index =
136 uint64_t flags_value =
139 const ArchSpec &arch = process->GetTarget().GetArchitecture();
141 case llvm::Triple::x86:
142 case llvm::Triple::x86_64:
143 flags_value |= 0x100;
145 case llvm::Triple::aarch64:
146 case llvm::Triple::arm:
147 case llvm::Triple::thumb:
148 flags_value |= 0x200000;
151 LLDB_LOG(log,
"single stepping unsupported on this architecture");
158 DWORD previous_suspend_count = 0;
165 previous_suspend_count = ::ResumeThread(thread_handle);
167 if (previous_suspend_count ==
static_cast<DWORD
>(-1))
170 }
while (previous_suspend_count > 1);
179 s_get_thread_description{L
"Kernel32.dll",
"GetThreadDescription"};
180 if (!s_get_thread_description)
182 auto GetThreadDescription = *s_get_thread_description;
185 if (SUCCEEDED(GetThreadDescription(
186 m_host_thread.GetNativeThread().GetSystemHandle(), &pszThreadName))) {
187 LLDB_LOGF(log,
"GetThreadDescription: %ls", pszThreadName);
189 llvm::convertUTF16ToUTF8String(
190 llvm::ArrayRef(
reinterpret_cast<char *
>(pszThreadName),
191 wcslen(pszThreadName) *
sizeof(
wchar_t)),
193 ::LocalFree(pszThreadName);
#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.
virtual uint32_t GetConcreteFrameIndex()
Query this frame to find what frame it is in this Thread's StackFrameList, not counting inlined frame...
void RefreshStateAfterStop() override
bool CalculateStopInfo() override
Ask the thread subclass to set its stop info.
TargetThreadWindows(ProcessWindows &process, const HostThread &thread)
const char * GetName() override
virtual ~TargetThreadWindows()
lldb::RegisterContextSP GetRegisterContext() override
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) override
void WillResume(lldb::StateType resume_state) override
lldb::RegisterContextSP m_thread_reg_ctx_sp
void SetStopInfo(const lldb::StopInfoSP &stop_info_sp)
virtual void DestroyThread()
virtual Unwind & GetUnwinder()
Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id=false)
Constructor.
lldb::StateType GetTemporaryResumeState() const
void SetState(lldb::StateType state)
lldb::ProcessSP GetProcess() const
lldb::StopInfoSP m_stop_info_sp
The private stop reason for this thread.
lldb::StateType GetState() const
lldb::RegisterContextSP m_reg_context_sp
The register context for this thread's current register state.
lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame)
#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.
StateType
Process and Thread States.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eErrorTypeWin32
Standard Win32 error codes.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target