mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 22:30:13 +00:00
[LLDB] Switch to RegisterInfo& for EmulateInstruction::WriteRegister
WriteRegister and WriteRegisterUnsigned were never pased nullptr, and only one of them appeared to handle it. Switch to ref to make the intent clear. Depends on D134962 Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D134963
This commit is contained in:
parent
a2122a09cf
commit
81832afc04
@ -393,11 +393,11 @@ public:
|
||||
uint64_t ReadRegisterUnsigned(const RegisterInfo ®_info,
|
||||
uint64_t fail_value, bool *success_ptr);
|
||||
|
||||
bool WriteRegister(const Context &context, const RegisterInfo *ref_info,
|
||||
bool WriteRegister(const Context &context, const RegisterInfo &ref_info,
|
||||
const RegisterValue ®_value);
|
||||
|
||||
bool WriteRegisterUnsigned(const Context &context,
|
||||
const RegisterInfo *reg_info, uint64_t reg_value);
|
||||
const RegisterInfo ®_info, uint64_t reg_value);
|
||||
|
||||
// Register kind and number variants
|
||||
bool ReadRegister(lldb::RegisterKind reg_kind, uint32_t reg_num,
|
||||
|
@ -112,10 +112,10 @@ uint64_t EmulateInstruction::ReadRegisterUnsigned(const RegisterInfo ®_info,
|
||||
}
|
||||
|
||||
bool EmulateInstruction::WriteRegister(const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
const RegisterInfo ®_info,
|
||||
const RegisterValue ®_value) {
|
||||
if (m_write_reg_callback != nullptr)
|
||||
return m_write_reg_callback(this, m_baton, context, reg_info, reg_value);
|
||||
return m_write_reg_callback(this, m_baton, context, ®_info, reg_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ bool EmulateInstruction::WriteRegister(const Context &context,
|
||||
const RegisterValue ®_value) {
|
||||
llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
|
||||
if (reg_info)
|
||||
return WriteRegister(context, &(*reg_info), reg_value);
|
||||
return WriteRegister(context, *reg_info, reg_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,19 +137,17 @@ bool EmulateInstruction::WriteRegisterUnsigned(const Context &context,
|
||||
if (reg_info) {
|
||||
RegisterValue reg_value;
|
||||
if (reg_value.SetUInt(uint_value, reg_info->byte_size))
|
||||
return WriteRegister(context, &(*reg_info), reg_value);
|
||||
return WriteRegister(context, *reg_info, reg_value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EmulateInstruction::WriteRegisterUnsigned(const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
const RegisterInfo ®_info,
|
||||
uint64_t uint_value) {
|
||||
if (reg_info != nullptr) {
|
||||
RegisterValue reg_value;
|
||||
if (reg_value.SetUInt(uint_value, reg_info->byte_size))
|
||||
return WriteRegister(context, reg_info, reg_value);
|
||||
}
|
||||
RegisterValue reg_value;
|
||||
if (reg_value.SetUInt(uint_value, reg_info.byte_size))
|
||||
return WriteRegister(context, reg_info, reg_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2713,7 +2713,7 @@ bool EmulateInstructionARM::EmulateVPOP(const uint32_t opcode,
|
||||
data = MemARead(context, addr, reg_byte_size, 0, &success);
|
||||
if (!success)
|
||||
return false;
|
||||
if (!WriteRegisterUnsigned(context, &(*dwarf_reg), data))
|
||||
if (!WriteRegisterUnsigned(context, *dwarf_reg, data))
|
||||
return false;
|
||||
addr += reg_byte_size;
|
||||
}
|
||||
|
@ -876,7 +876,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
|
||||
if (!vector && is_signed && !data_Rt.SignExtend(datasize))
|
||||
return false;
|
||||
|
||||
if (!WriteRegister(context_t, &(*reg_info_Rt), data_Rt))
|
||||
if (!WriteRegister(context_t, *reg_info_Rt, data_Rt))
|
||||
return false;
|
||||
|
||||
if (!rt_unknown) {
|
||||
@ -893,7 +893,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
|
||||
if (!vector && is_signed && !data_Rt2.SignExtend(datasize))
|
||||
return false;
|
||||
|
||||
if (!WriteRegister(context_t2, &(*reg_info_Rt2), data_Rt2))
|
||||
if (!WriteRegister(context_t2, *reg_info_Rt2, data_Rt2))
|
||||
return false;
|
||||
} break;
|
||||
|
||||
@ -910,7 +910,7 @@ bool EmulateInstructionARM64::EmulateLDPSTP(const uint32_t opcode) {
|
||||
context.type = eContextAdjustStackPointer;
|
||||
else
|
||||
context.type = eContextAdjustBaseRegister;
|
||||
WriteRegisterUnsigned(context, &(*reg_info_base), wb_address);
|
||||
WriteRegisterUnsigned(context, *reg_info_base, wb_address);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1023,7 +1023,7 @@ bool EmulateInstructionARM64::EmulateLDRSTRImm(const uint32_t opcode) {
|
||||
error) == 0)
|
||||
return false;
|
||||
|
||||
if (!WriteRegister(context, &(*reg_info_Rt), data_Rt))
|
||||
if (!WriteRegister(context, *reg_info_Rt, data_Rt))
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
@ -1040,7 +1040,7 @@ bool EmulateInstructionARM64::EmulateLDRSTRImm(const uint32_t opcode) {
|
||||
context.type = eContextAdjustBaseRegister;
|
||||
context.SetImmediateSigned(offset);
|
||||
|
||||
if (!WriteRegisterUnsigned(context, &(*reg_info_base), address))
|
||||
if (!WriteRegisterUnsigned(context, *reg_info_base, address))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1321,7 +1321,7 @@ bool EmulateInstructionMIPS::Emulate_LW(llvm::MCInst &insn) {
|
||||
context.type = eContextPopRegisterOffStack;
|
||||
context.SetAddress(address);
|
||||
|
||||
return WriteRegister(context, &(*reg_info_src), data_src);
|
||||
return WriteRegister(context, *reg_info_src, data_src);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1661,7 +1661,7 @@ bool EmulateInstructionMIPS::Emulate_LWSP(llvm::MCInst &insn) {
|
||||
context.type = eContextPopRegisterOffStack;
|
||||
context.SetAddress(base_address);
|
||||
|
||||
return WriteRegister(context, &(*reg_info_src), data_src);
|
||||
return WriteRegister(context, *reg_info_src, data_src);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1723,7 +1723,7 @@ bool EmulateInstructionMIPS::Emulate_LWM16_32(llvm::MCInst &insn) {
|
||||
context.type = eContextPopRegisterOffStack;
|
||||
context.SetAddress(base_address + (i * 4));
|
||||
|
||||
if (!WriteRegister(context, &(*reg_info_dst), data_dst))
|
||||
if (!WriteRegister(context, *reg_info_dst, data_dst))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1217,7 +1217,7 @@ bool EmulateInstructionMIPS64::Emulate_LD(llvm::MCInst &insn) {
|
||||
Context context;
|
||||
context.type = eContextRegisterLoad;
|
||||
|
||||
return WriteRegister(context, &(*reg_info_src), data_src);
|
||||
return WriteRegister(context, *reg_info_src, data_src);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user