LLDB mainline
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | List of all members
lldb_private::EmulateInstruction Class Referenceabstract

"lldb/Core/EmulateInstruction.h" A class that allows emulation of CPU opcodes. More...

#include <EmulateInstruction.h>

Inheritance diagram for lldb_private::EmulateInstruction:
Inheritance graph
[legend]

Classes

struct  Context
 

Public Types

enum  ContextType {
  eContextInvalid = 0 , eContextReadOpcode , eContextImmediate , eContextPushRegisterOnStack ,
  eContextPopRegisterOffStack , eContextAdjustStackPointer , eContextSetFramePointer , eContextRestoreStackPointer ,
  eContextAdjustBaseRegister , eContextAdjustPC , eContextRegisterPlusOffset , eContextRegisterStore ,
  eContextRegisterLoad , eContextRelativeBranchImmediate , eContextAbsoluteBranchRegister , eContextSupervisorCall ,
  eContextTableBranchReadMemory , eContextWriteRegisterRandomBits , eContextWriteMemoryRandomBits , eContextArithmetic ,
  eContextAdvancePC , eContextReturnFromException
}
 
enum  InfoType {
  eInfoTypeRegisterPlusOffset , eInfoTypeRegisterPlusIndirectOffset , eInfoTypeRegisterToRegisterPlusOffset , eInfoTypeRegisterToRegisterPlusIndirectOffset ,
  eInfoTypeRegisterRegisterOperands , eInfoTypeOffset , eInfoTypeRegister , eInfoTypeImmediate ,
  eInfoTypeImmediateSigned , eInfoTypeAddress , eInfoTypeISAAndImmediate , eInfoTypeISAAndImmediateSigned ,
  eInfoTypeISA , eInfoTypeNoArgs
}
 
