LLDB mainline
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:
[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 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< 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)
std::optional< lldb::addr_tReadPC ()
bool WritePC (lldb::addr_t addr)
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 std::unique_ptr< SingleStepBreakpointLocationsPredictorCreateBreakpointLocationPredictor (std::unique_ptr< EmulateInstruction > emulator_up)

Static Public Attributes

static const InstructionCondition UnconditionalCondition = UINT32_MAX

Protected Types

using BreakpointLocationsPredictorCreator

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

virtual BreakpointLocationsPredictorCreator GetSingleStepBreakpointLocationsPredictorCreator ()
 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 128 of file EmulateInstruction.h.

Member Typedef Documentation

◆ BreakpointLocationsPredictorCreator

Initial value:
std::function<std::unique_ptr<SingleStepBreakpointLocationsPredictor>(
std::unique_ptr<EmulateInstruction>)>

Definition at line 543 of file EmulateInstruction.h.

◆ InstructionCondition

◆ 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 368 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 378 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 373 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 383 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 134 of file EmulateInstruction.h.

◆ InfoType

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

Definition at line 202 of file EmulateInstruction.h.

Constructor & Destructor Documentation

◆ EmulateInstruction() [1/2]

◆ ~EmulateInstruction()

lldb_private::EmulateInstruction::~EmulateInstruction ( )
overridedefault

◆ EmulateInstruction() [2/2]

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

References EmulateInstruction().

Member Function Documentation

◆ CreateBreakpointLocationPredictor()

std::unique_ptr< SingleStepBreakpointLocationsPredictor > EmulateInstruction::CreateBreakpointLocationPredictor ( std::unique_ptr< EmulateInstruction > emulator_up)
static

◆ CreateFunctionEntryUnwind()

bool EmulateInstruction::CreateFunctionEntryUnwind ( UnwindPlan & unwind_plan)
virtual

◆ EvaluateInstruction()

◆ FindPlugin()

◆ GetAddress()

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

Definition at line 474 of file EmulateInstruction.h.

References m_addr.

◆ GetAddressByteSize()

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

Definition at line 468 of file EmulateInstruction.h.

References 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 476 of file EmulateInstruction.h.

References m_arch.

Referenced by UnwindAssemblyInstEmulation::WriteMemory().

◆ GetBestRegisterKindAndNumber()

◆ GetByteOrder()

◆ GetInstructionCondition()

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

Reimplemented in lldb_private::EmulateInstructionARM.

Definition at line 410 of file EmulateInstruction.h.

References UnconditionalCondition.

◆ GetInternalRegisterNumber()

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

◆ GetLastInstrSize()

virtual std::optional< uint32_t > lldb_private::EmulateInstruction::GetLastInstrSize ( )
inlinevirtual

Reimplemented in lldb_private::EmulateInstructionRISCV.

Definition at line 406 of file EmulateInstruction.h.

◆ GetOpcode()

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

Definition at line 472 of file EmulateInstruction.h.

References m_opcode.

◆ GetRegisterInfo()

◆ GetSingleStepBreakpointLocationsPredictorCreator()

virtual BreakpointLocationsPredictorCreator lldb_private::EmulateInstruction::GetSingleStepBreakpointLocationsPredictorCreator ( )
inlineprivatevirtual

Reimplemented in lldb_private::EmulateInstructionARM, and lldb_private::EmulateInstructionRISCV.

Definition at line 558 of file EmulateInstruction.h.

References m_arch.

◆ operator=()

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

References EmulateInstruction().

◆ ReadInstruction()

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

◆ ReadPC()

◆ ReadRegister() [1/2]

