LLDB mainline
|
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes. More...
#include <EmulateInstruction.h>
Classes | |
struct | Context |
Public Member Functions | |
EmulateInstruction (const ArchSpec &arch) | |
~EmulateInstruction () override=default | |
virtual bool | SupportsEmulatingInstructionsOfType (InstructionType inst_type)=0 |
virtual bool | SetTargetTriple (const ArchSpec &arch)=0 |
virtual bool | ReadInstruction ()=0 |
virtual std::optional< uint32_t > | GetLastInstrSize () |
virtual bool | EvaluateInstruction (uint32_t evaluate_options)=0 |
virtual InstructionCondition | GetInstructionCondition () |
virtual bool | TestEmulation (Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data)=0 |
virtual std::optional< RegisterInfo > | GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num)=0 |
virtual bool | SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, Target *target) |
virtual bool | CreateFunctionEntryUnwind (UnwindPlan &unwind_plan) |
std::optional< RegisterValue > | ReadRegister (const RegisterInfo ®_info) |
uint64_t | ReadRegisterUnsigned (const RegisterInfo ®_info, uint64_t fail_value, bool *success_ptr) |
bool | WriteRegister (const Context &context, const RegisterInfo &ref_info, const RegisterValue ®_value) |
bool | WriteRegisterUnsigned (const Context &context, const RegisterInfo ®_info, uint64_t reg_value) |
bool | ReadRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterValue ®_value) |
bool | WriteRegister (const Context &context, lldb::RegisterKind reg_kind, uint32_t reg_num, const RegisterValue ®_value) |
uint64_t | ReadRegisterUnsigned (lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t fail_value, bool *success_ptr) |
bool | WriteRegisterUnsigned (const Context &context, lldb::RegisterKind reg_kind, uint32_t reg_num, uint64_t reg_value) |
size_t | ReadMemory (const Context &context, lldb::addr_t addr, void *dst, size_t dst_len) |
uint64_t | ReadMemoryUnsigned (const Context &context, lldb::addr_t addr, size_t byte_size, uint64_t fail_value, bool *success_ptr) |
bool | WriteMemory (const Context &context, lldb::addr_t addr, const void *src, size_t src_len) |
bool | WriteMemoryUnsigned (const Context &context, lldb::addr_t addr, uint64_t uval, size_t uval_byte_size) |
uint32_t | GetAddressByteSize () const |
lldb::ByteOrder | GetByteOrder () const |
const Opcode & | GetOpcode () const |
lldb::addr_t | GetAddress () const |
const ArchSpec & | GetArchitecture () const |
void | SetBaton (void *baton) |
void | SetCallbacks (ReadMemoryCallback read_mem_callback, WriteMemoryCallback write_mem_callback, ReadRegisterCallback read_reg_callback, WriteRegisterCallback write_reg_callback) |
void | SetReadMemCallback (ReadMemoryCallback read_mem_callback) |
void | SetWriteMemCallback (WriteMemoryCallback write_mem_callback) |
void | SetReadRegCallback (ReadRegisterCallback read_reg_callback) |
void | SetWriteRegCallback (WriteRegisterCallback write_reg_callback) |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Static Public Member Functions | |
static EmulateInstruction * | FindPlugin (const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name) |
static const char * | TranslateRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, std::string ®_name) |
static size_t | ReadMemoryFrame (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length) |
static size_t | WriteMemoryFrame (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length) |
static bool | ReadRegisterFrame (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value) |
static bool | WriteRegisterFrame (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value) |
static size_t | ReadMemoryDefault (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length) |
static size_t | WriteMemoryDefault (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length) |
static bool | ReadRegisterDefault (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value) |
static bool | WriteRegisterDefault (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value) |
static bool | GetBestRegisterKindAndNumber (const RegisterInfo *reg_info, lldb::RegisterKind ®_kind, uint32_t ®_num) |
static uint32_t | GetInternalRegisterNumber (RegisterContext *reg_ctx, const RegisterInfo ®_info) |
Static Public Attributes | |
static const InstructionCondition | UnconditionalCondition = UINT32_MAX |
Private Member Functions | |
EmulateInstruction (const EmulateInstruction &)=delete | |
const EmulateInstruction & | operator= (const EmulateInstruction &)=delete |
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
This class is a plug-in interface that is accessed through the standard static FindPlugin function call in the EmulateInstruction class. The FindPlugin takes a target triple and returns a new object if there is a plug-in that supports the architecture and OS. Four callbacks and a baton are provided. The four callbacks are read register, write register, read memory and write memory.
This class is currently designed for these main use cases: - Auto generation of Call Frame Information (CFI) from assembly code - Predicting single step breakpoint locations - Emulating instructions for breakpoint traps
Objects can be asked to read an instruction which will cause a call to the read register callback to get the PC, followed by a read memory call to read the opcode. If ReadInstruction () returns true, then a call to EmulateInstruction::EvaluateInstruction () can be made. At this point the EmulateInstruction subclass will use all of the callbacks to emulate an instruction.
Clients that provide the callbacks can either do the read/write registers/memory to actually emulate the instruction on a real or virtual CPU, or watch for the EmulateInstruction::Context which is context for the read/write register/memory which explains why the callback is being called. Examples of a context are: "pushing register 3 onto the stack at offset -12", or "adjusting stack pointer by -16". This extra context allows the generation of CFI information from assembly code without having to actually do the read/write register/memory.
Clients must be prepared that not all instructions for an Instruction Set Architecture (ISA) will be emulated.
Subclasses at the very least should implement the instructions that save and restore registers onto the stack and adjustment to the stack pointer. By just implementing a few instructions for an ISA that are the typical prologue opcodes, you can then generate CFI using a class that will soon be available.
Implementing all of the instructions that affect the PC can then allow single step prediction support.
Implementing all of the instructions allows for emulation of opcodes for breakpoint traps and will pave the way for "thread centric" debugging. The current debugging model is "process centric" where all threads must be stopped when any thread is stopped; when hitting software breakpoints we must disable the breakpoint by restoring the original breakpoint opcode, single stepping and restoring the breakpoint trap. If all threads were allowed to run then other threads could miss the breakpoint.
This class centralizes the code that usually is done in separate code paths in a debugger (single step prediction, finding save restore locations of registers for unwinding stack frame variables) and emulating the instruction is just a bonus.
Definition at line 94 of file EmulateInstruction.h.
typedef uint32_t lldb_private::EmulateInstruction::InstructionCondition |
Definition at line 357 of file EmulateInstruction.h.
typedef size_t(* lldb_private::EmulateInstruction::ReadMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length) |
Definition at line 334 of file EmulateInstruction.h.
typedef bool(* lldb_private::EmulateInstruction::ReadRegisterCallback) (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value) |
Definition at line 344 of file EmulateInstruction.h.
typedef size_t(* lldb_private::EmulateInstruction::WriteMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length) |
Definition at line 339 of file EmulateInstruction.h.
typedef bool(* lldb_private::EmulateInstruction::WriteRegisterCallback) (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value) |
Definition at line 349 of file EmulateInstruction.h.
Definition at line 100 of file EmulateInstruction.h.
Definition at line 168 of file EmulateInstruction.h.
EmulateInstruction::EmulateInstruction | ( | const ArchSpec & | arch | ) |
Definition at line 74 of file EmulateInstruction.cpp.
|
overridedefault |
|
privatedelete |
|
virtual |
Reimplemented in EmulateInstructionARM64, EmulateInstructionMIPS, EmulateInstructionMIPS64, lldb_private::EmulateInstructionARM, and lldb_private::EmulateInstructionPPC64.
Definition at line 591 of file EmulateInstruction.cpp.
References lldb_private::UnwindPlan::Clear().
|
pure virtual |
|
static |
Definition at line 45 of file EmulateInstruction.cpp.
References lldb_private::PluginManager::GetEmulateInstructionCreateCallbackAtIndex(), and lldb_private::PluginManager::GetEmulateInstructionCreateCallbackForPluginName().
Referenced by UnwindAssemblyInstEmulation::CreateInstance(), lldb_private::Instruction::DumpEmulation(), lldb_private::Instruction::Emulate(), lldb_private::NativeProcessSoftwareSingleStep::SetupSoftwareSingleStepping(), and lldb_private::Instruction::TestEmulation().
|
inline |
Definition at line 440 of file EmulateInstruction.h.
References m_addr.
|
inline |
Definition at line 434 of file EmulateInstruction.h.
References lldb_private::ArchSpec::GetAddressByteSize(), and m_arch.
Referenced by lldb_private::EmulateInstructionARM::EmulateLDM(), lldb_private::EmulateInstructionARM::EmulateLDMDA(), lldb_private::EmulateInstructionARM::EmulateLDMDB(), lldb_private::EmulateInstructionARM::EmulateLDMIB(), lldb_private::EmulateInstructionARM::EmulateLDRDImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRDRegister(), lldb_private::EmulateInstructionARM::EmulateLDRImmediateARM(), lldb_private::EmulateInstructionARM::EmulateLDRRegister(), lldb_private::EmulateInstructionARM::EmulatePOP(), lldb_private::EmulateInstructionARM::EmulatePUSH(), lldb_private::EmulateInstructionARM::EmulateSTM(), lldb_private::EmulateInstructionARM::EmulateSTMDA(), lldb_private::EmulateInstructionARM::EmulateSTMDB(), lldb_private::EmulateInstructionARM::EmulateSTMIB(), lldb_private::EmulateInstructionARM::EmulateSTRDImm(), lldb_private::EmulateInstructionARM::EmulateSTRDReg(), lldb_private::EmulateInstructionARM::EmulateSTREX(), lldb_private::EmulateInstructionARM::EmulateSTRImmARM(), lldb_private::EmulateInstructionARM::EmulateSTRRegister(), lldb_private::EmulateInstructionARM::EmulateSTRRtSP(), lldb_private::EmulateInstructionARM::EmulateSTRThumb(), lldb_private::EmulateInstructionARM::EmulateVLDM(), lldb_private::EmulateInstructionARM::EmulateVLDR(), lldb_private::EmulateInstructionARM::EmulateVPOP(), lldb_private::EmulateInstructionARM::EmulateVPUSH(), lldb_private::EmulateInstructionARM::EmulateVSTM(), lldb_private::EmulateInstructionARM::EmulateVSTR(), ReadMemoryUnsigned(), EmulateInstructionMIPS::SetInstruction(), lldb_private::EmulateInstructionARM::WriteBits32UnknownToMemory(), and WriteMemoryUnsigned().
|
inline |
Definition at line 442 of file EmulateInstruction.h.
References m_arch.
Referenced by UnwindAssemblyInstEmulation::WriteMemory().
|
static |
Definition at line 544 of file EmulateInstruction.cpp.
References lldb::eRegisterKindDWARF, lldb::eRegisterKindEHFrame, lldb::eRegisterKindGeneric, lldb::eRegisterKindLLDB, lldb::eRegisterKindProcessPlugin, lldb_private::RegisterInfo::kinds, and LLDB_INVALID_REGNUM.
Referenced by GetInternalRegisterNumber(), UnwindAssemblyInstEmulation::MakeRegisterKindValuePair(), and ReadRegisterDefault().
|
inline |
Definition at line 436 of file EmulateInstruction.h.
References lldb_private::ArchSpec::GetByteOrder(), and m_arch.
Referenced by lldb_private::EmulateInstructionARM::EmulateVLDM(), lldb_private::EmulateInstructionARM::EmulateVLDR(), lldb_private::EmulateInstructionARM::EmulateVSTM(), lldb_private::EmulateInstructionARM::EmulateVSTR(), lldb_private::EmulateInstructionARM::ReadInstruction(), EmulateInstructionARM64::ReadInstruction(), lldb_private::EmulateInstructionLoongArch::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), lldb_private::EmulateInstructionRISCV::ReadInstruction(), ReadMemoryUnsigned(), EmulateInstructionMIPS::SetInstruction(), and WriteMemoryUnsigned().
|
inlinevirtual |
Reimplemented in lldb_private::EmulateInstructionARM.
Definition at line 376 of file EmulateInstruction.h.
References UnconditionalCondition.
|
static |
Definition at line 582 of file EmulateInstruction.cpp.
References lldb_private::RegisterContext::ConvertRegisterKindToRegisterNumber(), GetBestRegisterKindAndNumber(), and LLDB_INVALID_REGNUM.
|
inlinevirtual |
Reimplemented in lldb_private::EmulateInstructionRISCV.
Definition at line 372 of file EmulateInstruction.h.
|
inline |
Definition at line 438 of file EmulateInstruction.h.
References m_opcode.
|
pure virtual |
Implemented in lldb_private::EmulateInstructionARM, EmulateInstructionARM64, lldb_private::EmulateInstructionLoongArch, EmulateInstructionMIPS, EmulateInstructionMIPS64, lldb_private::EmulateInstructionPPC64, and lldb_private::EmulateInstructionRISCV.
Referenced by ReadRegister(), WriteRegister(), and WriteRegisterUnsigned().
|
privatedelete |
|
pure virtual |
size_t EmulateInstruction::ReadMemory | ( | const Context & | context, |
lldb::addr_t | addr, | ||
void * | dst, | ||
size_t | dst_len | ||
) |
Definition at line 166 of file EmulateInstruction.cpp.
References m_baton, and m_read_mem_callback.
Referenced by EmulateInstructionARM64::EmulateLDPSTP(), and EmulateInstructionARM64::EmulateLDRSTRImm().
|
static |
Definition at line 314 of file EmulateInstruction.cpp.
References lldb_private::EmulateInstruction::Context::Dump(), lldb_private::Stream::EOL(), and lldb_private::Stream::Printf().
|
static |
Definition at line 257 of file EmulateInstruction.cpp.
References lldb_private::StackFrame::CalculateProcess(), and error().
Referenced by lldb::SBInstruction::EmulateWithFrame().
uint64_t EmulateInstruction::ReadMemoryUnsigned | ( | const Context & | context, |
lldb::addr_t | addr, | ||
size_t | byte_size, | ||
uint64_t | fail_value, | ||
bool * | success_ptr | ||
) |
Definition at line 174 of file EmulateInstruction.cpp.
References GetAddressByteSize(), GetByteOrder(), lldb_private::DataExtractor::GetMaxU64(), m_baton, and m_read_mem_callback.
Referenced by lldb_private::EmulateInstructionARM::MemARead(), lldb_private::EmulateInstructionARM::MemURead(), EmulateInstructionARM64::ReadInstruction(), lldb_private::EmulateInstructionLoongArch::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), and lldb_private::EmulateInstructionRISCV::ReadMem().
std::optional< RegisterValue > EmulateInstruction::ReadRegister | ( | const RegisterInfo & | reg_info | ) |
Definition at line 77 of file EmulateInstruction.cpp.
References m_baton, and m_read_reg_callback.
Referenced by EmulateInstructionMIPS::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_SD(), EmulateInstructionMIPS::Emulate_SW(), EmulateInstructionMIPS::Emulate_SWM16_32(), EmulateInstructionMIPS::Emulate_SWSP(), EmulateInstructionARM64::EmulateLDPSTP(), EmulateInstructionARM64::EmulateLDRSTRImm(), lldb_private::Rs::Read(), lldb_private::Rs::ReadAPFloat(), ReadRegister(), and ReadRegisterUnsigned().
bool EmulateInstruction::ReadRegister | ( | lldb::RegisterKind | reg_kind, |
uint32_t | reg_num, | ||
RegisterValue & | reg_value | ||
) |
Definition at line 88 of file EmulateInstruction.cpp.
References GetRegisterInfo(), and ReadRegister().
|
static |
Definition at line 343 of file EmulateInstruction.cpp.
References GetBestRegisterKindAndNumber(), lldb_private::RegisterInfo::name, lldb_private::Stream::Printf(), and lldb_private::RegisterValue::SetUInt64().
|
static |
Definition at line 292 of file EmulateInstruction.cpp.
References lldb_private::StackFrame::GetRegisterContext().
Referenced by lldb::SBInstruction::EmulateWithFrame().
uint64_t EmulateInstruction::ReadRegisterUnsigned | ( | const RegisterInfo & | reg_info, |
uint64_t | fail_value, | ||
bool * | success_ptr | ||
) |
Definition at line 113 of file EmulateInstruction.cpp.
References ReadRegister().
Referenced by EmulateInstructionMIPS::Emulate_3D_branch(), EmulateInstructionMIPS64::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_ADDiu(), EmulateInstructionMIPS::Emulate_ADDIUS5(), EmulateInstructionMIPS::Emulate_ADDIUSP(), EmulateInstructionMIPS::Emulate_B16_MM(), EmulateInstructionMIPS::Emulate_BAL(), EmulateInstructionMIPS64::Emulate_BAL(), EmulateInstructionMIPS::Emulate_BALC(), EmulateInstructionMIPS64::Emulate_BALC(), EmulateInstructionMIPS::Emulate_BC(), EmulateInstructionMIPS64::Emulate_BC(), EmulateInstructionMIPS::Emulate_BC1EQZ(), EmulateInstructionMIPS64::Emulate_BC1EQZ(), EmulateInstructionMIPS::Emulate_BC1NEZ(), EmulateInstructionMIPS64::Emulate_BC1NEZ(), EmulateInstructionMIPS::Emulate_Bcond_Link(), EmulateInstructionMIPS64::Emulate_Bcond_Link(), EmulateInstructionMIPS::Emulate_Bcond_Link_C(), EmulateInstructionMIPS64::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Branch_MM(), EmulateInstructionMIPS::Emulate_BXX_2ops(), EmulateInstructionMIPS64::Emulate_BXX_2ops(), EmulateInstructionMIPS::Emulate_BXX_2ops_C(), EmulateInstructionMIPS64::Emulate_BXX_2ops_C(), EmulateInstructionMIPS::Emulate_BXX_3ops(), EmulateInstructionMIPS64::Emulate_BXX_3ops(), EmulateInstructionMIPS::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_DADDiu(), EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(), EmulateInstructionMIPS::Emulate_FP_branch(), EmulateInstructionMIPS64::Emulate_FP_branch(), EmulateInstructionMIPS::Emulate_J(), EmulateInstructionMIPS64::Emulate_J(), EmulateInstructionMIPS::Emulate_JAL(), EmulateInstructionMIPS64::Emulate_JAL(), EmulateInstructionMIPS::Emulate_JALR(), EmulateInstructionMIPS64::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALRS(), EmulateInstructionMIPS::Emulate_JALRx16_MM(), EmulateInstructionMIPS::Emulate_JALx(), EmulateInstructionMIPS::Emulate_JIALC(), EmulateInstructionMIPS64::Emulate_JIALC(), EmulateInstructionMIPS::Emulate_JIC(), EmulateInstructionMIPS64::Emulate_JIC(), EmulateInstructionMIPS::Emulate_JR(), EmulateInstructionMIPS64::Emulate_JR(), EmulateInstructionMIPS::Emulate_JRADDIUSP(), EmulateInstructionMIPS64::Emulate_LD(), EmulateInstructionMIPS::Emulate_LDST_Imm(), EmulateInstructionMIPS64::Emulate_LDST_Imm(), EmulateInstructionMIPS::Emulate_LDST_Reg(), EmulateInstructionMIPS64::Emulate_LDST_Reg(), EmulateInstructionMIPS::Emulate_LW(), EmulateInstructionMIPS::Emulate_LWM16_32(), EmulateInstructionMIPS::Emulate_LWSP(), EmulateInstructionMIPS::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_SD(), EmulateInstructionMIPS::Emulate_SUBU_ADDU(), EmulateInstructionMIPS::Emulate_SW(), EmulateInstructionMIPS::Emulate_SWM16_32(), EmulateInstructionMIPS::Emulate_SWSP(), lldb_private::EmulateInstructionPPC64::EmulateADDI(), lldb_private::EmulateInstructionARM::EmulateADDImmThumb(), EmulateInstructionARM64::EmulateADDSUBImm(), EmulateInstructionARM64::EmulateB(), lldb_private::EmulateInstructionLoongArch::EmulateBCEQZ64(), lldb_private::EmulateInstructionLoongArch::EmulateBCNEZ64(), EmulateInstructionARM64::EmulateBcond(), lldb_private::EmulateInstructionLoongArch::EmulateBEQ64(), lldb_private::EmulateInstructionLoongArch::EmulateBEQZ64(), lldb_private::EmulateInstructionLoongArch::EmulateBGE64(), lldb_private::EmulateInstructionLoongArch::EmulateBGEU64(), lldb_private::EmulateInstructionLoongArch::EmulateBLT64(), lldb_private::EmulateInstructionLoongArch::EmulateBLTU64(), lldb_private::EmulateInstructionLoongArch::EmulateBNE64(), lldb_private::EmulateInstructionLoongArch::EmulateBNEZ64(), EmulateInstructionARM64::EmulateCBZ(), lldb_private::EmulateInstructionLoongArch::EmulateJIRL64(), lldb_private::EmulateInstructionARM::EmulateLDM(), lldb_private::EmulateInstructionARM::EmulateLDMDB(), lldb_private::EmulateInstructionARM::EmulateLDMIB(), EmulateInstructionARM64::EmulateLDPSTP(), lldb_private::EmulateInstructionARM::EmulateLDRBImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRBRegister(), lldb_private::EmulateInstructionARM::EmulateLDRHImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRHRegister(), lldb_private::EmulateInstructionARM::EmulateLDRRegister(), lldb_private::EmulateInstructionARM::EmulateLDRSBRegister(), lldb_private::EmulateInstructionARM::EmulateLDRSHImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRSHRegister(), EmulateInstructionARM64::EmulateLDRSTRImm(), lldb_private::EmulateInstructionPPC64::EmulateMFSPR(), lldb_private::EmulateInstructionARM::EmulateMUL(), lldb_private::EmulateInstructionPPC64::EmulateOR(), lldb_private::EmulateInstructionARM::EmulateRFE(), lldb_private::EmulateInstructionPPC64::EmulateSTD(), lldb_private::EmulateInstructionARM::EmulateSTM(), lldb_private::EmulateInstructionARM::EmulateSTMDA(), lldb_private::EmulateInstructionARM::EmulateSTMDB(), lldb_private::EmulateInstructionARM::EmulateSTMIB(), lldb_private::EmulateInstructionARM::EmulateSTRBThumb(), lldb_private::EmulateInstructionARM::EmulateSTREX(), lldb_private::EmulateInstructionARM::EmulateSTRRegister(), lldb_private::EmulateInstructionARM::EmulateSTRThumb(), lldb_private::EmulateInstructionARM::EmulateSUBSPcLrEtc(), lldb_private::EmulateInstructionARM::EmulateSXTB(), lldb_private::EmulateInstructionARM::EmulateSXTH(), EmulateInstructionARM64::EmulateTBZ(), lldb_private::EmulateInstructionARM::EmulateUXTB(), lldb_private::EmulateInstructionARM::EmulateUXTH(), lldb_private::EmulateInstructionARM::EmulateVLD1Single(), lldb_private::EmulateInstructionARM::EmulateVPUSH(), lldb_private::EmulateInstructionARM::EmulateVST1Multiple(), lldb_private::EmulateInstructionARM::EmulateVST1Single(), lldb_private::EmulateInstructionARM::EmulateVSTM(), lldb_private::EmulateInstructionARM::EmulateVSTR(), lldb_private::EmulateInstructionARM::EvaluateInstruction(), EmulateInstructionARM64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), lldb_private::EmulateInstructionPPC64::EvaluateInstruction(), lldb_private::EmulateInstructionRISCV::GetRoundingMode(), lldb_private::EmulateInstructionARM::ReadCoreReg(), lldb_private::EmulateInstructionARM::ReadInstruction(), EmulateInstructionARM64::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), lldb_private::EmulateInstructionRISCV::ReadPC(), lldb_private::EmulateInstructionLoongArch::ReadPC(), lldb_private::EmulateInstructionRISCV::SetAccruedExceptions(), and lldb_private::EmulateInstructionARM::WriteBits32Unknown().
uint64_t EmulateInstruction::ReadRegisterUnsigned | ( | lldb::RegisterKind | reg_kind, |
uint32_t | reg_num, | ||
uint64_t | fail_value, | ||
bool * | success_ptr | ||
) |
Definition at line 101 of file EmulateInstruction.cpp.
References lldb_private::RegisterValue::GetAsUInt64(), and ReadRegister().
void EmulateInstruction::SetBaton | ( | void * | baton | ) |
Definition at line 220 of file EmulateInstruction.cpp.
References m_baton.
Referenced by lldb_private::EmulateInstructionARM::TestEmulation().
void EmulateInstruction::SetCallbacks | ( | ReadMemoryCallback | read_mem_callback, |
WriteMemoryCallback | write_mem_callback, | ||
ReadRegisterCallback | read_reg_callback, | ||
WriteRegisterCallback | write_reg_callback | ||
) |
Definition at line 222 of file EmulateInstruction.cpp.
References m_read_mem_callback, m_read_reg_callback, m_write_mem_callback, and m_write_reg_callback.
Referenced by lldb_private::EmulateInstructionARM::TestEmulation().
|
virtual |
Reimplemented in EmulateInstructionMIPS, and lldb_private::EmulateInstructionARM.
Definition at line 530 of file EmulateInstruction.cpp.
References lldb_private::Address::GetFileAddress(), lldb_private::Address::GetLoadAddress(), lldb_private::Address::IsValid(), LLDB_INVALID_ADDRESS, m_addr, and m_opcode.
Referenced by EmulateInstructionMIPS::SetInstruction(), and lldb_private::EmulateInstructionARM::SetInstruction().
void EmulateInstruction::SetReadMemCallback | ( | ReadMemoryCallback | read_mem_callback | ) |
Definition at line 233 of file EmulateInstruction.cpp.
References m_read_mem_callback.
void EmulateInstruction::SetReadRegCallback | ( | ReadRegisterCallback | read_reg_callback | ) |
Definition at line 243 of file EmulateInstruction.cpp.
References m_read_reg_callback.
|
pure virtual |
void EmulateInstruction::SetWriteMemCallback | ( | WriteMemoryCallback | write_mem_callback | ) |
Definition at line 238 of file EmulateInstruction.cpp.
References m_write_mem_callback.
void EmulateInstruction::SetWriteRegCallback | ( | WriteRegisterCallback | write_reg_callback | ) |
Definition at line 248 of file EmulateInstruction.cpp.
References m_write_reg_callback.
|
pure virtual |
|
pure virtual |
|
static |
bool EmulateInstruction::WriteMemory | ( | const Context & | context, |
lldb::addr_t | addr, | ||
const void * | src, | ||
size_t | src_len | ||
) |
Definition at line 212 of file EmulateInstruction.cpp.
References m_baton, and m_write_mem_callback.
Referenced by EmulateInstructionMIPS64::Emulate_SD(), EmulateInstructionMIPS::Emulate_SW(), EmulateInstructionMIPS::Emulate_SWM16_32(), EmulateInstructionMIPS::Emulate_SWSP(), EmulateInstructionARM64::EmulateLDPSTP(), EmulateInstructionARM64::EmulateLDRSTRImm(), and lldb_private::EmulateInstructionPPC64::EmulateSTD().
|
static |
Definition at line 329 of file EmulateInstruction.cpp.
References lldb_private::EmulateInstruction::Context::Dump(), lldb_private::Stream::EOL(), and lldb_private::Stream::Printf().
|
static |
Definition at line 274 of file EmulateInstruction.cpp.
References lldb_private::StackFrame::CalculateProcess(), and error().
Referenced by lldb::SBInstruction::EmulateWithFrame().
bool EmulateInstruction::WriteMemoryUnsigned | ( | const Context & | context, |
lldb::addr_t | addr, | ||
uint64_t | uval, | ||
size_t | uval_byte_size | ||
) |
Definition at line 201 of file EmulateInstruction.cpp.
References lldb_private::Stream::eBinary, GetAddressByteSize(), GetByteOrder(), lldb_private::StreamString::GetString(), m_baton, m_write_mem_callback, and lldb_private::Stream::PutMaxHex64().
Referenced by lldb_private::EmulateInstructionARM::MemAWrite(), lldb_private::EmulateInstructionARM::MemUWrite(), and lldb_private::EmulateInstructionRISCV::WriteMem().
bool EmulateInstruction::WriteRegister | ( | const Context & | context, |
const RegisterInfo & | ref_info, | ||
const RegisterValue & | reg_value | ||
) |
Definition at line 126 of file EmulateInstruction.cpp.
References m_baton, and m_write_reg_callback.
Referenced by EmulateInstructionMIPS64::Emulate_LD(), EmulateInstructionMIPS::Emulate_LW(), EmulateInstructionMIPS::Emulate_LWM16_32(), EmulateInstructionMIPS::Emulate_LWSP(), EmulateInstructionARM64::EmulateLDPSTP(), EmulateInstructionARM64::EmulateLDRSTRImm(), lldb_private::Rd::Write(), lldb_private::Rd::WriteAPFloat(), WriteRegister(), and WriteRegisterUnsigned().
bool EmulateInstruction::WriteRegister | ( | const Context & | context, |
lldb::RegisterKind | reg_kind, | ||
uint32_t | reg_num, | ||
const RegisterValue & | reg_value | ||
) |
Definition at line 134 of file EmulateInstruction.cpp.
References GetRegisterInfo(), and WriteRegister().
|
static |
Definition at line 359 of file EmulateInstruction.cpp.
References lldb_private::EmulateInstruction::Context::Dump(), lldb_private::DumpRegisterValue(), lldb::eFormatDefault, lldb_private::Stream::EOL(), lldb_private::RegisterInfo::name, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
|
static |
Definition at line 303 of file EmulateInstruction.cpp.
References lldb_private::StackFrame::GetRegisterContext().
Referenced by lldb::SBInstruction::EmulateWithFrame().
bool EmulateInstruction::WriteRegisterUnsigned | ( | const Context & | context, |
const RegisterInfo & | reg_info, | ||
uint64_t | reg_value | ||
) |
Definition at line 157 of file EmulateInstruction.cpp.
References lldb_private::RegisterInfo::byte_size, lldb_private::RegisterValue::SetUInt(), and WriteRegister().
Referenced by EmulateInstructionARM64::BranchTo(), lldb_private::EmulateInstructionARM::BranchWritePC(), lldb_private::EmulateInstructionARM::BXWritePC(), EmulateInstructionMIPS::Emulate_3D_branch(), EmulateInstructionMIPS64::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_ADDiu(), EmulateInstructionMIPS::Emulate_ADDIUS5(), EmulateInstructionMIPS::Emulate_ADDIUSP(), EmulateInstructionMIPS::Emulate_B16_MM(), EmulateInstructionMIPS::Emulate_BAL(), EmulateInstructionMIPS64::Emulate_BAL(), EmulateInstructionMIPS::Emulate_BALC(), EmulateInstructionMIPS64::Emulate_BALC(), EmulateInstructionMIPS::Emulate_BC(), EmulateInstructionMIPS64::Emulate_BC(), EmulateInstructionMIPS::Emulate_BC1EQZ(), EmulateInstructionMIPS64::Emulate_BC1EQZ(), EmulateInstructionMIPS::Emulate_BC1NEZ(), EmulateInstructionMIPS64::Emulate_BC1NEZ(), EmulateInstructionMIPS::Emulate_Bcond_Link(), EmulateInstructionMIPS64::Emulate_Bcond_Link(), EmulateInstructionMIPS::Emulate_Bcond_Link_C(), EmulateInstructionMIPS64::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Branch_MM(), EmulateInstructionMIPS::Emulate_BXX_2ops(), EmulateInstructionMIPS64::Emulate_BXX_2ops(), EmulateInstructionMIPS::Emulate_BXX_2ops_C(), EmulateInstructionMIPS64::Emulate_BXX_2ops_C(), EmulateInstructionMIPS::Emulate_BXX_3ops(), EmulateInstructionMIPS64::Emulate_BXX_3ops(), EmulateInstructionMIPS::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_DADDiu(), EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(), EmulateInstructionMIPS::Emulate_FP_branch(), EmulateInstructionMIPS64::Emulate_FP_branch(), EmulateInstructionMIPS::Emulate_J(), EmulateInstructionMIPS64::Emulate_J(), EmulateInstructionMIPS::Emulate_JAL(), EmulateInstructionMIPS64::Emulate_JAL(), EmulateInstructionMIPS::Emulate_JALR(), EmulateInstructionMIPS64::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALRS(), EmulateInstructionMIPS::Emulate_JALRx16_MM(), EmulateInstructionMIPS::Emulate_JALx(), EmulateInstructionMIPS::Emulate_JIALC(), EmulateInstructionMIPS64::Emulate_JIALC(), EmulateInstructionMIPS::Emulate_JIC(), EmulateInstructionMIPS64::Emulate_JIC(), EmulateInstructionMIPS::Emulate_JR(), EmulateInstructionMIPS64::Emulate_JR(), EmulateInstructionMIPS::Emulate_JRADDIUSP(), EmulateInstructionMIPS64::Emulate_LD(), EmulateInstructionMIPS::Emulate_LDST_Imm(), EmulateInstructionMIPS64::Emulate_LDST_Imm(), EmulateInstructionMIPS::Emulate_LDST_Reg(), EmulateInstructionMIPS64::Emulate_LDST_Reg(), EmulateInstructionMIPS::Emulate_LUI(), EmulateInstructionMIPS64::Emulate_LUI(), EmulateInstructionMIPS::Emulate_LW(), EmulateInstructionMIPS::Emulate_LWSP(), EmulateInstructionMIPS::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_MSA_Branch_V(), EmulateInstructionMIPS64::Emulate_SD(), EmulateInstructionMIPS::Emulate_SUBU_ADDU(), EmulateInstructionMIPS::Emulate_SW(), EmulateInstructionMIPS::Emulate_SWSP(), lldb_private::EmulateInstructionPPC64::EmulateADDI(), lldb_private::EmulateInstructionARM::EmulateADDRdSPImm(), lldb_private::EmulateInstructionARM::EmulateADDRegShift(), lldb_private::EmulateInstructionARM::EmulateADDSPRm(), EmulateInstructionARM64::EmulateADDSUBImm(), EmulateInstructionARM64::EmulateB(), lldb_private::EmulateInstructionLoongArch::EmulateBL64(), lldb_private::EmulateInstructionARM::EmulateBLXImmediate(), lldb_private::EmulateInstructionARM::EmulateBLXRm(), lldb_private::EmulateInstructionLoongArch::EmulateJIRL64(), lldb_private::EmulateInstructionPPC64::EmulateLD(), lldb_private::EmulateInstructionARM::EmulateLDM(), lldb_private::EmulateInstructionARM::EmulateLDMDA(), lldb_private::EmulateInstructionARM::EmulateLDMDB(), lldb_private::EmulateInstructionARM::EmulateLDMIB(), EmulateInstructionARM64::EmulateLDPSTP(), lldb_private::EmulateInstructionARM::EmulateLDRBImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRBLiteral(), lldb_private::EmulateInstructionARM::EmulateLDRBRegister(), lldb_private::EmulateInstructionARM::EmulateLDRDImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRDRegister(), lldb_private::EmulateInstructionARM::EmulateLDRHImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRHLiteral(), lldb_private::EmulateInstructionARM::EmulateLDRHRegister(), lldb_private::EmulateInstructionARM::EmulateLDRImmediateARM(), lldb_private::EmulateInstructionARM::EmulateLDRRegister(), lldb_private::EmulateInstructionARM::EmulateLDRRtPCRelative(), lldb_private::EmulateInstructionARM::EmulateLDRRtRnImm(), lldb_private::EmulateInstructionARM::EmulateLDRSBImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRSBLiteral(), lldb_private::EmulateInstructionARM::EmulateLDRSBRegister(), lldb_private::EmulateInstructionARM::EmulateLDRSHImmediate(), lldb_private::EmulateInstructionARM::EmulateLDRSHLiteral(), lldb_private::EmulateInstructionARM::EmulateLDRSHRegister(), EmulateInstructionARM64::EmulateLDRSTRImm(), lldb_private::EmulateInstructionPPC64::EmulateMFSPR(), lldb_private::EmulateInstructionARM::EmulateMOVRdSP(), lldb_private::EmulateInstructionARM::EmulateMUL(), lldb_private::EmulateInstructionPPC64::EmulateOR(), lldb_private::EmulateInstructionARM::EmulatePOP(), lldb_private::EmulateInstructionARM::EmulatePUSH(), lldb_private::EmulateInstructionARM::EmulateRFE(), lldb_private::EmulateInstructionPPC64::EmulateSTD(), lldb_private::EmulateInstructionARM::EmulateSTM(), lldb_private::EmulateInstructionARM::EmulateSTMDA(), lldb_private::EmulateInstructionARM::EmulateSTMDB(), lldb_private::EmulateInstructionARM::EmulateSTMIB(), lldb_private::EmulateInstructionARM::EmulateSTRBImmARM(), lldb_private::EmulateInstructionARM::EmulateSTRBThumb(), lldb_private::EmulateInstructionARM::EmulateSTRDImm(), lldb_private::EmulateInstructionARM::EmulateSTRDReg(), lldb_private::EmulateInstructionARM::EmulateSTREX(), lldb_private::EmulateInstructionARM::EmulateSTRHRegister(), lldb_private::EmulateInstructionARM::EmulateSTRImmARM(), lldb_private::EmulateInstructionARM::EmulateSTRRegister(), lldb_private::EmulateInstructionARM::EmulateSTRRtSP(), lldb_private::EmulateInstructionARM::EmulateSTRThumb(), lldb_private::EmulateInstructionARM::EmulateSUBIPSPImm(), lldb_private::EmulateInstructionARM::EmulateSUBR7IPImm(), lldb_private::EmulateInstructionARM::EmulateSVC(), lldb_private::EmulateInstructionARM::EmulateSXTB(), lldb_private::EmulateInstructionARM::EmulateSXTH(), lldb_private::EmulateInstructionARM::EmulateUXTB(), lldb_private::EmulateInstructionARM::EmulateUXTH(), lldb_private::EmulateInstructionARM::EmulateVLD1Multiple(), lldb_private::EmulateInstructionARM::EmulateVLD1Single(), lldb_private::EmulateInstructionARM::EmulateVLD1SingleAll(), lldb_private::EmulateInstructionARM::EmulateVLDM(), lldb_private::EmulateInstructionARM::EmulateVLDR(), lldb_private::EmulateInstructionARM::EmulateVPOP(), lldb_private::EmulateInstructionARM::EmulateVPUSH(), lldb_private::EmulateInstructionARM::EmulateVST1Multiple(), lldb_private::EmulateInstructionARM::EmulateVST1Single(), lldb_private::EmulateInstructionARM::EmulateVSTM(), lldb_private::EmulateInstructionARM::EvaluateInstruction(), EmulateInstructionARM64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), lldb_private::EmulateInstructionPPC64::EvaluateInstruction(), lldb_private::EmulateInstructionRISCV::SetAccruedExceptions(), lldb_private::EmulateInstructionARM::WriteBits32Unknown(), lldb_private::EmulateInstructionARM::WriteCoreRegOptionalFlags(), lldb_private::EmulateInstructionARM::WriteFlags(), lldb_private::EmulateInstructionLoongArch::WritePC(), and lldb_private::EmulateInstructionRISCV::WritePC().
bool EmulateInstruction::WriteRegisterUnsigned | ( | const Context & | context, |
lldb::RegisterKind | reg_kind, | ||
uint32_t | reg_num, | ||
uint64_t | reg_value | ||
) |
Definition at line 144 of file EmulateInstruction.cpp.
References GetRegisterInfo(), lldb_private::RegisterValue::SetUInt(), and WriteRegister().
|
protected |
Definition at line 507 of file EmulateInstruction.h.
Referenced by lldb_private::EmulateInstructionRISCV::Decode(), lldb_private::EmulateInstructionPPC64::EmulateADDI(), lldb_private::EmulateInstructionPPC64::EmulateLD(), lldb_private::EmulateInstructionPPC64::EmulateMFSPR(), lldb_private::EmulateInstructionPPC64::EmulateOR(), lldb_private::EmulateInstructionPPC64::EmulateSTD(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), GetAddress(), lldb_private::EmulateInstructionARM::ReadInstruction(), EmulateInstructionARM64::ReadInstruction(), lldb_private::EmulateInstructionLoongArch::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), lldb_private::EmulateInstructionRISCV::ReadInstruction(), EmulateInstructionMIPS::SetInstruction(), and SetInstruction().
|
protected |
Definition at line 501 of file EmulateInstruction.h.
Referenced by lldb_private::EmulateInstructionRISCV::Decode(), GetAddressByteSize(), GetArchitecture(), GetByteOrder(), lldb_private::EmulateInstructionARM::GetFramePointerDWARFRegisterNumber(), lldb_private::EmulateInstructionARM::GetFramePointerRegisterNumber(), EmulateInstructionARM64::GetFramePointerRegisterNumber(), lldb_private::EmulateInstructionLoongArch::GetRegisterInfo(), lldb_private::EmulateInstructionRISCV::GetRegisterInfo(), lldb_private::EmulateInstructionARM::ReadInstruction(), lldb_private::EmulateInstructionARM::SetArchitecture(), and lldb_private::EmulateInstructionARM::SetInstruction().
|
protected |
Definition at line 502 of file EmulateInstruction.h.
Referenced by ReadMemory(), ReadMemoryUnsigned(), ReadRegister(), SetBaton(), WriteMemory(), WriteMemoryUnsigned(), and WriteRegister().
|
protected |
Definition at line 508 of file EmulateInstruction.h.
Referenced by lldb_private::EmulateInstructionARM::CurrentCond(), lldb_private::EmulateInstructionARM::EvaluateInstruction(), EmulateInstructionARM64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), lldb_private::EmulateInstructionPPC64::EvaluateInstruction(), lldb_private::EmulateInstructionLoongArch::EvaluateInstruction(), lldb_private::EmulateInstructionARM::GetInstructionCondition(), GetOpcode(), lldb_private::EmulateInstructionARM::ReadInstruction(), EmulateInstructionARM64::ReadInstruction(), lldb_private::EmulateInstructionLoongArch::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), lldb_private::EmulateInstructionRISCV::ReadInstruction(), SetInstruction(), and lldb_private::EmulateInstructionARM::TestEmulation().
|
protected |
Definition at line 503 of file EmulateInstruction.h.
Referenced by ReadMemory(), ReadMemoryUnsigned(), SetCallbacks(), and SetReadMemCallback().
|
protected |
Definition at line 505 of file EmulateInstruction.h.
Referenced by ReadRegister(), SetCallbacks(), and SetReadRegCallback().
|
protected |
Definition at line 504 of file EmulateInstruction.h.
Referenced by SetCallbacks(), SetWriteMemCallback(), WriteMemory(), and WriteMemoryUnsigned().
|
protected |
Definition at line 506 of file EmulateInstruction.h.
Referenced by SetCallbacks(), SetWriteRegCallback(), and WriteRegister().
|
static |
Definition at line 358 of file EmulateInstruction.h.
Referenced by GetInstructionCondition(), lldb_private::EmulateInstructionARM::GetInstructionCondition(), and UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly().