LLDB mainline
|
#include <EmulateInstructionRISCV.h>
Public Member Functions | |
EmulateInstructionRISCV (const ArchSpec &arch) | |
llvm::StringRef | GetPluginName () override |
bool | SupportsEmulatingInstructionsOfType (InstructionType inst_type) override |
bool | SetTargetTriple (const ArchSpec &arch) override |
bool | ReadInstruction () override |
std::optional< uint32_t > | GetLastInstrSize () 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 |
std::optional< lldb::addr_t > | ReadPC () |
bool | WritePC (lldb::addr_t pc) |
std::optional< DecodeResult > | ReadInstructionAt (lldb::addr_t addr) |
std::optional< DecodeResult > | Decode (uint32_t inst) |
bool | Execute (DecodeResult inst, bool ignore_cond) |
template<typename T > | |
std::enable_if_t< std::is_integral_v< T >, std::optional< T > > | ReadMem (uint64_t addr) |
template<typename T > | |
bool | WriteMem (uint64_t addr, uint64_t value) |
llvm::RoundingMode | GetRoundingMode () |
bool | SetAccruedExceptions (llvm::APFloatBase::opStatus) |
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 Attributes | |
DecodeResult | m_decoded |
Last decoded instruction from m_opcode. | |
std::optional< uint32_t > | m_last_size |
Last decoded instruction size estimate. | |
Definition at line 23 of file EmulateInstructionRISCV.h.
|
inline |
Definition at line 53 of file EmulateInstructionRISCV.h.
|
static |
Definition at line 1781 of file EmulateInstructionRISCV.cpp.
References SupportsThisArch(), and SupportsThisInstructionType().
Referenced by Initialize(), and Terminate().
std::optional< DecodeResult > lldb_private::EmulateInstructionRISCV::Decode | ( | uint32_t | inst | ) |
Definition at line 621 of file EmulateInstructionRISCV.cpp.
References lldb_private::ArchSpec::eCore_riscv32, lldb_private::ArchSpec::GetCore(), lldb_private::GetLog(), LLDB_LOGF, lldb_private::EmulateInstruction::m_addr, lldb_private::EmulateInstruction::m_arch, m_last_size, lldb_private::PATTERNS, lldb_private::RV32, lldb_private::RV64, and lldb_private::Unwind.
Referenced by ReadInstructionAt().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 1605 of file EmulateInstructionRISCV.cpp.
References Execute(), lldb_private::DecodeResult::is_rvc, m_decoded, ReadPC(), lldb_private::Executor::size(), and WritePC().
bool lldb_private::EmulateInstructionRISCV::Execute | ( | DecodeResult | inst, |
bool | ignore_cond | ||
) |
Definition at line 1601 of file EmulateInstructionRISCV.cpp.
References lldb_private::DecodeResult::decoded, and lldb_private::DecodeResult::is_rvc.
Referenced by EvaluateInstruction().
|
inlineoverridevirtual |
Reimplemented from lldb_private::EmulateInstruction.
Definition at line 63 of file EmulateInstructionRISCV.h.
References m_last_size.
|
inlinestatic |
Definition at line 27 of file EmulateInstructionRISCV.h.
Referenced by Initialize().
|
inlineoverridevirtual |
Implements lldb_private::PluginInterface.
Definition at line 55 of file EmulateInstructionRISCV.h.
References GetPluginNameStatic().
|
inlinestatic |
Definition at line 25 of file EmulateInstructionRISCV.h.
Referenced by GetPluginName(), and Initialize().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 1724 of file EmulateInstructionRISCV.cpp.
References lldb::eRegisterKindGeneric, lldb::eRegisterKindLLDB, RegisterInfoPOSIX_riscv64::GetRegisterInfoCount(), RegisterInfoPOSIX_riscv64::GetRegisterInfoPtr(), gpr_fp_riscv, gpr_pc_riscv, gpr_ra_riscv, gpr_sp_riscv, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_RA, LLDB_REGNUM_GENERIC_SP, and lldb_private::EmulateInstruction::m_arch.
RoundingMode lldb_private::EmulateInstructionRISCV::GetRoundingMode | ( | ) |
Definition at line 1667 of file EmulateInstructionRISCV.cpp.
References lldb::eRegisterKindLLDB, fpr_fcsr_riscv, LLDB_INVALID_ADDRESS, and lldb_private::EmulateInstruction::ReadRegisterUnsigned().
Referenced by lldb_private::Executor::FusedMultiplyAdd().
|
static |
Definition at line 1771 of file EmulateInstructionRISCV.cpp.
References CreateInstance(), GetPluginDescriptionStatic(), GetPluginNameStatic(), and lldb_private::PluginManager::RegisterPlugin().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 1636 of file EmulateInstructionRISCV.cpp.
References lldb_private::EmulateInstruction::GetByteOrder(), LLDB_INVALID_ADDRESS, lldb_private::EmulateInstruction::m_addr, m_decoded, lldb_private::EmulateInstruction::m_opcode, ReadInstructionAt(), ReadPC(), lldb_private::Opcode::SetOpcode16(), and lldb_private::Opcode::SetOpcode32().
std::optional< DecodeResult > lldb_private::EmulateInstructionRISCV::ReadInstructionAt | ( | lldb::addr_t | addr | ) |
Definition at line 1630 of file EmulateInstructionRISCV.cpp.
References Decode().
Referenced by lldb_private::AtomicSequence(), and ReadInstruction().
|
inline |
Definition at line 79 of file EmulateInstructionRISCV.h.
References lldb_private::EmulateInstruction::eContextRegisterLoad, lldb_private::EmulateInstruction::ReadMemoryUnsigned(), lldb_private::EmulateInstruction::Context::SetNoArgs(), and lldb_private::EmulateInstruction::Context::type.
Referenced by lldb_private::AtomicADD(), lldb_private::AtomicBitOperate(), lldb_private::AtomicCmp(), lldb_private::AtomicSwap(), and lldb_private::Load().
std::optional< addr_t > lldb_private::EmulateInstructionRISCV::ReadPC | ( | ) |
Definition at line 1652 of file EmulateInstructionRISCV.cpp.
References lldb::eRegisterKindGeneric, LLDB_INVALID_ADDRESS, LLDB_REGNUM_GENERIC_PC, and lldb_private::EmulateInstruction::ReadRegisterUnsigned().
Referenced by lldb_private::AtomicSequence(), EvaluateInstruction(), lldb_private::Executor::operator()(), and ReadInstruction().
bool lldb_private::EmulateInstructionRISCV::SetAccruedExceptions | ( | llvm::APFloatBase::opStatus | ) |
Definition at line 1691 of file EmulateInstructionRISCV.cpp.
References lldb_private::EmulateInstruction::eContextRegisterStore, lldb::eRegisterKindLLDB, fpr_fcsr_riscv, LLDB_INVALID_ADDRESS, lldb_private::EmulateInstruction::ReadRegisterUnsigned(), lldb_private::EmulateInstruction::Context::SetNoArgs(), lldb_private::EmulateInstruction::Context::type, and lldb_private::EmulateInstruction::WriteRegisterUnsigned().
Referenced by lldb_private::Executor::FusedMultiplyAdd().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 1762 of file EmulateInstructionRISCV.cpp.
References SupportsThisArch().
|
inlineoverridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 57 of file EmulateInstructionRISCV.h.
References SupportsThisInstructionType().
|
static |
Definition at line 1791 of file EmulateInstructionRISCV.cpp.
References lldb_private::ArchSpec::GetTriple().
Referenced by CreateInstance(), and SetTargetTriple().
|
inlinestatic |
Definition at line 31 of file EmulateInstructionRISCV.h.
References lldb_private::eInstructionTypeAll, lldb_private::eInstructionTypeAny, lldb_private::eInstructionTypePCModifying, and lldb_private::eInstructionTypePrologueEpilogue.
Referenced by CreateInstance(), and SupportsEmulatingInstructionsOfType().
|
static |
Definition at line 1776 of file EmulateInstructionRISCV.cpp.
References CreateInstance(), and lldb_private::PluginManager::UnregisterPlugin().
|
overridevirtual |
Implements lldb_private::EmulateInstruction.
Definition at line 1766 of file EmulateInstructionRISCV.cpp.
|
inline |
bool lldb_private::EmulateInstructionRISCV::WritePC | ( | lldb::addr_t | pc | ) |
Definition at line 1659 of file EmulateInstructionRISCV.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 lldb_private::AtomicSequence(), and EvaluateInstruction().
|
private |
Last decoded instruction from m_opcode.
Definition at line 102 of file EmulateInstructionRISCV.h.
Referenced by EvaluateInstruction(), and ReadInstruction().
|
private |
Last decoded instruction size estimate.
Definition at line 104 of file EmulateInstructionRISCV.h.
Referenced by Decode(), and GetLastInstrSize().