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

#include <Disassembler.h>

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

Classes

struct  Operand
 

Public Member Functions

 Instruction (const Address &address, AddressClass addr_class=AddressClass::eInvalid)
 
virtual ~Instruction ()
 
const AddressGetAddress () const
 
const char * GetMnemonic (const ExecutionContext *exe_ctx, bool markup=false)
 
const char * GetOperands (const ExecutionContext *exe_ctx, bool markup=false)
 
const char * GetComment (const ExecutionContext *exe_ctx)
 
virtual lldb::InstructionControlFlowKind GetControlFlowKind (const ExecutionContext *exe_ctx)
 
virtual void CalculateMnemonicOperandsAndComment (const ExecutionContext *exe_ctx)=0
 
AddressClass GetAddressClass ()
 
void SetAddress (const Address &addr)
 
virtual void Dump (Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, bool show_control_flow_kind, const ExecutionContext *exe_ctx, const SymbolContext *sym_ctx, const SymbolContext *prev_sym_ctx, const FormatEntity::Entry *disassembly_addr_format, size_t max_address_text_size)
 Dump the text representation of this Instruction to a Stream.
 
virtual bool DoesBranch ()=0
 
virtual bool HasDelaySlot ()
 
virtual bool IsLoad ()=0
 
virtual bool IsAuthenticated ()=0
 
bool CanSetBreakpoint ()
 
virtual size_t Decode (const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset)=0
 
virtual void SetDescription (llvm::StringRef)
 
lldb::OptionValueSP ReadArray (FILE *in_file, Stream &out_stream, OptionValue::Type data_type)
 
lldb::OptionValueSP ReadDictionary (FILE *in_file, Stream &out_stream)
 
bool DumpEmulation (const ArchSpec &arch)
 
virtual bool TestEmulation (Stream &stream, const char *test_file_name)
 
bool Emulate (const ArchSpec &arch, uint32_t evaluate_options, void *baton, EmulateInstruction::ReadMemoryCallback read_mem_callback, EmulateInstruction::WriteMemoryCallback write_mem_calback, EmulateInstruction::ReadRegisterCallback read_reg_callback, EmulateInstruction::WriteRegisterCallback write_reg_callback)
 
const OpcodeGetOpcode () const
 
uint32_t GetData (DataExtractor &data)
 
virtual bool ParseOperands (llvm::SmallVectorImpl< Operand > &operands)
 
virtual bool IsCall ()
 

Static Public Member Functions

static const char * GetNameForInstructionControlFlowKind (lldb::InstructionControlFlowKind instruction_control_flow_kind)
 

Protected Member Functions

void CalculateMnemonicOperandsAndCommentIfNeeded (const ExecutionContext *exe_ctx)
 

Protected Attributes

Address m_address
 
Opcode m_opcode
 
std::string m_opcode_name
 
std::string m_markup_opcode_name
 
std::string m_mnemonics
 
std::string m_markup_mnemonics
 
std::string m_comment
 
bool m_calculated_strings
 

Private Attributes

AddressClass m_address_class
 

Detailed Description

Definition at line 58 of file Disassembler.h.

Constructor & Destructor Documentation

◆ Instruction()

Instruction::Instruction ( const Address address,
AddressClass  addr_class = AddressClass::eInvalid 
)

Definition at line 565 of file Disassembler.cpp.

◆ ~Instruction()

Instruction::~Instruction ( )
virtualdefault

Member Function Documentation

◆ CalculateMnemonicOperandsAndComment()

virtual void lldb_private::Instruction::CalculateMnemonicOperandsAndComment ( const ExecutionContext exe_ctx)
pure virtual

◆ CalculateMnemonicOperandsAndCommentIfNeeded()

void lldb_private::Instruction::CalculateMnemonicOperandsAndCommentIfNeeded ( const ExecutionContext exe_ctx)
inlineprotected

◆ CanSetBreakpoint()

bool Instruction::CanSetBreakpoint ( )

Definition at line 693 of file Disassembler.cpp.

References HasDelaySlot().

◆ Decode()