typedef size_t(* ReadMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
 
typedef size_t(* WriteMemoryCallback) (EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
 
typedef bool(* ReadRegisterCallback) (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
 
typedef bool(* WriteRegisterCallback) (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
 
typedef uint32_t InstructionCondition
 

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 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< RegisterInfoGetRegisterInfo (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< RegisterValueReadRegister (const RegisterInfo &reg_info)
 
uint64_t ReadRegisterUnsigned (const RegisterInfo &reg_info, uint64_t fail_value, bool *success_ptr)
 
bool WriteRegister (const Context &context, const RegisterInfo &ref_info, const RegisterValue &reg_value)
 
bool WriteRegisterUnsigned (const Context &context, const RegisterInfo &reg_info, uint64_t reg_value)
 
bool ReadRegister (lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterValue &reg_value)
 
bool WriteRegister (const Context &context, lldb::RegisterKind reg_kind, uint32_t reg_num, const RegisterValue &reg_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 OpcodeGetOpcode () const
 
lldb::addr_t GetAddress () const
 
const ArchSpecGetArchitecture () 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
 
PluginInterfaceoperator= (const PluginInterface &)=delete
 

Static Public Member Functions

static EmulateInstructionFindPlugin (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 &reg_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 &reg_value)
 
static bool WriteRegisterFrame (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_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 &reg_value)
 
static bool WriteRegisterDefault (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
 
static bool GetBestRegisterKindAndNumber (const RegisterInfo *reg_info, lldb::RegisterKind &reg_kind, uint32_t &reg_num)
 
static uint32_t GetInternalRegisterNumber (RegisterContext *reg_ctx, const RegisterInfo &reg_info)
 

Static Public Attributes

static const InstructionCondition UnconditionalCondition = UINT32_MAX
 

Protected Attributes

ArchSpec m_arch
 
void * m_baton = nullptr
 
ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault
 
WriteMemoryCallback m_write_mem_callback = &WriteMemoryDefault
 
ReadRegisterCallback m_read_reg_callback = &ReadRegisterDefault
 
WriteRegisterCallback m_write_reg_callback = &WriteRegisterDefault
 
lldb::addr_t m_addr = LLDB_INVALID_ADDRESS
 
Opcode m_opcode
 

Private Member Functions

 EmulateInstruction (const EmulateInstruction &)=delete
 
const EmulateInstructionoperator= (const EmulateInstruction &)=delete
 

Detailed Description

"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.

Member Typedef Documentation

◆ InstructionCondition

Definition at line 357 of file EmulateInstruction.h.

◆ ReadMemoryCallback

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.

◆ ReadRegisterCallback

typedef bool(* lldb_private::EmulateInstruction::ReadRegisterCallback) (EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)

Definition at line 344 of file EmulateInstruction.h.

◆ WriteMemoryCallback

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.

◆ WriteRegisterCallback

typedef bool(* lldb_private::EmulateInstruction::WriteRegisterCallback) (EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)

Definition at line 349 of file EmulateInstruction.h.

Member Enumeration Documentation

◆ ContextType

Enumerator
eContextInvalid 
eContextReadOpcode 
eContextImmediate 
eContextPushRegisterOnStack 
eContextPopRegisterOffStack 
eContextAdjustStackPointer 
eContextSetFramePointer 
eContextRestoreStackPointer 
eContextAdjustBaseRegister 
eContextAdjustPC 
eContextRegisterPlusOffset 
eContextRegisterStore 
eContextRegisterLoad 
eContextRelativeBranchImmediate 
eContextAbsoluteBranchRegister 
eContextSupervisorCall 
eContextTableBranchReadMemory 
eContextWriteRegisterRandomBits 
eContextWriteMemoryRandomBits 
eContextArithmetic 
eContextAdvancePC 
eContextReturnFromException 

Definition at line 100 of file EmulateInstruction.h.

◆ InfoType

Enumerator
eInfoTypeRegisterPlusOffset 
eInfoTypeRegisterPlusIndirectOffset 
eInfoTypeRegisterToRegisterPlusOffset 
eInfoTypeRegisterToRegisterPlusIndirectOffset 
eInfoTypeRegisterRegisterOperands 
eInfoTypeOffset 
eInfoTypeRegister 
eInfoTypeImmediate 
eInfoTypeImmediateSigned 
eInfoTypeAddress 
eInfoTypeISAAndImmediate 
eInfoTypeISAAndImmediateSigned 
eInfoTypeISA 
eInfoTypeNoArgs 

Definition at line 168 of file EmulateInstruction.h.

Constructor & Destructor Documentation

◆ EmulateInstruction() [1/2]

EmulateInstruction::EmulateInstruction ( const ArchSpec arch)

Definition at line 74 of file EmulateInstruction.cpp.

◆ ~EmulateInstruction()

lldb_private::EmulateInstruction::~EmulateInstruction ( )
overridedefault

◆ EmulateInstruction() [2/2]

lldb_private::EmulateInstruction::EmulateInstruction ( const EmulateInstruction )
privatedelete

Member Function Documentation

◆ CreateFunctionEntryUnwind()

bool EmulateInstruction::CreateFunctionEntryUnwind ( UnwindPlan unwind_plan)
virtual

◆ EvaluateInstruction()

virtual bool lldb_private::EmulateInstruction::EvaluateInstruction ( uint32_t  evaluate_options)
pure virtual

◆ FindPlugin()

EmulateInstruction * EmulateInstruction::FindPlugin ( const ArchSpec arch,
InstructionType  supported_inst_type,
const char *  plugin_name 
)
static

◆ GetAddress()

lldb::addr_t lldb_private::EmulateInstruction::GetAddress ( ) const
inline

Definition at line 438 of file EmulateInstruction.h.

References m_addr.

◆ GetAddressByteSize()

uint32_t lldb_private::EmulateInstruction::GetAddressByteSize ( ) const
inline

Definition at line 432 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().

◆ GetArchitecture()

const ArchSpec & lldb_private::EmulateInstruction::GetArchitecture ( ) const
inline

Definition at line 440 of file EmulateInstruction.h.

References m_arch.

Referenced by UnwindAssemblyInstEmulation::WriteMemory().

◆ GetBestRegisterKindAndNumber()

bool EmulateInstruction::GetBestRegisterKindAndNumber ( const RegisterInfo reg_info,
lldb::RegisterKind reg_kind,
uint32_t &  reg_num 
)
static

◆ GetByteOrder()

lldb::ByteOrder lldb_private::EmulateInstruction::GetByteOrder ( ) const
inline

◆ GetInstructionCondition()

virtual InstructionCondition lldb_private::EmulateInstruction::GetInstructionCondition ( )
inlinevirtual

Reimplemented in lldb_private::EmulateInstructionARM.

Definition at line 374 of file EmulateInstruction.h.

References UnconditionalCondition.

◆ GetInternalRegisterNumber()

uint32_t EmulateInstruction::GetInternalRegisterNumber ( RegisterContext reg_ctx,
const RegisterInfo reg_info 
)
static

◆ GetOpcode()

const Opcode & lldb_private::EmulateInstruction::GetOpcode ( ) const
inline

Definition at line 436 of file EmulateInstruction.h.

References m_opcode.

◆ GetRegisterInfo()

virtual std::optional< RegisterInfo > lldb_private::EmulateInstruction::GetRegisterInfo ( lldb::RegisterKind  reg_kind,
uint32_t  reg_num 
)
pure virtual

◆ operator=()

const EmulateInstruction & lldb_private::EmulateInstruction::operator= ( const EmulateInstruction )
privatedelete

◆ ReadInstruction()

virtual bool lldb_private::EmulateInstruction::ReadInstruction ( )
pure virtual

◆ ReadMemory()

size_t EmulateInstruction::ReadMemory ( const Context context,
lldb::addr_t  addr,
void *  dst,
size_t  dst_len 
)

◆ ReadMemoryDefault()

size_t EmulateInstruction::ReadMemoryDefault ( EmulateInstruction instruction,
void *  baton,
const Context context,
lldb::addr_t  addr,
void *  dst,
size_t  length 
)
static

◆ ReadMemoryFrame()

size_t EmulateInstruction::ReadMemoryFrame ( EmulateInstruction instruction,
void *  baton,
const Context context,
lldb::addr_t  addr,
void *  dst,
size_t  length 
)
static

◆ ReadMemoryUnsigned()

uint64_t EmulateInstruction::ReadMemoryUnsigned ( const Context context,
lldb::addr_t  addr,
size_t  byte_size,
uint64_t  fail_value,
bool *  success_ptr 
)

◆ ReadRegister() [1/2]

std::optional< RegisterValue > EmulateInstruction::ReadRegister ( const RegisterInfo reg_info)

◆ ReadRegister() [2/2]

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().

◆ ReadRegisterDefault()

bool EmulateInstruction::ReadRegisterDefault ( EmulateInstruction instruction,
void *  baton,
const RegisterInfo reg_info,
RegisterValue reg_value 
)
static

◆ ReadRegisterFrame()

bool EmulateInstruction::ReadRegisterFrame ( EmulateInstruction instruction,
void *  baton,
const RegisterInfo reg_info,
RegisterValue reg_value 
)
static

◆ ReadRegisterUnsigned() [1/2]

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().

◆ ReadRegisterUnsigned() [2/2]

uint64_t EmulateInstruction::ReadRegisterUnsigned ( lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
uint64_t  fail_value,
bool *  success_ptr 
)

◆ SetBaton()

void EmulateInstruction::SetBaton ( void *  baton)

Definition at line 220 of file EmulateInstruction.cpp.

References m_baton.

Referenced by lldb_private::EmulateInstructionARM::TestEmulation().

◆ SetCallbacks()

void EmulateInstruction::SetCallbacks ( ReadMemoryCallback  read_mem_callback,
WriteMemoryCallback  write_mem_callback,
ReadRegisterCallback  read_reg_callback,
WriteRegisterCallback  write_reg_callback 
)

◆ SetInstruction()

bool EmulateInstruction::SetInstruction ( const Opcode insn_opcode,
const Address inst_addr,
Target target 
)
virtual

◆ SetReadMemCallback()

void EmulateInstruction::SetReadMemCallback ( ReadMemoryCallback  read_mem_callback)

Definition at line 233 of file EmulateInstruction.cpp.

References m_read_mem_callback.

◆ SetReadRegCallback()

void EmulateInstruction::SetReadRegCallback ( ReadRegisterCallback  read_reg_callback)

Definition at line 243 of file EmulateInstruction.cpp.

References m_read_reg_callback.

◆ SetTargetTriple()

virtual bool lldb_private::EmulateInstruction::SetTargetTriple ( const ArchSpec arch)
pure virtual

◆ SetWriteMemCallback()

void EmulateInstruction::SetWriteMemCallback ( WriteMemoryCallback  write_mem_callback)

Definition at line 238 of file EmulateInstruction.cpp.

References m_write_mem_callback.

◆ SetWriteRegCallback()

void EmulateInstruction::SetWriteRegCallback ( WriteRegisterCallback  write_reg_callback)

Definition at line 248 of file EmulateInstruction.cpp.

References m_write_reg_callback.

◆ SupportsEmulatingInstructionsOfType()

virtual bool lldb_private::EmulateInstruction::SupportsEmulatingInstructionsOfType ( InstructionType  inst_type)
pure virtual

◆ TestEmulation()

virtual bool lldb_private::EmulateInstruction::TestEmulation ( Stream out_stream,
ArchSpec arch,
OptionValueDictionary test_data 
)
pure virtual

◆ TranslateRegister()

static const char * lldb_private::EmulateInstruction::TranslateRegister ( lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
std::string &  reg_name 
)
static

◆ WriteMemory()

bool EmulateInstruction::WriteMemory ( const Context context,
lldb::addr_t  addr,
const void *  src,
size_t  src_len 
)

◆ WriteMemoryDefault()

size_t EmulateInstruction::WriteMemoryDefault ( EmulateInstruction instruction,
void *  baton,
const Context context,
lldb::addr_t  addr,
const void *  dst,
size_t  length 
)
static

◆ WriteMemoryFrame()

size_t EmulateInstruction::WriteMemoryFrame ( EmulateInstruction instruction,
void *  baton,
const Context context,
lldb::addr_t  addr,
const void *  dst,
size_t  length 
)
static

◆ WriteMemoryUnsigned()

bool EmulateInstruction::WriteMemoryUnsigned ( const Context context,
lldb::addr_t  addr,
uint64_t  uval,
size_t  uval_byte_size 
)

◆ WriteRegister() [1/2]

bool EmulateInstruction::WriteRegister ( const Context context,
const RegisterInfo ref_info,
const RegisterValue reg_value 
)

◆ WriteRegister() [2/2]

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().

◆ WriteRegisterDefault()

bool EmulateInstruction::WriteRegisterDefault ( EmulateInstruction instruction,
void *  baton,
const Context context,
const RegisterInfo reg_info,
const RegisterValue reg_value 
)
static

◆ WriteRegisterFrame()

bool EmulateInstruction::WriteRegisterFrame ( EmulateInstruction instruction,
void *  baton,
const Context context,
const RegisterInfo reg_info,
const RegisterValue reg_value 
)
static

◆ WriteRegisterUnsigned() [1/2]

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().

◆ WriteRegisterUnsigned() [2/2]

bool EmulateInstruction::WriteRegisterUnsigned ( const Context context,
lldb::RegisterKind  reg_kind,
uint32_t  reg_num,
uint64_t  reg_value 
)

Member Data Documentation

◆ m_addr

lldb::addr_t lldb_private::EmulateInstruction::m_addr = LLDB_INVALID_ADDRESS
protected

◆ m_arch

ArchSpec lldb_private::EmulateInstruction::m_arch
protected

◆ m_baton

void* lldb_private::EmulateInstruction::m_baton = nullptr
protected

◆ m_opcode

Opcode lldb_private::EmulateInstruction::m_opcode
protected

◆ m_read_mem_callback

ReadMemoryCallback lldb_private::EmulateInstruction::m_read_mem_callback = &ReadMemoryDefault
protected

◆ m_read_reg_callback

ReadRegisterCallback lldb_private::EmulateInstruction::m_read_reg_callback = &ReadRegisterDefault
protected

Definition at line 503 of file EmulateInstruction.h.

Referenced by ReadRegister(), SetCallbacks(), and SetReadRegCallback().

◆ m_write_mem_callback

WriteMemoryCallback lldb_private::EmulateInstruction::m_write_mem_callback = &WriteMemoryDefault
protected

◆ m_write_reg_callback

WriteRegisterCallback lldb_private::EmulateInstruction::m_write_reg_callback = &WriteRegisterDefault
protected

Definition at line 504 of file EmulateInstruction.h.

Referenced by SetCallbacks(), SetWriteRegCallback(), and WriteRegister().

◆ UnconditionalCondition

const InstructionCondition lldb_private::EmulateInstruction::UnconditionalCondition = UINT32_MAX
static

The documentation for this class was generated from the following files: