Moved various RegisterContext files from Process/POSIX to Process/Utility for easier sharing.

Fix Windows build by adding JITLoaderGDB and ProcessElfCore.
RegisterContext: fixes for Windows build: sizeof(GPR::register) didn't work, switched to sizeof(((GPR*)NULL)->register).

llvm-svn: 203667
This commit is contained in:
Virgile Bello 2014-03-12 16:04:29 +00:00
parent d6432c8aed
commit 3e699d419e
34 changed files with 37 additions and 24 deletions

View File

@ -109,6 +109,12 @@ ifeq ($(HOST_OS),Linux)
lldbPluginJITLoaderGDB.a
endif
ifeq ($(HOST_OS),MingW)
USEDLIBS += lldbHostWindows.a \
lldbPluginProcessElfCore.a \
lldbPluginJITLoaderGDB.a
endif
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
USEDLIBS += lldbHostFreeBSD.a \
lldbPluginProcessPOSIX.a \

View File

@ -92,6 +92,8 @@ endif ()
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_USED_LIBS
lldbHostWindows
lldbPluginProcessElfCore
lldbPluginJITLoaderGDB
Ws2_32
)
endif ()

View File

@ -1,3 +1,3 @@
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "Linux")
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Windows")
add_subdirectory(GDB)
endif()

View File

@ -40,6 +40,11 @@ DIRS += Process/elf-core
DIRS += JITLoader/GDB
endif
ifeq ($(HOST_OS),MingW)
DIRS += Process/elf-core
DIRS += JITLoader/GDB
endif
ifneq (,$(filter $(HOST_OS), FreeBSD GNU/kFreeBSD))
DIRS += Process/FreeBSD Process/POSIX
DIRS += Process/elf-core

View File

@ -6,6 +6,8 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_subdirectory(FreeBSD)
add_subdirectory(POSIX)
add_subdirectory(elf-core)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_subdirectory(elf-core)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_subdirectory(MacOSX-Kernel)
endif()

View File

@ -2,6 +2,7 @@ set(LLVM_NO_RTTI 1)
include_directories(.)
include_directories(../POSIX)
include_directories(../Utility)
add_lldb_library(lldbPluginProcessLinux
ProcessLinux.cpp

View File

@ -10,13 +10,6 @@ add_lldb_library(lldbPluginProcessPOSIX
ProcessMessage.cpp
ProcessPOSIX.cpp
ProcessPOSIXLog.cpp
RegisterContextPOSIX_mips64.cpp
RegisterContextPOSIX_x86.cpp
RegisterContextPOSIXProcessMonitor_mips64.cpp
RegisterContextPOSIXProcessMonitor_x86.cpp
RegisterContextFreeBSD_i386.cpp
RegisterContextFreeBSD_mips64.cpp
RegisterContextFreeBSD_x86_64.cpp
RegisterContextLinux_i386.cpp
RegisterContextLinux_x86_64.cpp
)

View File

@ -10,7 +10,7 @@
#ifndef liblldb_RegisterContextPOSIXProcessMonitor_mips64_H_
#define liblldb_RegisterContextPOSIXProcessMonitor_mips64_H_
#include "Plugins/Process/POSIX/RegisterContextPOSIX_mips64.h"
#include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
class RegisterContextPOSIXProcessMonitor_mips64:
public RegisterContextPOSIX_mips64,

View File

@ -10,7 +10,7 @@
#ifndef liblldb_RegisterContextPOSIXProcessMonitor_x86_H_
#define liblldb_RegisterContextPOSIXProcessMonitor_x86_H_
#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86.h"
#include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
class RegisterContextPOSIXProcessMonitor_x86_64:
public RegisterContextPOSIX_x86,

View File

@ -11,13 +11,20 @@ add_lldb_library(lldbPluginProcessUtility
RegisterContextDarwin_i386.cpp
RegisterContextDarwin_x86_64.cpp
RegisterContextDummy.cpp
RegisterContextFreeBSD_i386.cpp
RegisterContextFreeBSD_mips64.cpp
RegisterContextFreeBSD_x86_64.cpp
RegisterContextHistory.cpp
RegisterContextLinux_i386.cpp
RegisterContextLinux_x86_64.cpp
RegisterContextLLDB.cpp
RegisterContextMacOSXFrameBackchain.cpp
RegisterContextMach_arm.cpp
RegisterContextMach_i386.cpp
RegisterContextMach_x86_64.cpp
RegisterContextMemory.cpp
RegisterContextPOSIX_mips64.cpp
RegisterContextPOSIX_x86.cpp
RegisterContextThreadMemory.cpp
StopInfoMachException.cpp
ThreadMemory.cpp

View File

@ -82,7 +82,7 @@ struct UserArea
uint32_t u_debugreg[8]; // Debug registers (DR0 - DR7).
};
#define DR_SIZE sizeof(UserArea::u_debugreg[0])
#define DR_SIZE sizeof(((UserArea*)NULL)->u_debugreg[0])
#define DR_0_OFFSET 0xFC
#define DR_OFFSET(reg_index) \
(DR_0_OFFSET + (reg_index * 4))

View File

@ -69,7 +69,7 @@ struct UserArea
uint64_t fault_address; // Control register CR3.
};
#define DR_SIZE sizeof(UserArea::u_debugreg[0])
#define DR_SIZE sizeof(((UserArea*)NULL)->u_debugreg[0])
#define DR_OFFSET(reg_index) \
(LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))