◆ 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 EmulateInstructionMIPS64::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_ADDiu(), EmulateInstructionMIPS::Emulate_ADDIUS5(), EmulateInstructionMIPS::Emulate_ADDIUSP(), EmulateInstructionMIPS::Emulate_B16_MM(), EmulateInstructionMIPS64::Emulate_BAL(), EmulateInstructionMIPS::Emulate_BAL(), EmulateInstructionMIPS64::Emulate_BALC(), EmulateInstructionMIPS::Emulate_BALC(), EmulateInstructionMIPS64::Emulate_BC(), EmulateInstructionMIPS::Emulate_BC(), EmulateInstructionMIPS64::Emulate_BC1EQZ(), EmulateInstructionMIPS::Emulate_BC1EQZ(), EmulateInstructionMIPS64::Emulate_BC1NEZ(), EmulateInstructionMIPS::Emulate_BC1NEZ(), EmulateInstructionMIPS64::Emulate_Bcond_Link(), EmulateInstructionMIPS::Emulate_Bcond_Link(), EmulateInstructionMIPS64::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Branch_MM(), EmulateInstructionMIPS64::Emulate_BXX_2ops(), EmulateInstructionMIPS::Emulate_BXX_2ops(), EmulateInstructionMIPS64::Emulate_BXX_2ops_C(), EmulateInstructionMIPS::Emulate_BXX_2ops_C(), EmulateInstructionMIPS64::Emulate_BXX_3ops(), EmulateInstructionMIPS::Emulate_BXX_3ops(), EmulateInstructionMIPS64::Emulate_BXX_3ops_C(), EmulateInstructionMIPS::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_DADDiu(), EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(), EmulateInstructionMIPS64::Emulate_FP_branch(), EmulateInstructionMIPS::Emulate_FP_branch(), EmulateInstructionMIPS64::Emulate_J(), EmulateInstructionMIPS::Emulate_J(), EmulateInstructionMIPS64::Emulate_JAL(), EmulateInstructionMIPS::Emulate_JAL(), EmulateInstructionMIPS64::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALRS(), EmulateInstructionMIPS::Emulate_JALRx16_MM(), EmulateInstructionMIPS::Emulate_JALx(), EmulateInstructionMIPS64::Emulate_JIALC(), EmulateInstructionMIPS::Emulate_JIALC(), EmulateInstructionMIPS64::Emulate_JIC(), EmulateInstructionMIPS::Emulate_JIC(), EmulateInstructionMIPS64::Emulate_JR(), EmulateInstructionMIPS::Emulate_JR(), EmulateInstructionMIPS::Emulate_JRADDIUSP(), EmulateInstructionMIPS64::Emulate_LD(), EmulateInstructionMIPS64::Emulate_LDST_Imm(), EmulateInstructionMIPS::Emulate_LDST_Imm(), EmulateInstructionMIPS64::Emulate_LDST_Reg(), EmulateInstructionMIPS::Emulate_LDST_Reg(), EmulateInstructionMIPS::Emulate_LW(), EmulateInstructionMIPS::Emulate_LWM16_32(), EmulateInstructionMIPS::Emulate_LWSP(), EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS64::Emulate_MSA_Branch_V(), EmulateInstructionMIPS::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(), EmulateInstructionARM64::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), lldb_private::EmulateInstructionARM::EvaluateInstruction(), lldb_private::EmulateInstructionPPC64::EvaluateInstruction(), lldb_private::EmulateInstructionRISCV::GetRoundingMode(), lldb_private::EmulateInstructionARM::ReadCoreReg(), EmulateInstructionARM64::ReadInstruction(), EmulateInstructionMIPS64::ReadInstruction(), EmulateInstructionMIPS::ReadInstruction(), lldb_private::EmulateInstructionARM::ReadInstruction(), lldb_private::EmulateInstructionPPC64::ReadInstruction(), 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()

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

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

◆ TestEmulation()

◆ TranslateRegister()

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

◆ WriteMemory()

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

◆ WritePC()

◆ WriteRegister() [1/2]

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

