41 uint64_t regs[31 + 1 + 1 + 1];
43 uint64_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14,
44 x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28,
58 inline uint64_t pc()
const {
return gp.pc; }
59 inline void setPC(uint64_t pc) { gp.pc = pc; }
61 inline uint64_t sp()
const {
return gp.sp; }
62 inline void setSP(uint64_t sp) { gp.sp = sp; }
64 inline uint64_t retval()
const {
return gp.x0; }
67 inline void getGPState(GPRegisterValueVector ®s)
const {
69 for (
size_t n = 0; n < array_sizeof(gp.regs); n++) {
74 inline void setGPState(std::vector<uint64_t>
const ®s) {
75 for (
size_t n = 0; n < regs.size() && n < array_sizeof(gp.regs); n++) {
81 inline void getStopGPState(GPRegisterStopMap ®s,
bool forLLDB)
const {
83 for (
size_t n = 0; n < 33; n++) {
84 regs[n + reg_lldb_x0] =
GPRegisterValue{
sizeof(gp.regs[n]), gp.regs[n]};
89 for (
size_t n = 0; n < 33; n++) {
91 regs[n + reg_gdb_x0] =
100 inline bool getLLDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
101 if (regno >= reg_lldb_x0 && regno <= reg_lldb_x30) {
102 *ptr =
const_cast<uint64_t *
>(&gp.regs[regno - reg_lldb_x0]);
103 *length =
sizeof(gp.regs[0]);
104 }
else if (regno == reg_lldb_sp) {
105 *ptr =
const_cast<uint64_t *
>(&gp.sp);
106 *length =
sizeof(gp.sp);
107 }
else if (regno == reg_lldb_pc) {
108 *ptr =
const_cast<uint64_t *
>(&gp.pc);
109 *length =
sizeof(gp.pc);
110 }
else if (regno == reg_lldb_cpsr) {
111 *ptr =
const_cast<uint64_t *
>(&gp.cpsr);
112 *length =
sizeof(gp.cpsr);
120 inline bool getGDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
121 if (regno >= reg_gdb_x0 && regno <= reg_gdb_x30) {
122 *ptr =
const_cast<uint64_t *
>(&gp.regs[regno - reg_gdb_x0]);
123 *length =
sizeof(gp.regs[0]);
124 }
else if (regno == reg_gdb_sp) {
125 *ptr =
const_cast<uint64_t *
>(&gp.sp);
126 *length =
sizeof(gp.sp);
127 }
else if (regno == reg_gdb_pc) {
128 *ptr =
const_cast<uint64_t *
>(&gp.pc);
129 *length =
sizeof(gp.pc);
130 }
else if (regno == reg_gdb_cpsr) {
131 *ptr =
const_cast<uint64_t *
>(&gp.cpsr);
132 *length =
sizeof(gp.cpsr);
159 inline uint64_t pc()
const {
160 return isA32 ?
static_cast<uint64_t
>(state32.pc()) : state64.pc();
162 inline void setPC(uint64_t pc) {
169 inline uint64_t sp()
const {
170 return isA32 ?
static_cast<uint64_t
>(state32.sp()) : state64.sp();
172 inline void setSP(uint64_t sp) {
179 inline uint64_t retval()
const {
180 return isA32 ?
static_cast<uint64_t
>(state32.retval()) : state64.retval();
183 inline bool isThumb()
const {
return isA32 ? state32.isThumb() :
false; }
186 inline void getGPState(GPRegisterValueVector ®s)
const {
188 state32.getGPState(regs);
190 state64.getGPState(regs);
194 inline void setGPState(std::vector<uint64_t>
const ®s) {
196 state32.setGPState(regs);
198 state64.setGPState(regs);
203 inline void getStopGPState(GPRegisterStopMap ®s,
bool forLLDB)
const {
205 state32.getStopGPState(regs, forLLDB);
207 state64.getStopGPState(regs, forLLDB);
212 inline bool getLLDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
214 return state32.getLLDBRegisterPtr(regno, ptr, length);
216 return state64.getLLDBRegisterPtr(regno, ptr, length);
220 inline bool getGDBRegisterPtr(
int regno,
void **ptr,
size_t *length)
const {
222 return state32.getGDBRegisterPtr(regno, ptr, length);
224 return state64.getGDBRegisterPtr(regno, ptr, length);