Merge Linux and FreeBSD arm register contexts
Summary: These two register contexts were identical, so this shouldn't cause any regressions, but I'd appreciate it if you can check that this at least compiles. Reviewers: emaste, sas Subscribers: aemerson, rengolin, lldb-commits, mgorny Differential Revision: https://reviews.llvm.org/D27126 llvm-svn: 296335
This commit is contained in:
parent
c9fbd9a3be
commit
4b2b6bfb97
|
@ -18,11 +18,11 @@
|
|||
// Project includes
|
||||
#include "FreeBSDThread.h"
|
||||
#include "POSIXStopInfo.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
|
||||
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
|
||||
#include "Plugins/Process/Utility/UnwindLLDB.h"
|
||||
#include "ProcessFreeBSD.h"
|
||||
|
@ -137,7 +137,7 @@ lldb::RegisterContextSP FreeBSDThread::GetRegisterContext() {
|
|||
reg_interface = new RegisterInfoPOSIX_arm64(target_arch);
|
||||
break;
|
||||
case llvm::Triple::arm:
|
||||
reg_interface = new RegisterContextFreeBSD_arm(target_arch);
|
||||
reg_interface = new RegisterInfoPOSIX_arm(target_arch);
|
||||
break;
|
||||
case llvm::Triple::ppc:
|
||||
#ifndef __powerpc64__
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "Plugins/Process/Linux/Procfs.h"
|
||||
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextLinux_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
|
||||
|
||||
#include <elf.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -109,7 +109,7 @@ NativeRegisterContextLinux_arm::NativeRegisterContextLinux_arm(
|
|||
const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
|
||||
uint32_t concrete_frame_idx)
|
||||
: NativeRegisterContextLinux(native_thread, concrete_frame_idx,
|
||||
new RegisterContextLinux_arm(target_arch)) {
|
||||
new RegisterInfoPOSIX_arm(target_arch)) {
|
||||
switch (target_arch.GetMachine()) {
|
||||
case llvm::Triple::arm:
|
||||
m_reg_info.num_registers = k_num_registers_arm;
|
||||
|
|
|
@ -15,13 +15,11 @@ add_lldb_library(lldbPluginProcessUtility PLUGIN
|
|||
RegisterContextDarwin_i386.cpp
|
||||
RegisterContextDarwin_x86_64.cpp
|
||||
RegisterContextDummy.cpp
|
||||
RegisterContextFreeBSD_arm.cpp
|
||||
RegisterContextFreeBSD_i386.cpp
|
||||
RegisterContextFreeBSD_mips64.cpp
|
||||
RegisterContextFreeBSD_powerpc.cpp
|
||||
RegisterContextFreeBSD_x86_64.cpp
|
||||
RegisterContextHistory.cpp
|
||||
RegisterContextLinux_arm.cpp
|
||||
RegisterContextLinux_i386.cpp
|
||||
RegisterContextLinux_x86_64.cpp
|
||||
RegisterContextLinux_mips64.cpp
|
||||
|
@ -41,6 +39,7 @@ add_lldb_library(lldbPluginProcessUtility PLUGIN
|
|||
RegisterContextPOSIX_s390x.cpp
|
||||
RegisterContextPOSIX_x86.cpp
|
||||
RegisterContextThreadMemory.cpp
|
||||
RegisterInfoPOSIX_arm.cpp
|
||||
RegisterInfoPOSIX_arm64.cpp
|
||||
StopInfoMachException.cpp
|
||||
ThreadMemory.cpp
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
//===-- RegisterContextFreeBSD_arm.cpp -------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#include <cassert>
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
||||
#include "RegisterContextFreeBSD_arm.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
// Based on RegisterContextLinux_arm.cpp and
|
||||
// http://svnweb.freebsd.org/base/head/sys/arm/include/reg.h
|
||||
#define GPR_OFFSET(idx) ((idx)*4)
|
||||
#define FPU_OFFSET(idx) ((idx)*4 + sizeof(RegisterContextFreeBSD_arm::GPR))
|
||||
#define FPSCR_OFFSET \
|
||||
(LLVM_EXTENSION offsetof(RegisterContextFreeBSD_arm::FPU, fpscr) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::GPR))
|
||||
#define EXC_OFFSET(idx) \
|
||||
((idx)*4 + sizeof(RegisterContextFreeBSD_arm::GPR) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::FPU))
|
||||
#define DBG_OFFSET(reg) \
|
||||
((LLVM_EXTENSION offsetof(RegisterContextFreeBSD_arm::DBG, reg) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::GPR) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::FPU) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::EXC)))
|
||||
|
||||
#define DEFINE_DBG(reg, i) \
|
||||
#reg, NULL, sizeof(((RegisterContextFreeBSD_arm::DBG *) NULL)->reg[i]), \
|
||||
DBG_OFFSET(reg[i]), eEncodingUint, eFormatHex, \
|
||||
{LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
|
||||
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
|
||||
dbg_##reg##i }, \
|
||||
NULL, NULL, NULL, 0
|
||||
#define REG_CONTEXT_SIZE \
|
||||
(sizeof(RegisterContextFreeBSD_arm::GPR) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::FPU) + \
|
||||
sizeof(RegisterContextFreeBSD_arm::EXC))
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Include RegisterInfos_arm to declare our g_register_infos_arm structure.
|
||||
//-----------------------------------------------------------------------------
|
||||
#define DECLARE_REGISTER_INFOS_ARM_STRUCT
|
||||
#include "RegisterInfos_arm.h"
|
||||
#undef DECLARE_REGISTER_INFOS_ARM_STRUCT
|
||||
|
||||
static const lldb_private::RegisterInfo *
|
||||
GetRegisterInfoPtr(const lldb_private::ArchSpec &target_arch) {
|
||||
switch (target_arch.GetMachine()) {
|
||||
case llvm::Triple::arm:
|
||||
return g_register_infos_arm;
|
||||
default:
|
||||
assert(false && "Unhandled target architecture.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
|
||||
switch (target_arch.GetMachine()) {
|
||||
case llvm::Triple::arm:
|
||||
return static_cast<uint32_t>(sizeof(g_register_infos_arm) /
|
||||
sizeof(g_register_infos_arm[0]));
|
||||
default:
|
||||
assert(false && "Unhandled target architecture.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
RegisterContextFreeBSD_arm::RegisterContextFreeBSD_arm(
|
||||
const lldb_private::ArchSpec &target_arch)
|
||||
: lldb_private::RegisterInfoInterface(target_arch),
|
||||
m_register_info_p(GetRegisterInfoPtr(target_arch)),
|
||||
m_register_info_count(GetRegisterInfoCount(target_arch)) {}
|
||||
|
||||
size_t RegisterContextFreeBSD_arm::GetGPRSize() const {
|
||||
return sizeof(struct RegisterContextFreeBSD_arm::GPR);
|
||||
}
|
||||
|
||||
const lldb_private::RegisterInfo *
|
||||
RegisterContextFreeBSD_arm::GetRegisterInfo() const {
|
||||
return m_register_info_p;
|
||||
}
|
||||
|
||||
uint32_t RegisterContextFreeBSD_arm::GetRegisterCount() const {
|
||||
return m_register_info_count;
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
//===-- RegisterContextLinux_arm.h -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_RegisterContextLinux_arm_h_
|
||||
#define liblldb_RegisterContextLinux_arm_h_
|
||||
|
||||
#include "RegisterInfoInterface.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
class RegisterContextLinux_arm : public lldb_private::RegisterInfoInterface {
|
||||
public:
|
||||
struct GPR {
|
||||
uint32_t r[16]; // R0-R15
|
||||
uint32_t cpsr; // CPSR
|
||||
};
|
||||
|
||||
struct QReg {
|
||||
uint8_t bytes[16];
|
||||
};
|
||||
|
||||
struct FPU {
|
||||
union {
|
||||
uint32_t s[32];
|
||||
uint64_t d[32];
|
||||
QReg q[16]; // the 128-bit NEON registers
|
||||
} floats;
|
||||
uint32_t fpscr;
|
||||
};
|
||||
struct EXC {
|
||||
uint32_t exception;
|
||||
uint32_t fsr; /* Fault status */
|
||||
uint32_t far; /* Virtual Fault Address */
|
||||
};
|
||||
|
||||
struct DBG {
|
||||
uint32_t bvr[16];
|
||||
uint32_t bcr[16];
|
||||
uint32_t wvr[16];
|
||||
uint32_t wcr[16];
|
||||
};
|
||||
|
||||
RegisterContextLinux_arm(const lldb_private::ArchSpec &target_arch);
|
||||
|
||||
size_t GetGPRSize() const override;
|
||||
|
||||
const lldb_private::RegisterInfo *GetRegisterInfo() const override;
|
||||
|
||||
uint32_t GetRegisterCount() const override;
|
||||
|
||||
private:
|
||||
const lldb_private::RegisterInfo *m_register_info_p;
|
||||
uint32_t m_register_info_count;
|
||||
};
|
||||
|
||||
#endif // liblldb_RegisterContextLinux_arm_h_
|
|
@ -1,4 +1,4 @@
|
|||
//===-- RegisterContextLinux_arm.cpp ---------------------------*- C++ -*-===//
|
||||
//===-- RegisterInfoPOSIX_arm.cpp ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -14,37 +14,35 @@
|
|||
#include "lldb/lldb-defines.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
||||
#include "RegisterContextLinux_arm.h"
|
||||
#include "RegisterInfoPOSIX_arm.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
// Based on RegisterContextDarwin_arm.cpp
|
||||
#define GPR_OFFSET(idx) ((idx)*4)
|
||||
#define FPU_OFFSET(idx) ((idx)*4 + sizeof(RegisterContextLinux_arm::GPR))
|
||||
#define FPU_OFFSET(idx) ((idx)*4 + sizeof(RegisterInfoPOSIX_arm::GPR))
|
||||
#define FPSCR_OFFSET \
|
||||
(LLVM_EXTENSION offsetof(RegisterContextLinux_arm::FPU, fpscr) + \
|
||||
sizeof(RegisterContextLinux_arm::GPR))
|
||||
(LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm::FPU, fpscr) + \
|
||||
sizeof(RegisterInfoPOSIX_arm::GPR))
|
||||
#define EXC_OFFSET(idx) \
|
||||
((idx)*4 + sizeof(RegisterContextLinux_arm::GPR) + \
|
||||
sizeof(RegisterContextLinux_arm::FPU))
|
||||
((idx)*4 + sizeof(RegisterInfoPOSIX_arm::GPR) + \
|
||||
sizeof(RegisterInfoPOSIX_arm::FPU))
|
||||
#define DBG_OFFSET(reg) \
|
||||
((LLVM_EXTENSION offsetof(RegisterContextLinux_arm::DBG, reg) + \
|
||||
sizeof(RegisterContextLinux_arm::GPR) + \
|
||||
sizeof(RegisterContextLinux_arm::FPU) + \
|
||||
sizeof(RegisterContextLinux_arm::EXC)))
|
||||
((LLVM_EXTENSION offsetof(RegisterInfoPOSIX_arm::DBG, reg) + \
|
||||
sizeof(RegisterInfoPOSIX_arm::GPR) + sizeof(RegisterInfoPOSIX_arm::FPU) + \
|
||||
sizeof(RegisterInfoPOSIX_arm::EXC)))
|
||||
|
||||
#define DEFINE_DBG(reg, i) \
|
||||
#reg, NULL, sizeof(((RegisterContextLinux_arm::DBG *) NULL)->reg[i]), \
|
||||
#reg, NULL, sizeof(((RegisterInfoPOSIX_arm::DBG *) NULL)->reg[i]), \
|
||||
DBG_OFFSET(reg[i]), eEncodingUint, eFormatHex, \
|
||||
{LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
|
||||
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
|
||||
dbg_##reg##i }, \
|
||||
NULL, NULL, NULL, 0
|
||||
#define REG_CONTEXT_SIZE \
|
||||
(sizeof(RegisterContextLinux_arm::GPR) + \
|
||||
sizeof(RegisterContextLinux_arm::FPU) + \
|
||||
sizeof(RegisterContextLinux_arm::EXC))
|
||||
(sizeof(RegisterInfoPOSIX_arm::GPR) + sizeof(RegisterInfoPOSIX_arm::FPU) + \
|
||||
sizeof(RegisterInfoPOSIX_arm::EXC))
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Include RegisterInfos_arm to declare our g_register_infos_arm structure.
|
||||
|
@ -76,21 +74,21 @@ GetRegisterInfoCount(const lldb_private::ArchSpec &target_arch) {
|
|||
}
|
||||
}
|
||||
|
||||
RegisterContextLinux_arm::RegisterContextLinux_arm(
|
||||
RegisterInfoPOSIX_arm::RegisterInfoPOSIX_arm(
|
||||
const lldb_private::ArchSpec &target_arch)
|
||||
: lldb_private::RegisterInfoInterface(target_arch),
|
||||
m_register_info_p(GetRegisterInfoPtr(target_arch)),
|
||||
m_register_info_count(GetRegisterInfoCount(target_arch)) {}
|
||||
|
||||
size_t RegisterContextLinux_arm::GetGPRSize() const {
|
||||
return sizeof(struct RegisterContextLinux_arm::GPR);
|
||||
size_t RegisterInfoPOSIX_arm::GetGPRSize() const {
|
||||
return sizeof(struct RegisterInfoPOSIX_arm::GPR);
|
||||
}
|
||||
|
||||
const lldb_private::RegisterInfo *
|
||||
RegisterContextLinux_arm::GetRegisterInfo() const {
|
||||
RegisterInfoPOSIX_arm::GetRegisterInfo() const {
|
||||
return m_register_info_p;
|
||||
}
|
||||
|
||||
uint32_t RegisterContextLinux_arm::GetRegisterCount() const {
|
||||
uint32_t RegisterInfoPOSIX_arm::GetRegisterCount() const {
|
||||
return m_register_info_count;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//===-- RegisterContextFreeBSD_arm.h ----------------------------*- C++ -*-===//
|
||||
//===-- RegisterInfoPOSIX_arm.h ---------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
|
@ -7,14 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_RegisterContextFreeBSD_arm_h_
|
||||
#define liblldb_RegisterContextFreeBSD_arm_h_
|
||||
#ifndef liblldb_RegisterInfoPOSIX_arm_h_
|
||||
#define liblldb_RegisterInfoPOSIX_arm_h_
|
||||
|
||||
#include "RegisterInfoInterface.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
class RegisterContextFreeBSD_arm : public lldb_private::RegisterInfoInterface {
|
||||
class RegisterInfoPOSIX_arm : public lldb_private::RegisterInfoInterface {
|
||||
public:
|
||||
struct GPR {
|
||||
uint32_t r[16]; // R0-R15
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
uint32_t wcr[16];
|
||||
};
|
||||
|
||||
RegisterContextFreeBSD_arm(const lldb_private::ArchSpec &target_arch);
|
||||
RegisterInfoPOSIX_arm(const lldb_private::ArchSpec &target_arch);
|
||||
|
||||
size_t GetGPRSize() const override;
|
||||
|
||||
|
@ -59,4 +59,4 @@ private:
|
|||
uint32_t m_register_info_count;
|
||||
};
|
||||
|
||||
#endif // liblldb_RegisterContextFreeBSD_arm_h_
|
||||
#endif // liblldb_RegisterInfoPOSIX_arm_h_
|
|
@ -14,15 +14,14 @@
|
|||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Target/Unwind.h"
|
||||
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_i386.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_mips64.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_powerpc.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextLinux_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextLinux_i386.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextLinux_s390x.h"
|
||||
#include "Plugins/Process/Utility/RegisterContextLinux_x86_64.h"
|
||||
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
|
||||
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
|
||||
#include "ProcessElfCore.h"
|
||||
#include "RegisterContextPOSIXCore_arm.h"
|
||||
|
@ -88,7 +87,7 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
|
|||
reg_interface = new RegisterInfoPOSIX_arm64(arch);
|
||||
break;
|
||||
case llvm::Triple::arm:
|
||||
reg_interface = new RegisterContextFreeBSD_arm(arch);
|
||||
reg_interface = new RegisterInfoPOSIX_arm(arch);
|
||||
break;
|
||||
case llvm::Triple::ppc:
|
||||
reg_interface = new RegisterContextFreeBSD_powerpc32(arch);
|
||||
|
@ -114,7 +113,7 @@ ThreadElfCore::CreateRegisterContextForFrame(StackFrame *frame) {
|
|||
case llvm::Triple::Linux: {
|
||||
switch (arch.GetMachine()) {
|
||||
case llvm::Triple::arm:
|
||||
reg_interface = new RegisterContextLinux_arm(arch);
|
||||
reg_interface = new RegisterInfoPOSIX_arm(arch);
|
||||
break;
|
||||
case llvm::Triple::aarch64:
|
||||
reg_interface = new RegisterInfoPOSIX_arm64(arch);
|
||||
|
|
Loading…
Reference in New Issue