LLDB mainline
|
#include <Disassembler.h>
Classes | |
struct | Operand |
Public Member Functions | |
Instruction (const Address &address, AddressClass addr_class=AddressClass::eInvalid) | |
virtual | ~Instruction () |
const Address & | GetAddress () 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 Opcode & | GetOpcode () 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 |
Definition at line 58 of file Disassembler.h.
Instruction::Instruction | ( | const Address & | address, |
AddressClass | addr_class = AddressClass::eInvalid |
||
) |
Definition at line 582 of file Disassembler.cpp.
|
virtualdefault |
|
pure virtual |
Implemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
Referenced by CalculateMnemonicOperandsAndCommentIfNeeded().
|
inlineprotected |
Definition at line 256 of file Disassembler.h.
References CalculateMnemonicOperandsAndComment(), and m_calculated_strings.
Referenced by Dump(), GetComment(), GetMnemonic(), and GetOperands().
bool Instruction::CanSetBreakpoint | ( | ) |
Definition at line 710 of file Disassembler.cpp.
References HasDelaySlot().
|
pure virtual |
Implemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
|
pure virtual |
Implemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
|
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.
[in] | s | The Stream to add the text to. |
[in] | show_address | Whether the address (using disassembly_addr_format_spec formatting) should be printed. |
[in] | show_bytes | Whether the bytes of the assembly instruction should be printed. |
[in] | show_control_flow_kind | Whether the control flow kind of the instruction should be printed. |
[in] | max_opcode_byte_size | The 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_ctx | The 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_ctx | The SymbolContext for this instruction. Pass NULL if not available/computed. Only needed if show_address is true. |
[in] | prev_sym_ctx | The 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_format | The format specification for how addresses are printed. Only needed if show_address is true. |
[in] | max_address_text_size | The 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 619 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().
bool Instruction::DumpEmulation | ( | const ArchSpec & | arch | ) |
Definition at line 699 of file Disassembler.cpp.
References lldb_private::eInstructionTypeAny, lldb_private::EmulateInstruction::FindPlugin(), GetAddress(), and GetOpcode().
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 | ||
) |
Definition at line 961 of file Disassembler.cpp.
References lldb_private::eInstructionTypeAny, lldb_private::EmulateInstruction::FindPlugin(), GetAddress(), and GetOpcode().
|
inline |
Definition at line 65 of file Disassembler.h.
References m_address.
Referenced by DumpEmulation(), Emulate(), lldb::SBInstructionList::GetDescription(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), lldb_private::Disassembler::PrintInstructions(), and DisassemblerLLVMC::SymbolLookup().
AddressClass Instruction::GetAddressClass | ( | ) |
Definition at line 588 of file Disassembler.cpp.
References lldb_private::eInvalid, lldb_private::Address::GetAddressClass(), m_address, and m_address_class.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), and InstructionLLVMC::GetDisasmToUse().
|
inline |
Definition at line 79 of file Disassembler.h.
References CalculateMnemonicOperandsAndCommentIfNeeded(), and m_comment.
|
inlinevirtual |
Reimplemented in InstructionLLVMC.
Definition at line 89 of file Disassembler.h.
References lldb::eInstructionControlFlowKindUnknown.
Referenced by Dump().
uint32_t Instruction::GetData | ( | DataExtractor & | data | ) |
Definition at line 980 of file Disassembler.cpp.
References lldb_private::Opcode::GetData(), and m_opcode.
|
inline |
Definition at line 67 of file Disassembler.h.
References CalculateMnemonicOperandsAndCommentIfNeeded(), m_markup_opcode_name, and m_opcode_name.
|
static |
Definition at line 594 of file Disassembler.cpp.
References lldb::eInstructionControlFlowKindCall, lldb::eInstructionControlFlowKindCondJump, lldb::eInstructionControlFlowKindFarCall, lldb::eInstructionControlFlowKindFarJump, lldb::eInstructionControlFlowKindFarReturn, lldb::eInstructionControlFlowKindJump, lldb::eInstructionControlFlowKindOther, lldb::eInstructionControlFlowKindReturn, and lldb::eInstructionControlFlowKindUnknown.
Referenced by Dump(), and OutputWriterJSON::DumpInstruction().
|
inline |
Definition at line 196 of file Disassembler.h.
References m_opcode.
Referenced by DumpEmulation(), Emulate(), and UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly().
|
inline |
Definition at line 73 of file Disassembler.h.
References CalculateMnemonicOperandsAndCommentIfNeeded(), m_markup_mnemonics, and m_mnemonics.
Referenced by InstructionLLVMC::ParseOperands().
|
virtual |
Reimplemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
Definition at line 714 of file Disassembler.cpp.
Referenced by CanSetBreakpoint().
|
pure virtual |
Implemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
|
inlinevirtual |
Reimplemented in InstructionLLVMC.
Definition at line 229 of file Disassembler.h.
|
pure virtual |
Implemented in lldb_private::PseudoInstruction, and InstructionLLVMC.
|
inlinevirtual |
Reimplemented in InstructionLLVMC.
Definition at line 225 of file Disassembler.h.
OptionValueSP Instruction::ReadArray | ( | FILE * | in_file, |
Stream & | out_stream, | ||
OptionValue::Type | data_type | ||
) |
Definition at line 719 of file Disassembler.cpp.
References lldb_private::OptionValue::eTypeUInt64, lldb_private::RegularExpression::Execute(), and lldb_private::Stream::Printf().
Referenced by ReadDictionary().
OptionValueSP Instruction::ReadDictionary | ( | FILE * | in_file, |
Stream & | out_stream | ||
) |
Definition at line 778 of file Disassembler.cpp.
References lldb_private::OptionValue::eTypeInvalid, lldb_private::OptionValue::eTypeUInt64, lldb_private::RegularExpression::Execute(), lldb_private::Stream::Printf(), ReadArray(), and ReadDictionary().
Referenced by ReadDictionary(), and TestEmulation().
|
inline |
Definition at line 98 of file Disassembler.h.
References lldb_private::eInvalid, m_address, and m_address_class.
|
inlinevirtual |
Reimplemented in lldb_private::PseudoInstruction.
Definition at line 178 of file Disassembler.h.
Referenced by TestEmulation().
|
virtual |
Definition at line 880 of file Disassembler.cpp.
References lldb_private::eInstructionTypeAny, lldb_private::EmulateInstruction::FindPlugin(), lldb_private::FileSystem::Fopen(), lldb_private::OptionValue::GetAsDictionary(), lldb_private::OptionValueDictionary::GetValueForKey(), lldb_private::FileSystem::Instance(), lldb_private::Stream::Printf(), ReadDictionary(), SetDescription(), and lldb_private::ArchSpec::SetTriple().
|
protected |
Definition at line 235 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), InstructionLLVMC::Decode(), Dump(), GetAddress(), GetAddressClass(), SetAddress(), and InstructionLLVMC::VisitInstruction().
|
private |
Definition at line 244 of file Disassembler.h.
Referenced by GetAddressClass(), and SetAddress().
|
protected |
Definition at line 253 of file Disassembler.h.
Referenced by CalculateMnemonicOperandsAndCommentIfNeeded().
|
protected |
Definition at line 252 of file Disassembler.h.
Referenced by InstructionLLVMC::AppendComment(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Dump(), and GetComment().
|
protected |
Definition at line 251 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Dump(), and GetOperands().
|
protected |
Definition at line 249 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Dump(), and GetMnemonic().
|
protected |
Definition at line 250 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Dump(), and GetOperands().
|
protected |
Definition at line 247 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::PseudoInstruction::Decode(), InstructionLLVMC::Decode(), Dump(), InstructionLLVMC::GetByteSize(), InstructionLLVMC::GetControlFlowKind(), GetData(), GetOpcode(), lldb_private::PseudoInstruction::SetOpcode(), and InstructionLLVMC::VisitInstruction().
|
protected |
Definition at line 248 of file Disassembler.h.
Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Dump(), and GetMnemonic().