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
Collaboration diagram for lldb_private::Instruction:
Collaboration graph


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

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 565 of file Disassembler.cpp.

◆ ~Instruction()

Instruction::~Instruction ( )

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)

◆ CanSetBreakpoint()

bool Instruction::CanSetBreakpoint ( )

Definition at line 649 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 

Dump the text representation of this Instruction to a Stream.

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

[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 577 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

◆ GetAddressClass()

AddressClass Instruction::GetAddressClass ( )

◆ GetComment()

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

Definition at line 77 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_comment.

◆ GetData()

uint32_t Instruction::GetData ( DataExtractor data)

Definition at line 923 of file Disassembler.cpp.

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

◆ GetMnemonic()

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

Definition at line 67 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_opcode_name.

◆ GetOpcode()

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

◆ GetOperands()

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

Definition at line 72 of file Disassembler.h.

References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_mnemonics.

◆ HasDelaySlot()

bool Instruction::HasDelaySlot ( )

Reimplemented in lldb_private::PseudoInstruction, and InstructionLLVMC.

Definition at line 653 of file Disassembler.cpp.

Referenced by CanSetBreakpoint().

◆ IsAuthenticated()

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

◆ IsCall()

virtual bool lldb_private::Instruction::IsCall ( )

Reimplemented in InstructionLLVMC.

Definition at line 214 of file Disassembler.h.

◆ IsLoad()

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

◆ ParseOperands()

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

Reimplemented in InstructionLLVMC.

Definition at line 210 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)

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  )

Reimplemented in lldb_private::PseudoInstruction.

Definition at line 163 of file Disassembler.h.

Referenced by TestEmulation().

◆ TestEmulation()

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

Member Data Documentation

◆ m_address

Address lldb_private::Instruction::m_address

Definition at line 217 of file Disassembler.h.

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

◆ m_address_class

AddressClass lldb_private::Instruction::m_address_class

Definition at line 226 of file Disassembler.h.

Referenced by GetAddressClass(), and SetAddress().

◆ m_calculated_strings

bool lldb_private::Instruction::m_calculated_strings

Definition at line 233 of file Disassembler.h.

Referenced by CalculateMnemonicOperandsAndCommentIfNeeded().

◆ m_comment

std::string lldb_private::Instruction::m_comment

Definition at line 232 of file Disassembler.h.

Referenced by Dump(), and GetComment().

◆ m_mnemonics

std::string lldb_private::Instruction::m_mnemonics

Definition at line 231 of file Disassembler.h.

Referenced by Dump(), and GetOperands().

◆ m_opcode

Opcode lldb_private::Instruction::m_opcode

◆ m_opcode_name

std::string lldb_private::Instruction::m_opcode_name

Definition at line 230 of file Disassembler.h.

Referenced by Dump(), and GetMnemonic().

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