Process: generalise Windows thread setup

The Windows build currently cannot support debugging foreign targets or
debugging Windows ARM NT and Windows ARM64 targets.  Do not assume a
x64/x86 host.  This enables building lldb for Windows ARM64.

llvm-svn: 365282
This commit is contained in:
Saleem Abdulrasool 2019-07-07 17:58:11 +00:00
parent 8cedf04a6c
commit 842f55f3ef
1 changed files with 20 additions and 10 deletions

View File

@ -20,9 +20,10 @@
#include "ProcessWindowsLog.h"
#include "TargetThreadWindows.h"
#if defined(_WIN64)
// TODO support _M_ARM and _M_ARM64
#if defined(_M_AMD64)
#include "x64/RegisterContextWindows_x64.h"
#else
#elif defined(_M_IX86)
#include "x86/RegisterContextWindows_x86.h"
#endif
@ -66,24 +67,33 @@ TargetThreadWindows::CreateRegisterContextForFrame(StackFrame *frame) {
if (!m_thread_reg_ctx_sp) {
ArchSpec arch = HostInfo::GetArchitecture();
switch (arch.GetMachine()) {
case llvm::Triple::arm:
case llvm::Triple::thumb:
LLDB_LOG(log, "debugging ARM (NT) targets is currently unsupported");
break;
case llvm::Triple::aarch64:
LLDB_LOG(log, "debugging ARM64 targets is currently unsupported");
break;
case llvm::Triple::x86:
#if defined(_WIN64)
// FIXME: This is a Wow64 process, create a RegisterContextWindows_Wow64
LLDB_LOG(log, "This is a Wow64 process, we should create a "
"RegisterContextWindows_Wow64, but we don't.");
#else
#if defined(_M_IX86)
m_thread_reg_ctx_sp.reset(
new RegisterContextWindows_x86(*this, concrete_frame_idx));
#else
LLDB_LOG(log, "debugging foreign targets is currently unsupported");
#endif
break;
case llvm::Triple::x86_64:
#if defined(_WIN64)
#if defined(_M_AMD64)
m_thread_reg_ctx_sp.reset(
new RegisterContextWindows_x64(*this, concrete_frame_idx));
#else
LLDB_LOG(log, "LLDB is 32-bit, but the target process is 64-bit.");
LLDB_LOG(log, "debugging foreign targets is currently unsupported");
#endif
LLVM_FALLTHROUGH;
break;
default:
break;
}