View File

@ -20,7 +20,6 @@
#include "lldb/Host/Endian.h"
#include "llvm/Support/Compiler.h"
#include "ProcessPOSIX.h"
#include "RegisterContextPOSIX_mips64.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"

View File

@ -20,7 +20,6 @@
#include "lldb/Host/Endian.h"
#include "llvm/Support/Compiler.h"
#include "ProcessPOSIX.h"
#include "RegisterContext_x86.h"
#include "RegisterContextPOSIX_x86.h"
#include "Plugins/Process/elf-core/ProcessElfCore.h"

View File

@ -39,7 +39,7 @@
// Note that the size and offset will be updated by platform-specific classes.
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
{ #reg, alt, sizeof(GPR::reg), GPR_OFFSET(reg), eEncodingUint, \
{ #reg, alt, sizeof(((GPR*)NULL)->reg), GPR_OFFSET(reg), eEncodingUint, \
eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_i386 }, NULL, NULL }
#define DEFINE_FPR(name, reg, kind1, kind2, kind3, kind4) \

View File

@ -15,7 +15,7 @@
// Note that the size and offset will be updated by platform-specific classes.
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
{ #reg, alt, sizeof(GPR::reg), GPR_OFFSET(reg), eEncodingUint, \
{ #reg, alt, sizeof(((GPR*)NULL)->reg), GPR_OFFSET(reg), eEncodingUint, \
eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_mips64 }, NULL, NULL }
static RegisterInfo

View File

@ -39,7 +39,7 @@
// Note that the size and offset will be updated by platform-specific classes.
#define DEFINE_GPR(reg, alt, kind1, kind2, kind3, kind4) \
{ #reg, alt, sizeof(GPR::reg), GPR_OFFSET(reg), eEncodingUint, \
{ #reg, alt, sizeof(((GPR*)NULL)->reg), GPR_OFFSET(reg), eEncodingUint, \
eFormatHex, { kind1, kind2, kind3, kind4, gpr_##reg##_x86_64 }, NULL, NULL }
#define DEFINE_FPR(name, reg, kind1, kind2, kind3, kind4) \

View File

@ -17,13 +17,12 @@
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Log.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/DynamicLoader.h"
#include "llvm/Support/ELF.h"
#include "ProcessPOSIXLog.h"
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
@ -397,7 +396,7 @@ ParseFreeBSDPrStatus(ThreadData &thread_data, DataExtractor &data,
arch.GetMachine() == llvm::Triple::x86_64);
int pr_version = data.GetU32(&offset);
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_PROCESS));
Log *log (GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
if (log)
{
if (pr_version > 1)

View File

@ -10,7 +10,7 @@
#ifndef liblldb_RegisterContextCorePOSIX_mips64_H_
#define liblldb_RegisterContextCorePOSIX_mips64_H_
#include "Plugins/Process/POSIX/RegisterContextPOSIX_mips64.h"
#include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
class RegisterContextCorePOSIX_mips64 :
public RegisterContextPOSIX_mips64

View File

@ -10,7 +10,7 @@
#ifndef liblldb_RegisterContextCorePOSIX_x86_64_H_
#define liblldb_RegisterContextCorePOSIX_x86_64_H_
#include "Plugins/Process/POSIX/RegisterContextPOSIX_x86.h"
#include "Plugins/Process/Utility/RegisterContextPOSIX_x86.h"
class RegisterContextCorePOSIX_x86_64 :
public RegisterContextPOSIX_x86

View File

@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Unwind.h"
#include "ProcessPOSIXLog.h"
#include "ThreadElfCore.h"
#include "ProcessElfCore.h"
@ -74,7 +74,7 @@ ThreadElfCore::CreateRegisterContextForFrame (StackFrame *frame)
{
RegisterContextSP reg_ctx_sp;
uint32_t concrete_frame_idx = 0;
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
Log *log (GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
if (frame)
concrete_frame_idx = frame->GetConcreteFrameIndex ();