◆ 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(), EmulateInstructionMIPS64::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_3D_branch(), EmulateInstructionMIPS::Emulate_ADDiu(), EmulateInstructionMIPS::Emulate_ADDIUS5(), EmulateInstructionMIPS::Emulate_ADDIUSP(), EmulateInstructionMIPS::Emulate_B16_MM(), EmulateInstructionMIPS64::Emulate_BAL(), EmulateInstructionMIPS::Emulate_BAL(), EmulateInstructionMIPS64::Emulate_BALC(), EmulateInstructionMIPS::Emulate_BALC(), EmulateInstructionMIPS64::Emulate_BC(), EmulateInstructionMIPS::Emulate_BC(), EmulateInstructionMIPS64::Emulate_BC1EQZ(), EmulateInstructionMIPS::Emulate_BC1EQZ(), EmulateInstructionMIPS64::Emulate_BC1NEZ(), EmulateInstructionMIPS::Emulate_BC1NEZ(), EmulateInstructionMIPS64::Emulate_Bcond_Link(), EmulateInstructionMIPS::Emulate_Bcond_Link(), EmulateInstructionMIPS64::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Bcond_Link_C(), EmulateInstructionMIPS::Emulate_Branch_MM(), EmulateInstructionMIPS64::Emulate_BXX_2ops(), EmulateInstructionMIPS::Emulate_BXX_2ops(), EmulateInstructionMIPS64::Emulate_BXX_2ops_C(), EmulateInstructionMIPS::Emulate_BXX_2ops_C(), EmulateInstructionMIPS64::Emulate_BXX_3ops(), EmulateInstructionMIPS::Emulate_BXX_3ops(), EmulateInstructionMIPS64::Emulate_BXX_3ops_C(), EmulateInstructionMIPS::Emulate_BXX_3ops_C(), EmulateInstructionMIPS64::Emulate_DADDiu(), EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(), EmulateInstructionMIPS64::Emulate_FP_branch(), EmulateInstructionMIPS::Emulate_FP_branch(), EmulateInstructionMIPS64::Emulate_J(), EmulateInstructionMIPS::Emulate_J(), EmulateInstructionMIPS64::Emulate_JAL(), EmulateInstructionMIPS::Emulate_JAL(), EmulateInstructionMIPS64::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALR(), EmulateInstructionMIPS::Emulate_JALRS(), EmulateInstructionMIPS::Emulate_JALRx16_MM(), EmulateInstructionMIPS::Emulate_JALx(), EmulateInstructionMIPS64::Emulate_JIALC(), EmulateInstructionMIPS::Emulate_JIALC(), EmulateInstructionMIPS64::Emulate_JIC(), EmulateInstructionMIPS::Emulate_JIC(), EmulateInstructionMIPS64::Emulate_JR(), EmulateInstructionMIPS::Emulate_JR(), EmulateInstructionMIPS::Emulate_JRADDIUSP(), EmulateInstructionMIPS64::Emulate_LD(), EmulateInstructionMIPS64::Emulate_LDST_Imm(), EmulateInstructionMIPS::Emulate_LDST_Imm(), EmulateInstructionMIPS64::Emulate_LDST_Reg(), EmulateInstructionMIPS::Emulate_LDST_Reg(), EmulateInstructionMIPS64::Emulate_LUI(), EmulateInstructionMIPS::Emulate_LUI(), EmulateInstructionMIPS::Emulate_LW(), EmulateInstructionMIPS::Emulate_LWSP(), EmulateInstructionMIPS64::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS::Emulate_MSA_Branch_DF(), EmulateInstructionMIPS64::Emulate_MSA_Branch_V(), EmulateInstructionMIPS::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(), EmulateInstructionARM64::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), lldb_private::EmulateInstructionARM::EvaluateInstruction(), lldb_private::EmulateInstructionPPC64::EvaluateInstruction(), lldb_private::EmulateInstructionRISCV::SetAccruedExceptions(), lldb_private::EmulateInstructionARM::WriteBits32Unknown(), lldb_private::EmulateInstructionARM::WriteCoreRegOptionalFlags(), lldb_private::EmulateInstructionARM::WriteFlags(), and 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

◆ m_arch

◆ m_baton

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

◆ m_opcode

◆ 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 551 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 552 of file EmulateInstruction.h.

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

◆ UnconditionalCondition


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