virtual size_t lldb_private::Instruction::Decode ( const Disassembler disassembler,
const DataExtractor data,
lldb::offset_t  data_offset 
)
pure virtual

◆ DoesBranch()

virtual bool lldb_private::Instruction::DoesBranch ( )
pure virtual

◆ Dump()

void Instruction::Dump ( lldb_private::Stream s,
uint32_t  max_opcode_byte_size,
bool  show_address,
bool  show_bytes,
bool  show_control_flow_kind,
const ExecutionContext exe_ctx,
const SymbolContext sym_ctx,
const SymbolContext prev_sym_ctx,
const FormatEntity::Entry disassembly_addr_format,
size_t  max_address_text_size 
)
virtual

Dump the text representation of this Instruction to a Stream.

Print the (optional) address, (optional) bytes, opcode, operands, and instruction comments to a stream.

Parameters
[in]sThe Stream to add the text to.
[in]show_addressWhether the address (using disassembly_addr_format_spec formatting) should be printed.
[in]show_bytesWhether the bytes of the assembly instruction should be printed.
[in]show_control_flow_kindWhether the control flow kind of the instruction should be printed.
[in]max_opcode_byte_sizeThe size (in bytes) of the largest instruction in the list that we are printing (for text justification/alignment purposes) Only needed if show_bytes is true.
[in]exe_ctxThe current execution context, if available. May be used in the assembling of the operands+comments for this instruction. Pass NULL if not applicable.
[in]sym_ctxThe SymbolContext for this instruction. Pass NULL if not available/computed. Only needed if show_address is true.
[in]prev_sym_ctxThe SymbolContext for the previous instruction. Depending on the disassembly address format specification, a change in Symbol / Function may mean that a line is printed with the new symbol/function name. Pass NULL if unavailable, or if this is the first instruction of the InstructionList. Only needed if show_address is true.
[in]disassembly_addr_formatThe format specification for how addresses are printed. Only needed if show_address is true.
[in]max_address_text_sizeThe length of the longest address string at the start of the disassembly line that will be printed (the Debugger::FormatDisassemblerAddress() string) so this method can properly align the instruction opcodes. May be 0 to indicate no indentation/alignment of the opcodes.

Definition at line 602 of file Disassembler.cpp.

References CalculateMnemonicOperandsAndCommentIfNeeded(), lldb_private::Opcode::Dump(), lldb_private::Opcode::eTypeBytes, lldb_private::StreamString::FillLastLineToColumn(), lldb_private::Debugger::FormatDisassemblerAddress(), GetControlFlowKind(), GetNameForInstructionControlFlowKind(), lldb_private::StreamString::GetSizeOfLastLine(), lldb_private::StreamString::GetString(), lldb_private::ExecutionContext::GetTargetSP(), lldb_private::Opcode::GetType(), m_address, m_comment, m_markup_mnemonics, m_markup_opcode_name, m_mnemonics, m_opcode, m_opcode_name, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().

