LLDB  mainline
Classes | 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]
Collaboration diagram for lldb_private::Instruction:
Collaboration 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)
 
const char * GetOperands (const ExecutionContext *exe_ctx)
 
const char * GetComment (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, 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. More...
 
virtual bool DoesBranch ()=0
 
virtual bool HasDelaySlot ()
 
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 ()
 

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_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 566 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 650 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,
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]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 578 of file Disassembler.cpp.

References CalculateMnemonicOperandsAndCommentIfNeeded(), lldb_private::Opcode::Dump(), lldb_private::Opcode::eTypeBytes, lldb_private::StreamString::FillLastLineToColumn(), lldb_private::Debugger::FormatDisassemblerAddress(), lldb_private::StreamString::GetSizeOfLastLine(), lldb_private::StreamString::GetString(), lldb_private::Opcode::GetType(), m_address, m_comment, m_mnemonics, m_opcode, m_opcode_name, 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 77 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_comment.

◆ GetData()

uint32_t Instruction::GetData ( DataExtractor data)

Definition at line 924 of file Disassembler.cpp.

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

◆ GetMnemonic()

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

Definition at line 67 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_opcode_name.

◆ GetOpcode()

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

◆ GetOperands()

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

Definition at line 72 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_mnemonics.

◆ HasDelaySlot()

bool Instruction::HasDelaySlot ( )
virtual

Reimplemented in lldb_private::PseudoInstruction, and InstructionLLVMC.

Definition at line 654 of file Disassembler.cpp.

Referenced by CanSetBreakpoint().

◆ IsCall()

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

Reimplemented in InstructionLLVMC.

Definition at line 210 of file Disassembler.h.

◆ ParseOperands()

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

Reimplemented in InstructionLLVMC.

Definition at line 206 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 87 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 159 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

Definition at line 213 of file Disassembler.h.

Referenced by Dump(), GetAddress(), GetAddressClass(), and SetAddress().

◆ m_address_class

AddressClass lldb_private::Instruction::m_address_class
private

Definition at line 222 of file Disassembler.h.

Referenced by GetAddressClass(), and SetAddress().

◆ m_calculated_strings

bool lldb_private::Instruction::m_calculated_strings
protected

Definition at line 229 of file Disassembler.h.

Referenced by CalculateMnemonicOperandsAndCommentIfNeeded().

◆ m_comment

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

Definition at line 228 of file Disassembler.h.

Referenced by Dump(), and GetComment().

◆ m_mnemonics

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

Definition at line 227 of file Disassembler.h.

Referenced by Dump(), and GetOperands().

◆ m_opcode

Opcode lldb_private::Instruction::m_opcode
protected

◆ m_opcode_name

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

Definition at line 226 of file Disassembler.h.

Referenced by Dump(), and GetMnemonic().


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