LLDB mainline
|
#include <EmulateInstructionLoongArch.h>
Classes | |
struct | Opcode |
Public Member Functions | |
EmulateInstructionLoongArch (const ArchSpec &arch) | |
llvm::StringRef | GetPluginName () override |
bool | SupportsEmulatingInstructionsOfType (InstructionType inst_type) override |
bool | SetTargetTriple (const ArchSpec &arch) override |
bool | ReadInstruction () override |
bool | EvaluateInstruction (uint32_t options) override |
bool | TestEmulation (Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data) override |
std::optional< RegisterInfo > | GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num) override |
lldb::addr_t | ReadPC (bool *success) |
bool | WritePC (lldb::addr_t pc) |
bool | IsLoongArch64 () |
bool | TestExecute (uint32_t inst) |
Public Member Functions inherited from lldb_private::EmulateInstruction | |
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 llvm::StringRef | GetPluginNameStatic () |
static llvm::StringRef | GetPluginDescriptionStatic () |
static bool | SupportsThisInstructionType (InstructionType inst_type) |
static bool | SupportsThisArch (const ArchSpec &arch) |
static lldb_private::EmulateInstruction * | CreateInstance (const lldb_private::ArchSpec &arch, InstructionType inst_type) |
static void | Initialize () |
static void | Terminate () |
Static Public Member Functions inherited from lldb_private::EmulateInstruction | |
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) |
Private Member Functions | |
Opcode * | GetOpcodeForInstruction (uint32_t inst) |
bool | EmulateBEQZ (uint32_t inst) |
bool | EmulateBNEZ (uint32_t inst) |
bool | EmulateBCEQZ (uint32_t inst) |
bool | EmulateBCNEZ (uint32_t inst) |
bool | EmulateJIRL (uint32_t inst) |
bool | EmulateB (uint32_t inst) |
bool | EmulateBL (uint32_t inst) |
bool | EmulateBEQ (uint32_t inst) |
bool | EmulateBNE (uint32_t inst) |
bool | EmulateBLT (uint32_t inst) |
bool | EmulateBGE (uint32_t inst) |
bool | EmulateBLTU (uint32_t inst) |
bool | EmulateBGEU (uint32_t inst) |
bool | EmulateNonJMP (uint32_t inst) |
bool | EmulateBEQZ64 (uint32_t inst) |
bool | EmulateBNEZ64 (uint32_t inst) |
bool | EmulateBCEQZ64 (uint32_t inst) |
bool | EmulateBCNEZ64 (uint32_t inst) |
bool | EmulateJIRL64 (uint32_t inst) |
bool | EmulateB64 (uint32_t inst) |
bool | EmulateBL64 (uint32_t inst) |
bool | EmulateBEQ64 (uint32_t inst) |
bool | EmulateBNE64 (uint32_t inst) |
bool | EmulateBLT64 (uint32_t inst) |
bool | EmulateBGE64 (uint32_t inst) |
bool | EmulateBLTU64 (uint32_t inst) |
bool | EmulateBGEU64 (uint32_t inst) |
Private Attributes | |
llvm::Triple::ArchType | m_arch_subtype |
Definition at line 20 of file EmulateInstructionLoongArch.h.
|
inline |
Definition at line 42 of file EmulateInstructionLoongArch.h.
References lldb_private::ArchSpec::GetMachine(), and m_arch_subtype.
|
static |
Definition at line 204 of file EmulateInstructionLoongArch.cpp.
References SupportsThisArch(), and SupportsThisInstructionType().
Referenced by Initialize(), and Terminate().
|
private |
Definition at line 236 of file EmulateInstructionLoongArch.cpp.
References EmulateB64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 376 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), pc, ReadPC(), and WritePC().
Referenced by EmulateB().
|
private |
Definition at line 224 of file EmulateInstructionLoongArch.cpp.
References EmulateBCEQZ64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 313 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, fpr_fcc0_loongarch, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBCEQZ().
|
private |
Definition at line 228 of file EmulateInstructionLoongArch.cpp.
References EmulateBCNEZ64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 335 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, fpr_fcc0_loongarch, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBCNEZ().
|
private |
Definition at line 244 of file EmulateInstructionLoongArch.cpp.
References EmulateBEQ64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 405 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBEQ().
|
private |
Definition at line 216 of file EmulateInstructionLoongArch.cpp.
References EmulateBEQZ64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 273 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBEQZ().
|
private |
Definition at line 256 of file EmulateInstructionLoongArch.cpp.
References EmulateBGE64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 476 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBGE().
|
private |
Definition at line 264 of file EmulateInstructionLoongArch.cpp.
References EmulateBGEU64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 524 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBGEU().
|
private |
Definition at line 240 of file EmulateInstructionLoongArch.cpp.
References EmulateBL64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 389 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, gpr_r1_loongarch, pc, ReadPC(), WritePC(), and lldb_private::EmulateInstruction::WriteRegisterUnsigned().
Referenced by EmulateBL().
|
private |
Definition at line 252 of file EmulateInstructionLoongArch.cpp.
References EmulateBLT64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 451 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBLT().
|
private |
Definition at line 260 of file EmulateInstructionLoongArch.cpp.
References EmulateBLTU64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 501 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBLTU().
|
private |
Definition at line 248 of file EmulateInstructionLoongArch.cpp.
References EmulateBNE64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 428 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBNE().
|
private |
Definition at line 220 of file EmulateInstructionLoongArch.cpp.
References EmulateBNEZ64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 293 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), and WritePC().
Referenced by EmulateBNEZ().
|
private |
Definition at line 232 of file EmulateInstructionLoongArch.cpp.
References EmulateJIRL64(), and IsLoongArch64().
Referenced by GetOpcodeForInstruction().
|
private |
Definition at line 357 of file EmulateInstructionLoongArch.cpp.
References lldb_private::Bits32(), lldb::eRegisterKindLLDB, pc, ReadPC(), lldb_private::EmulateInstruction::ReadRegisterUnsigned(), WritePC(), and lldb_private::EmulateInstruction::WriteRegisterUnsigned().
Referenced by EmulateJIRL().
|
private |
Definition at line 268 of file EmulateInstructionLoongArch.cpp.
Referenced by GetOpcodeForInstruction().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 85 of file EmulateInstructionLoongArch.cpp.
References lldb_private::EmulateInstructionLoongArch::Opcode::callback, GetOpcodeForInstruction(), lldb_private::EmulateInstruction::m_opcode, ReadPC(), and WritePC().
|
private |
Definition at line 36 of file EmulateInstructionLoongArch.cpp.
References EmulateB(), EmulateBCEQZ(), EmulateBCNEZ(), EmulateBEQ(), EmulateBEQZ(), EmulateBGE(), EmulateBGEU(), EmulateBL(), EmulateBLT(), EmulateBLTU(), EmulateBNE(), EmulateBNEZ(), EmulateJIRL(), and EmulateNonJMP().
Referenced by EvaluateInstruction(), and TestExecute().
|
inlinestatic |
Definition at line 24 of file EmulateInstructionLoongArch.h.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 46 of file EmulateInstructionLoongArch.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 22 of file EmulateInstructionLoongArch.h.
Referenced by GetPluginName(), and Initialize().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 148 of file EmulateInstructionLoongArch.cpp.
References lldb::eRegisterKindGeneric, lldb::eRegisterKindLLDB, RegisterInfoPOSIX_loongarch64::GetRegisterInfoCount(), RegisterInfoPOSIX_loongarch64::GetRegisterInfoPtr(), gpr_fp_loongarch, gpr_pc_loongarch, gpr_ra_loongarch, gpr_sp_loongarch, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_RA, LLDB_REGNUM_GENERIC_SP, and lldb_private::EmulateInstruction::m_arch.
|
static |
Definition at line 194 of file EmulateInstructionLoongArch.cpp.
References CreateInstance(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
|
inline |
Definition at line 62 of file EmulateInstructionLoongArch.h.
References m_arch_subtype.
Referenced by EmulateB(), EmulateBCEQZ(), EmulateBCNEZ(), EmulateBEQ(), EmulateBEQZ(), EmulateBGE(), EmulateBGEU(), EmulateBL(), EmulateBLT(), EmulateBLTU(), EmulateBNE(), EmulateBNEZ(), and EmulateJIRL().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 117 of file EmulateInstructionLoongArch.cpp.
References lldb_private::EmulateInstruction::eContextReadOpcode, lldb_private::EmulateInstruction::GetByteOrder(), LLDB_INVALID_ADDRESS, lldb_private::EmulateInstruction::m_addr, lldb_private::EmulateInstruction::m_opcode, lldb_private::EmulateInstruction::ReadMemoryUnsigned(), ReadPC(), lldb_private::EmulateInstruction::Context::SetNoArgs(), and lldb_private::EmulateInstruction::Context::type.
lldb::addr_t lldb_private::EmulateInstructionLoongArch::ReadPC | ( | bool * | success | ) |
Definition at line 134 of file EmulateInstructionLoongArch.cpp.
References lldb::eRegisterKindGeneric, LLDB_INVALID_ADDRESS, LLDB_REGNUM_GENERIC_PC, and lldb_private::EmulateInstruction::ReadRegisterUnsigned().
Referenced by EmulateB64(), EmulateBCEQZ64(), EmulateBCNEZ64(), EmulateBEQ64(), EmulateBEQZ64(), EmulateBGE64(), EmulateBGEU64(), EmulateBL64(), EmulateBLT64(), EmulateBLTU64(), EmulateBNE64(), EmulateBNEZ64(), EmulateJIRL64(), EvaluateInstruction(), and ReadInstruction().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 185 of file EmulateInstructionLoongArch.cpp.
References SupportsThisArch().
|
inlineoverridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 48 of file EmulateInstructionLoongArch.h.
References SupportsThisInstructionType().
|
static |
Definition at line 212 of file EmulateInstructionLoongArch.cpp.
References lldb_private::ArchSpec::GetTriple().
Referenced by CreateInstance(), and SetTargetTriple().
|
inlinestatic |
Definition at line 28 of file EmulateInstructionLoongArch.h.
References lldb_private::eInstructionTypePCModifying.
Referenced by CreateInstance(), and SupportsEmulatingInstructionsOfType().
|
static |
Definition at line 199 of file EmulateInstructionLoongArch.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 189 of file EmulateInstructionLoongArch.cpp.
bool lldb_private::EmulateInstructionLoongArch::TestExecute | ( | uint32_t | inst | ) |
Definition at line 75 of file EmulateInstructionLoongArch.cpp.
References lldb_private::EmulateInstructionLoongArch::Opcode::callback, and GetOpcodeForInstruction().
bool lldb_private::EmulateInstructionLoongArch::WritePC | ( | lldb::addr_t | pc | ) |
Definition at line 139 of file EmulateInstructionLoongArch.cpp.
References lldb_private::EmulateInstruction::eContextAdvancePC, lldb::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc, lldb_private::EmulateInstruction::Context::SetNoArgs(), lldb_private::EmulateInstruction::Context::type, and lldb_private::EmulateInstruction::WriteRegisterUnsigned().
Referenced by EmulateB64(), EmulateBCEQZ64(), EmulateBCNEZ64(), EmulateBEQ64(), EmulateBEQZ64(), EmulateBGE64(), EmulateBGEU64(), EmulateBL64(), EmulateBLT64(), EmulateBLTU64(), EmulateBNE64(), EmulateBNEZ64(), EmulateJIRL64(), and EvaluateInstruction().
|
private |
Definition at line 73 of file EmulateInstructionLoongArch.h.
Referenced by EmulateInstructionLoongArch(), and IsLoongArch64().