9#ifndef LLDB_CORE_EMULATEINSTRUCTION_H
10#define LLDB_CORE_EMULATEINSTRUCTION_H
29class OptionValueDictionary;
98 const char *plugin_name);
197 } RegisterPlusOffset;
202 } RegisterPlusIndirectOffset;
208 } RegisterToRegisterPlusOffset;
214 } RegisterToRegisterPlusIndirectOffset;
221 } RegisterRegisterOperands;
241 } ISAAndImmediateSigned;
245 static_assert(std::is_trivial<ContextInfo>::value,
246 "ContextInfo must be trivial.");
335 void *baton,
const Context &context,
340 void *baton,
const Context &context,
350 void *baton,
const Context &context,
383 virtual std::optional<RegisterInfo>
393 uint32_t reg_num, std::string ®_name);
399 uint64_t fail_value,
bool *success_ptr);
415 uint64_t fail_value,
bool *success_ptr);
425 size_t byte_size, uint64_t fail_value,
432 uint64_t uval,
size_t uval_byte_size);
446 void *dst,
size_t length);
450 const void *dst,
size_t length);
457 const Context &context,
463 void *dst,
size_t length);
467 const void *dst,
size_t length);
474 const Context &context,
A section + offset based address class.
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes.
static bool GetBestRegisterKindAndNumber(const RegisterInfo *reg_info, lldb::RegisterKind ®_kind, uint32_t ®_num)
static bool WriteRegisterDefault(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
static size_t WriteMemoryFrame(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
const EmulateInstruction & operator=(const EmulateInstruction &)=delete
@ eContextRelativeBranchImmediate
@ eContextSetFramePointer
@ eContextAdjustBaseRegister
@ eContextWriteMemoryRandomBits
@ eContextTableBranchReadMemory
@ eContextWriteRegisterRandomBits
@ eContextAdjustStackPointer
@ eContextRestoreStackPointer
@ eContextReturnFromException
@ eContextPushRegisterOnStack
@ eContextPopRegisterOffStack
@ eContextAbsoluteBranchRegister
@ eContextRegisterPlusOffset
@ eInfoTypeRegisterPlusOffset
@ eInfoTypeRegisterRegisterOperands
@ eInfoTypeImmediateSigned
@ eInfoTypeISAAndImmediate
@ eInfoTypeRegisterToRegisterPlusOffset
@ eInfoTypeRegisterToRegisterPlusIndirectOffset
@ eInfoTypeRegisterPlusIndirectOffset
@ eInfoTypeISAAndImmediateSigned
WriteMemoryCallback m_write_mem_callback
lldb::ByteOrder GetByteOrder() const
void SetWriteRegCallback(WriteRegisterCallback write_reg_callback)
virtual bool TestEmulation(Stream &out_stream, ArchSpec &arch, OptionValueDictionary *test_data)=0
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
lldb::addr_t GetAddress() const
void SetCallbacks(ReadMemoryCallback read_mem_callback, WriteMemoryCallback write_mem_callback, ReadRegisterCallback read_reg_callback, WriteRegisterCallback write_reg_callback)
static bool ReadRegisterDefault(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
virtual bool CreateFunctionEntryUnwind(UnwindPlan &unwind_plan)
const ArchSpec & GetArchitecture() const
EmulateInstruction(const EmulateInstruction &)=delete
bool WriteMemoryUnsigned(const Context &context, lldb::addr_t addr, uint64_t uval, size_t uval_byte_size)
~EmulateInstruction() override=default
virtual bool SupportsEmulatingInstructionsOfType(InstructionType inst_type)=0
const Opcode & GetOpcode() const
virtual InstructionCondition GetInstructionCondition()
virtual bool EvaluateInstruction(uint32_t evaluate_options)=0
static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx, const RegisterInfo ®_info)
void SetReadRegCallback(ReadRegisterCallback read_reg_callback)
static const InstructionCondition UnconditionalCondition
size_t ReadMemory(const Context &context, lldb::addr_t addr, void *dst, size_t dst_len)
std::optional< RegisterValue > ReadRegister(const RegisterInfo ®_info)
ReadRegisterCallback m_read_reg_callback
size_t(* WriteMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
static size_t ReadMemoryFrame(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
bool WriteRegister(const Context &context, const RegisterInfo &ref_info, const RegisterValue ®_value)
bool WriteRegisterUnsigned(const Context &context, const RegisterInfo ®_info, uint64_t reg_value)
virtual bool SetTargetTriple(const ArchSpec &arch)=0
bool WriteMemory(const Context &context, lldb::addr_t addr, const void *src, size_t src_len)
virtual std::optional< uint32_t > GetLastInstrSize()
uint64_t ReadMemoryUnsigned(const Context &context, lldb::addr_t addr, size_t byte_size, uint64_t fail_value, bool *success_ptr)
WriteRegisterCallback m_write_reg_callback
static size_t WriteMemoryDefault(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
size_t(* ReadMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
void SetReadMemCallback(ReadMemoryCallback read_mem_callback)
static bool WriteRegisterFrame(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
uint32_t GetAddressByteSize() const
static const char * TranslateRegister(lldb::RegisterKind reg_kind, uint32_t reg_num, std::string ®_name)
ReadMemoryCallback m_read_mem_callback
static bool ReadRegisterFrame(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
bool(* ReadRegisterCallback)(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
virtual std::optional< RegisterInfo > GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num)=0
void SetBaton(void *baton)
static size_t ReadMemoryDefault(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
virtual bool SetInstruction(const Opcode &insn_opcode, const Address &inst_addr, Target *target)
static EmulateInstruction * FindPlugin(const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name)
virtual bool ReadInstruction()=0
uint64_t ReadRegisterUnsigned(const RegisterInfo ®_info, uint64_t fail_value, bool *success_ptr)
uint32_t InstructionCondition
void SetWriteMemCallback(WriteMemoryCallback write_mem_callback)
A stream class that can stream formatted output to a file.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
InstructionType
Instruction types.
ByteOrder
Byte ordering definitions.
RegisterKind
Register numbering types.
void SetISA(uint32_t isa)
void SetRegisterRegisterOperands(RegisterInfo op1_reg, RegisterInfo op2_reg)
void Dump(Stream &s, EmulateInstruction *instruction) const
void SetISAAndImmediate(uint32_t isa, uint32_t data)
void SetImmediate(uint64_t immediate)
void SetISAAndImmediateSigned(uint32_t isa, int32_t data)
void SetRegisterPlusOffset(RegisterInfo base_reg, int64_t signed_offset)
union lldb_private::EmulateInstruction::Context::ContextInfo info
enum InfoType GetInfoType() const
void SetImmediateSigned(int64_t signed_immediate)
void SetRegisterToRegisterPlusIndirectOffset(RegisterInfo base_reg, RegisterInfo offset_reg, RegisterInfo data_reg)
void SetOffset(int64_t signed_offset)
void SetRegisterToRegisterPlusOffset(RegisterInfo data_reg, RegisterInfo base_reg, int64_t offset)
void SetAddress(lldb::addr_t address)
void SetRegister(RegisterInfo reg)
void SetRegisterPlusIndirectOffset(RegisterInfo base_reg, RegisterInfo offset_reg)
Every register is described in detail including its name, alternate name (optional),...
struct lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediateSigned ISAAndImmediateSigned
struct lldb_private::EmulateInstruction::Context::ContextInfo::RegisterRegisterOperands RegisterRegisterOperands
struct lldb_private::EmulateInstruction::Context::ContextInfo::RegisterPlusOffset RegisterPlusOffset
struct lldb_private::EmulateInstruction::Context::ContextInfo::RegisterPlusIndirectOffset RegisterPlusIndirectOffset
uint64_t unsigned_immediate
struct lldb_private::EmulateInstruction::Context::ContextInfo::RegisterToRegisterPlusIndirectOffset RegisterToRegisterPlusIndirectOffset
struct lldb_private::EmulateInstruction::Context::ContextInfo::RegisterToRegisterPlusOffset RegisterToRegisterPlusOffset
struct lldb_private::EmulateInstruction::Context::ContextInfo::ISAAndImmediate ISAAndImmediate