Referenced by lldb::SBInstructionList::GetDescription(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::ThreadPlanAssemblyTracer::Log(), and lldb_private::Disassembler::PrintInstructions().

◆ DumpEmulation()

bool Instruction::DumpEmulation ( const ArchSpec arch)

◆ Emulate()

bool Instruction::Emulate ( const ArchSpec arch,
uint32_t  evaluate_options,
void *  baton,
EmulateInstruction::ReadMemoryCallback  read_mem_callback,
EmulateInstruction::WriteMemoryCallback  write_mem_calback,
EmulateInstruction::ReadRegisterCallback  read_reg_callback,
EmulateInstruction::WriteRegisterCallback  write_reg_callback 
)

◆ GetAddress()

const Address & lldb_private::Instruction::GetAddress ( ) const
inline

◆ GetAddressClass()

AddressClass Instruction::GetAddressClass ( )

◆ GetComment()

const char * lldb_private::Instruction::GetComment ( const ExecutionContext exe_ctx)
inline

Definition at line 79 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_comment.

◆ GetControlFlowKind()

virtual lldb::InstructionControlFlowKind lldb_private::Instruction::GetControlFlowKind ( const ExecutionContext exe_ctx)
inlinevirtual
Returns
The control flow kind of this instruction, or eInstructionControlFlowKindUnknown if the instruction can't be classified.

Reimplemented in InstructionLLVMC.

Definition at line 89 of file Disassembler.h.

References lldb::eInstructionControlFlowKindUnknown.

Referenced by Dump().

◆ GetData()

uint32_t Instruction::GetData ( DataExtractor data)

Definition at line 963 of file Disassembler.cpp.

References lldb_private::Opcode::GetData(), and m_opcode.

◆ GetMnemonic()

const char * lldb_private::Instruction::GetMnemonic ( const ExecutionContext exe_ctx,
bool  markup = false 
)
inline

◆ GetNameForInstructionControlFlowKind()

const char * Instruction::GetNameForInstructionControlFlowKind ( lldb::InstructionControlFlowKind  instruction_control_flow_kind)
static

◆ GetOpcode()

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

◆ GetOperands()

const char * lldb_private::Instruction::GetOperands ( const ExecutionContext exe_ctx,
bool  markup = false 
)
inline

◆ HasDelaySlot()

bool Instruction::HasDelaySlot ( )
virtual

Reimplemented in lldb_private::PseudoInstruction, and InstructionLLVMC.

Definition at line 697 of file Disassembler.cpp.

Referenced by CanSetBreakpoint().

◆ IsAuthenticated()

virtual bool lldb_private::Instruction::IsAuthenticated ( )
pure virtual

◆ IsCall()

virtual bool lldb_private::Instruction::IsCall ( )
inlinevirtual

Reimplemented in InstructionLLVMC.

Definition at line 229 of file Disassembler.h.

◆ IsLoad()

virtual bool lldb_private::Instruction::IsLoad ( )
pure virtual

◆ ParseOperands()

virtual bool lldb_private::Instruction::ParseOperands ( llvm::SmallVectorImpl< Operand > &  operands)
inlinevirtual

Reimplemented in InstructionLLVMC.

Definition at line 225 of file Disassembler.h.

◆ ReadArray()

OptionValueSP Instruction::ReadArray ( FILE *  in_file,
Stream out_stream,
OptionValue::Type  data_type 
)

◆ ReadDictionary()

OptionValueSP Instruction::ReadDictionary ( FILE *  in_file,
Stream out_stream 
)

◆ SetAddress()

void lldb_private::Instruction::SetAddress ( const Address addr)
inline

Definition at line 98 of file Disassembler.h.

References lldb_private::eInvalid, m_address, and m_address_class.

◆ SetDescription()

virtual void lldb_private::Instruction::SetDescription ( llvm::StringRef  )
inlinevirtual

Reimplemented in lldb_private::PseudoInstruction.

Definition at line 178 of file Disassembler.h.

Referenced by TestEmulation().

◆ TestEmulation()

bool Instruction::TestEmulation ( Stream stream,
const char *  test_file_name 
)
virtual

Member Data Documentation

◆ m_address

Address lldb_private::Instruction::m_address
protected

◆ m_address_class

AddressClass lldb_private::Instruction::m_address_class
private

Definition at line 244 of file Disassembler.h.

Referenced by GetAddressClass(), and SetAddress().

◆ m_calculated_strings

bool lldb_private::Instruction::m_calculated_strings
protected

Definition at line 253 of file Disassembler.h.

Referenced by CalculateMnemonicOperandsAndCommentIfNeeded().

◆ m_comment

std::string lldb_private::Instruction::m_comment
protected

◆ m_markup_mnemonics

std::string lldb_private::Instruction::m_markup_mnemonics
protected

◆ m_markup_opcode_name

std::string lldb_private::Instruction::m_markup_opcode_name
protected

◆ m_mnemonics

std::string lldb_private::Instruction::m_mnemonics
protected

◆ m_opcode

Opcode lldb_private::Instruction::m_opcode
protected

◆ m_opcode_name

std::string lldb_private::Instruction::m_opcode_name
protected

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