18#include "llvm/Support/Compiler.h"
27#include "llvm/ADT/STLExtras.h"
163#define GPR_OFFSET(idx) ((idx)*4)
164#define FPU_OFFSET(idx) ((idx)*4 + sizeof(RegisterContextDarwin_arm::GPR))
165#define EXC_OFFSET(idx) \
166 ((idx)*4 + sizeof(RegisterContextDarwin_arm::GPR) + \
167 sizeof(RegisterContextDarwin_arm::FPU))
168#define DBG_OFFSET(reg) \
169 ((LLVM_EXTENSION offsetof(RegisterContextDarwin_arm::DBG, reg) + \
170 sizeof(RegisterContextDarwin_arm::GPR) + \
171 sizeof(RegisterContextDarwin_arm::FPU) + \
172 sizeof(RegisterContextDarwin_arm::EXC)))
174#define DEFINE_DBG(reg, i) \
175 #reg, NULL, sizeof(((RegisterContextDarwin_arm::DBG *) NULL)->reg[i]), \
176 DBG_OFFSET(reg[i]), eEncodingUint, eFormatHex, \
177 {LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
178 LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, \
179 LLDB_INVALID_REGNUM }, \
180 nullptr, nullptr, nullptr,
181#define REG_CONTEXT_SIZE \
182 (sizeof(RegisterContextDarwin_arm::GPR) + \
183 sizeof(RegisterContextDarwin_arm::FPU) + \
184 sizeof(RegisterContextDarwin_arm::EXC))
915 Thread &thread, uint32_t concrete_frame_idx)
1107 for (uint32_t i = 0; i < 16; i++)
1109 "BVR%-2u/BCR%-2u = { 0x%8.8x, 0x%8.8x } WVR%-2u/WCR%-2u = { "
1110 "0x%8.8x, 0x%8.8x }",
1296 uint8_t *dst = data_sp->GetBytes();
1297 ::memcpy(dst, &
gpr,
sizeof(
gpr));
1300 ::memcpy(dst, &
fpu,
sizeof(
fpu));
1303 ::memcpy(dst, &
exc,
sizeof(
exc));
1312 const uint8_t *src = data_sp->GetBytes();
1313 ::memcpy(&
gpr, src,
sizeof(
gpr));
1316 ::memcpy(&
fpu, src,
sizeof(
fpu));
1319 ::memcpy(&
exc, src,
sizeof(
exc));
1320 uint32_t success_count = 0;
1327 return success_count == 3;
1498#if defined(__APPLE__) && defined(__arm__)
1501 static uint32_t g_num_supported_hw_breakpoints =
UINT32_MAX;
1502 if (g_num_supported_hw_breakpoints ==
UINT32_MAX) {
1504 g_num_supported_hw_breakpoints = 0;
1506 uint32_t register_DBGDIDR;
1508 asm(
"mrc p14, 0, %0, c0, c0, 0" :
"=r"(register_DBGDIDR));
1509 g_num_supported_hw_breakpoints =
Bits32(register_DBGDIDR, 27, 24);
1511 if (g_num_supported_hw_breakpoints > 0)
1512 g_num_supported_hw_breakpoints++;
1514 return g_num_supported_hw_breakpoints;
1532 for (i = 0; i < num_hw_breakpoints; ++i) {
1538 if (i < num_hw_breakpoints) {
1542 if (size == 2 || addr & 2) {
1563 }
else if (size == 4) {
1607 if (hw_index < num_hw_points) {
1628#if defined(__APPLE__) && defined(__arm__)
1631 static uint32_t g_num_supported_hw_watchpoints =
UINT32_MAX;
1632 if (g_num_supported_hw_watchpoints ==
UINT32_MAX) {
1634 g_num_supported_hw_watchpoints = 0;
1636 uint32_t register_DBGDIDR;
1637 asm(
"mrc p14, 0, %0, c0, c0, 0" :
"=r"(register_DBGDIDR));
1638 g_num_supported_hw_watchpoints =
Bits32(register_DBGDIDR, 31, 28) + 1;
1640 return g_num_supported_hw_watchpoints;
1658 if (!read && !write)
1669 uint32_t addr_word_offset = addr % 4;
1674 uint32_t byte_mask = ((1u << size) - 1u) << addr_word_offset;
1678 if (byte_mask > 0xfu)
1688 for (i = 0; i < num_hw_watchpoints; ++i) {
1694 if (i < num_hw_watchpoints) {
1696 uint32_t byte_address_select = byte_mask << 5;
1699 dbg.
wcr[i] = byte_address_select |
1727 if (hw_index < num_hw_points) {
static const uint32_t k_num_register_infos
static const RegisterInfo g_register_infos[]
#define LLDB_LOGF(log,...)
#define KERN_SUCCESS
Constants returned by various RegisterContextDarwin_*** functions.
#define KERN_INVALID_ARGUMENT
const size_t k_num_regsets
static uint32_t g_fpu_regnums[]
static uint32_t g_gpr_regnums[]
static RegisterInfo g_register_infos[]
static uint32_t g_exc_regnums[]
const size_t k_num_gpr_registers
const size_t k_num_fpu_registers
static const RegisterSet g_reg_sets[]
const size_t k_num_exc_registers
#define DEFINE_DBG(reg, i)
static size_t k_num_register_infos
static RegisterSet g_reg_sets[]
uint32_t NumSupportedHardwareBreakpoints() override
bool ClearHardwareBreakpoint(uint32_t hw_idx) override
int WriteRegisterSet(uint32_t set)
uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, bool read, bool write) override
uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
const lldb_private::RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
void InvalidateAllRegisterStates()
bool WriteRegister(const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue ®_value) override
static size_t GetRegisterInfosCount()
static const lldb_private::RegisterInfo * GetRegisterInfos()
~RegisterContextDarwin_arm() override
size_t GetRegisterCount() override
virtual int DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg)=0
bool ReadAllRegisterValues(lldb::WritableDataBufferSP &data_sp) override
void InvalidateAllRegisters() override
virtual int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc)=0
bool WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override
bool ReadRegister(const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue ®_value) override
bool RegisterSetIsCached(int set) const
uint32_t NumSupportedHardwareWatchpoints() override
int ReadRegisterSet(uint32_t set, bool force)
const lldb_private::RegisterSet * GetRegisterSet(size_t set) override
bool ClearHardwareWatchpoint(uint32_t hw_index) override
virtual int DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg)=0
virtual int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr)=0
int GetError(int flavor, uint32_t err_idx) const
RegisterContextDarwin_arm(lldb_private::Thread &thread, uint32_t concrete_frame_idx)
size_t GetRegisterSetCount() override
bool SetError(int flavor, uint32_t err_idx, int err)
virtual int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr)
virtual int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu)=0
virtual int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu)=0
static int GetSetForNativeRegNum(int reg_num)
virtual int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc)=0
static void LogDBGRegisters(lldb_private::Log *log, const DBG &dbg)
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
virtual lldb::tid_t GetThreadID() const
uint32_t GetAsUInt32(uint32_t fail_value=UINT32_MAX, bool *success_ptr=nullptr) const
void SetUInt32(uint32_t uint, Type t=eTypeUInt32)
#define LLDB_REGNUM_GENERIC_RA
#define LLDB_INVALID_INDEX32
#define LLDB_REGNUM_GENERIC_SP
#define LLDB_REGNUM_GENERIC_FLAGS
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_PC
#define LLDB_REGNUM_GENERIC_FP
A class that represents a running process on the host machine.
static uint32_t Bits32(const uint32_t bits, const uint32_t msbit, const uint32_t lsbit)
@ eEncodingUint
unsigned integer
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindLLDB
lldb's internal register numbers
@ eRegisterKindDWARF
the register numbers seen DWARF
@ eRegisterKindEHFrame
the register numbers seen in eh_frame
union RegisterContextDarwin_arm::FPU::@117 floats
Every register is described in detail including its name, alternate name (optional),...
uint32_t kinds[lldb::kNumRegisterKinds]
Holds all of the various register numbers for all register kinds.
Registers are grouped into register sets.