From 7ae4b6de1d29b544f4a35bbf01cf5b398de89f4c Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 18 Dec 2014 18:21:33 +0000 Subject: [PATCH] Only compile RegisterContextWindows_x86.cpp for x86 host architecture. This fixes compilation failures in the 64-bit build of LLDB on Windows. Patch by Aidan Dodds Differential Revision: http://reviews.llvm.org/D6704 llvm-svn: 224528 --- lldb/source/Host/windows/HostThreadWindows.cpp | 10 +++++++++- lldb/source/Plugins/Process/Windows/CMakeLists.txt | 17 +++++++++++++++-- .../Plugins/Process/Windows/TargetThreadWindows.cpp | 16 ++++++++++++++-- .../Windows/{ => x86}/RegisterContextWindows_x86.cpp | 0 .../Windows/{ => x86}/RegisterContextWindows_x86.h | 0 5 files changed, 38 insertions(+), 5 deletions(-) rename lldb/source/Plugins/Process/Windows/{ => x86}/RegisterContextWindows_x86.cpp (100%) rename lldb/source/Plugins/Process/Windows/{ => x86}/RegisterContextWindows_x86.h (100%) diff --git a/lldb/source/Host/windows/HostThreadWindows.cpp b/lldb/source/Host/windows/HostThreadWindows.cpp index 2597fa2..d59064f 100644 --- a/lldb/source/Host/windows/HostThreadWindows.cpp +++ b/lldb/source/Host/windows/HostThreadWindows.cpp @@ -17,6 +17,14 @@ using namespace lldb; using namespace lldb_private; +namespace +{ +void __stdcall ExitThreadProxy(ULONG_PTR dwExitCode) +{ + ::ExitThread(dwExitCode); +} +} + HostThreadWindows::HostThreadWindows() : HostNativeThreadBase() , m_owns_handle(true) @@ -69,7 +77,7 @@ HostThreadWindows::Cancel() { Error error; - DWORD result = ::QueueUserAPC(::ExitThread, m_thread, 0); + DWORD result = ::QueueUserAPC(::ExitThreadProxy, m_thread, 0); error.SetError(result, eErrorTypeWin32); return error; } diff --git a/lldb/source/Plugins/Process/Windows/CMakeLists.txt b/lldb/source/Plugins/Process/Windows/CMakeLists.txt index e0110e3..dce4560 100644 --- a/lldb/source/Plugins/Process/Windows/CMakeLists.txt +++ b/lldb/source/Plugins/Process/Windows/CMakeLists.txt @@ -1,14 +1,27 @@ set(LLVM_NO_RTTI 1) +macro(add_process_windows_subdirectory group) + list(APPEND PROC_WINDOWS_SOURCES ${ARGN}) + source_group(${group} FILES ${ARGN}) +endmacro() + include_directories(.) include_directories(../Utility) -add_lldb_library(lldbPluginProcessWindows +add_process_windows_subdirectory(common DebuggerThread.cpp DynamicLoaderWindows.cpp LocalDebugDelegate.cpp ProcessWindows.cpp - RegisterContextWindows_x86.cpp TargetThreadWindows.cpp ) +if (CMAKE_SIZEOF_VOID_P EQUAL 4) + add_process_windows_subdirectory(x86 + x86/RegisterContextWindows_x86.cpp + ) +endif() + +add_lldb_library(lldbPluginProcessWindows + ${PROC_WINDOWS_SOURCES} + ) diff --git a/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp index 1c33f21..2f5ddc9 100644 --- a/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp @@ -15,9 +15,12 @@ #include "TargetThreadWindows.h" #include "ProcessWindows.h" -#include "RegisterContextWindows_x86.h" #include "UnwindLLDB.h" +#if !defined(_WIN64) +#include "x86/RegisterContextWindows_x86.h" +#endif + using namespace lldb; using namespace lldb_private; @@ -72,10 +75,19 @@ TargetThreadWindows::CreateRegisterContextForFrameIndex(uint32_t idx) switch (arch.GetMachine()) { case llvm::Triple::x86: +#if defined(_WIN64) + // FIXME: This is a Wow64 process, create a RegisterContextWindows_Wow64 +#else m_reg_context_sp.reset(new RegisterContextWindows_x86(*this, idx)); +#endif break; + case llvm::Triple::x86_64: +#if defined(_WIN64) + // FIXME: This is a 64-bit process, create a RegisterContextWindows_x86_64 +#else + // LLDB is 32-bit, but the target process is 64-bit. We probably can't debug this. +#endif default: - // FIXME: Support x64 by creating a RegisterContextWindows_x86_64 break; } } diff --git a/lldb/source/Plugins/Process/Windows/RegisterContextWindows_x86.cpp b/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp similarity index 100% rename from lldb/source/Plugins/Process/Windows/RegisterContextWindows_x86.cpp rename to lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp diff --git a/lldb/source/Plugins/Process/Windows/RegisterContextWindows_x86.h b/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.h similarity index 100% rename from lldb/source/Plugins/Process/Windows/RegisterContextWindows_x86.h rename to lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.h -- 2.7.4