17#include <llvm/Support/ConvertUTF.h>
19#if defined(__x86_64__) || defined(_M_AMD64)
21#elif defined(__i386__) || defined(_M_IX86)
23#elif defined(__aarch64__) || defined(_M_ARM64)
25#elif defined(__arm__) || defined(_M_ARM)
33 HRESULT(WINAPI *)(HANDLE hThread, PWSTR *ppszThreadDescription);
37 :
Thread(process, thread.GetNativeThread().GetThreadId()),
38 m_thread_reg_ctx_sp(), m_host_thread(thread) {}
62 uint32_t concrete_frame_idx = 0;
68 if (concrete_frame_idx == 0) {
70 ArchSpec arch = HostInfo::GetArchitecture();
72 case llvm::Triple::arm:
73 case llvm::Triple::thumb:
74#if defined(__arm__) || defined(_M_ARM)
76 new RegisterContextWindows_arm(*
this, concrete_frame_idx));
78 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
82 case llvm::Triple::aarch64:
83#if defined(__aarch64__) || defined(_M_ARM64)
85 new RegisterContextWindows_arm64(*
this, concrete_frame_idx));
87 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
91 case llvm::Triple::x86:
92#if defined(__i386__) || defined(_M_IX86)
94 new RegisterContextWindows_x86(*
this, concrete_frame_idx));
96 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
100 case llvm::Triple::x86_64:
101#if defined(__x86_64__) || defined(_M_AMD64)
103 new RegisterContextWindows_x64(*
this, concrete_frame_idx));
105 LLDB_LOG(log,
"debugging foreign targets is currently unsupported");
129 if (resume_state == current_state)
135 uint32_t flags_index =
138 uint64_t flags_value =
141 const ArchSpec &arch = process->GetTarget().GetArchitecture();
143 case llvm::Triple::x86:
144 case llvm::Triple::x86_64:
145 flags_value |= 0x100;
147 case llvm::Triple::aarch64:
148 case llvm::Triple::arm:
149 case llvm::Triple::thumb:
150 flags_value |= 0x200000;
153 LLDB_LOG(log,
"single stepping unsupported on this architecture");
160 DWORD previous_suspend_count = 0;
167 previous_suspend_count = ::ResumeThread(thread_handle);
169 if (previous_suspend_count == (DWORD)-1)
172 }
while (previous_suspend_count > 1);
181 HMODULE hModule = ::LoadLibraryW(L
"Kernel32.dll");
184 (
void *)::GetProcAddress(hModule,
"GetThreadDescription"))
188 reinterpret_cast<void *
>(GetThreadDescription));
189 if (!GetThreadDescription)
192 if (SUCCEEDED(GetThreadDescription(
194 LLDB_LOGF(log,
"GetThreadDescription: %ls", pszThreadName);
195 llvm::convertUTF16ToUTF8String(
196 llvm::ArrayRef(
reinterpret_cast<char *
>(pszThreadName),
197 wcslen(pszThreadName) *
sizeof(
wchar_t)),
199 ::LocalFree(pszThreadName);
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
HRESULT(WINAPI *)(HANDLE hThread, PWSTR *ppszThreadDescription) GetThreadDescriptionFunctionPtr
An architecture specification class.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
lldb::thread_t GetSystemHandle() const
HostNativeThread & GetNativeThread()
This base class provides an interface to stack frames.
uint32_t GetConcreteFrameIndex() const
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()
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