LLDB mainline
|
#include <Disassembler.h>
Classes | |
struct | Limit |
struct | SourceLine |
struct | SourceLinesToDisplay |
Public Types | |
enum | { eOptionNone = 0u , eOptionShowBytes = (1u << 0) , eOptionRawOuput = (1u << 1) , eOptionMarkPCSourceLine = (1u << 2) , eOptionMarkPCAddress , eOptionShowControlFlowKind = (1u << 4) } |
enum | HexImmediateStyle { eHexStyleC , eHexStyleAsm } |
Public Member Functions | |
Disassembler (const ArchSpec &arch, const char *flavor) | |
~Disassembler () override | |
void | PrintInstructions (Debugger &debugger, const ArchSpec &arch, const ExecutionContext &exe_ctx, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm) |
size_t | ParseInstructions (Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false) |
virtual size_t | DecodeInstructions (const Address &base_addr, const DataExtractor &data, lldb::offset_t data_offset, size_t num_instructions, bool append, bool data_from_file)=0 |
InstructionList & | GetInstructionList () |
const InstructionList & | GetInstructionList () const |
const ArchSpec & | GetArchitecture () const |
const char * | GetFlavor () const |
virtual bool | FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor)=0 |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Static Public Member Functions | |
static lldb::DisassemblerSP | FindPlugin (const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name) |
static lldb::DisassemblerSP | FindPluginForTarget (const Target &target, const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name) |
static lldb::DisassemblerSP | DisassembleRange (const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, Target &target, const AddressRange &disasm_range, bool force_live_memory=false) |
static lldb::DisassemblerSP | DisassembleBytes (const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, const Address &start, const void *bytes, size_t length, uint32_t max_num_instructions, bool data_from_file) |
static bool | Disassemble (Debugger &debugger, const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, const ExecutionContext &exe_ctx, const Address &start, Limit limit, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm) |
static bool | Disassemble (Debugger &debugger, const ArchSpec &arch, StackFrame &frame, Stream &strm) |
Static Protected Member Functions | |
static SourceLine | GetFunctionDeclLineEntry (const SymbolContext &sc) |
static void | AddLineToSourceLineTables (SourceLine &line, std::map< FileSpec, std::set< uint32_t > > &source_lines_seen) |
static bool | ElideMixedSourceAndDisassemblyLine (const ExecutionContext &exe_ctx, const SymbolContext &sc, SourceLine &line) |
static bool | ElideMixedSourceAndDisassemblyLine (const ExecutionContext &exe_ctx, const SymbolContext &sc, LineEntry &line) |
Protected Attributes | |
ArchSpec | m_arch |
InstructionList | m_instruction_list |
std::string | m_flavor |
Private Member Functions | |
Disassembler (const Disassembler &)=delete | |
const Disassembler & | operator= (const Disassembler &)=delete |
Definition at line 388 of file Disassembler.h.
anonymous enum |
Enumerator | |
---|---|
eOptionNone | |
eOptionShowBytes | |
eOptionRawOuput | |
eOptionMarkPCSourceLine | |
eOptionMarkPCAddress | |
eOptionShowControlFlowKind |
Definition at line 391 of file Disassembler.h.
Enumerator | |
---|---|
eHexStyleC | |
eHexStyleAsm |
Definition at line 402 of file Disassembler.h.
Disassembler::Disassembler | ( | const ArchSpec & | arch, |
const char * | flavor | ||
) |
Definition at line 1136 of file Disassembler.cpp.
References lldb_private::ArchSpec::GetTriple(), lldb_private::ArchSpec::IsAlwaysThumbInstructions(), m_arch, m_flavor, and lldb_private::ArchSpec::SetTriple().
|
overridedefault |
|
privatedelete |
|
staticprotected |
Definition at line 229 of file Disassembler.cpp.
References lldb_private::Disassembler::SourceLine::file, lldb_private::Disassembler::SourceLine::IsValid(), and lldb_private::Disassembler::SourceLine::line.
Referenced by PrintInstructions().
|
pure virtual |
Implemented in DisassemblerLLVMC.
Referenced by lldb_private::ThreadPlanAssemblyTracer::Log(), and ParseInstructions().
|
static |
Definition at line 171 of file Disassembler.cpp.
References FindPluginForTarget(), lldb_private::ExecutionContext::GetTargetPtr(), and lldb_private::ExecutionContext::GetTargetRef().
Referenced by lldb_private::StackFrame::Disassemble(), Disassemble(), lldb_private::CommandObjectDisassemble::DoExecute(), and lldb_private::StackFrame::GetStatus().
|
static |
Definition at line 556 of file Disassembler.cpp.
References lldb_private::Disassembler::Limit::Bytes, DEFAULT_DISASM_BYTE_SIZE, Disassemble(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::Symbol::GetAddressRef(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressRange::GetByteSize(), lldb_private::Symbol::GetByteSize(), lldb_private::StackFrame::GetFrameCodeAddress(), lldb_private::StackFrame::GetSymbolContext(), lldb_private::Address::IsValid(), lldb_private::AddressRange::SetByteSize(), lldb_private::SymbolContext::symbol, lldb_private::Disassembler::Limit::value, and lldb_private::Symbol::ValueIsAddress().
|
static |
Definition at line 149 of file Disassembler.cpp.
References FindPlugin(), lldb_private::ArchSpec::GetAddressByteSize(), and lldb_private::ArchSpec::GetByteOrder().
Referenced by lldb::SBTarget::GetInstructionsWithFlavor(), UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly(), and lldb::SBTarget::ReadInstructions().
|
static |
Definition at line 123 of file Disassembler.cpp.
References FindPluginForTarget(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressRange::GetByteSize(), and lldb_private::Address::IsValid().
Referenced by lldb_private::Process::AdvanceAddressToNextBranchInstruction(), CalculateDisass(), lldb_private::Function::GetInstructions(), lldb_private::Symbol::GetInstructions(), lldb::SBFunction::GetInstructions(), lldb::SBSymbol::GetInstructions(), lldb_private::ThreadPlanStepRange::GetInstructionsForAddress(), GetPtrauthInstructionInfo(), lldb_private::DynamicLoaderWindowsDYLD::GetStepThroughTrampolinePlan(), lldb_private::StackFrame::GuessValueForAddress(), lldb_private::StackFrame::GuessValueForRegisterAndOffset(), and lldb::SBTarget::ReadInstructions().
|
inlinestaticprotected |
Definition at line 540 of file Disassembler.h.
References lldb_private::Disassembler::SourceLine::column, lldb_private::LineEntry::column, ElideMixedSourceAndDisassemblyLine(), lldb_private::Disassembler::SourceLine::file, lldb_private::LineEntry::GetFile(), lldb_private::Disassembler::SourceLine::line, and lldb_private::LineEntry::line.
|
staticprotected |
Definition at line 244 of file Disassembler.cpp.
References lldb_private::Mangled::ePreferDemangledWithoutArguments, error(), lldb_private::OptionValue::eTypeRegex, lldb_private::RegularExpression::Execute(), lldb_private::OptionValue::GetAsRegex(), lldb_private::ConstString::GetCString(), lldb_private::OptionValueRegex::GetCurrentValue(), lldb_private::SymbolContext::GetFunctionName(), lldb_private::ExecutionContext::GetTargetSP(), lldb_private::ExecutionContext::GetThreadSP(), lldb_private::Disassembler::SourceLine::line, and lldb_private::SymbolContext::symbol.
Referenced by ElideMixedSourceAndDisassemblyLine(), and PrintInstructions().
|
static |
Definition at line 58 of file Disassembler.cpp.
References lldb_private::ArchSpec::GetArchitectureName(), lldb_private::PluginManager::GetDisassemblerCreateCallbackAtIndex(), lldb_private::PluginManager::GetDisassemblerCreateCallbackForPluginName(), and LLDB_SCOPED_TIMERF.
Referenced by DisassembleBytes(), lldb_private::IRExecutionUnit::DisassembleFunction(), lldb_private::CommandObjectDisassemble::DoExecute(), DumpInstructions(), FindPluginForTarget(), lldb_private::ThreadPlanAssemblyTracer::GetDisassembler(), and lldb_private::ArchitectureMips::GetInstructionAtAddress().
|
static |
Definition at line 86 of file Disassembler.cpp.
References FindPlugin(), lldb_private::TargetProperties::GetDisassemblyCPU(), lldb_private::TargetProperties::GetDisassemblyFeatures(), lldb_private::TargetProperties::GetDisassemblyFlavor(), and lldb_private::ArchSpec::GetTriple().
Referenced by Disassemble(), and DisassembleRange().
|
pure virtual |
Implemented in DisassemblerLLVMC.
|
inline |
Definition at line 475 of file Disassembler.h.
References m_arch.
|
inline |
Definition at line 477 of file Disassembler.h.
References m_flavor.
|
staticprotected |
Definition at line 200 of file Disassembler.cpp.
References lldb_private::Disassembler::SourceLine::column, lldb_private::SupportFile::eEqualFileSpecAndChecksumIfSet, lldb_private::Disassembler::SourceLine::file, lldb_private::LineEntry::file_sp, lldb_private::SymbolContext::function, lldb_private::Function::GetStartLineSourceInfo(), lldb_private::LineEntry::IsValid(), lldb_private::Disassembler::SourceLine::line, lldb_private::SymbolContext::line_entry, and lldb_private::LineEntry::original_file_sp.
Referenced by PrintInstructions().
InstructionList & Disassembler::GetInstructionList | ( | ) |
Definition at line 1158 of file Disassembler.cpp.
References m_instruction_list.
Referenced by lldb_private::ThreadPlanAssemblyTracer::Log(), and PrintInstructions().
const InstructionList & Disassembler::GetInstructionList | ( | ) | const |
Definition at line 1162 of file Disassembler.cpp.
References m_instruction_list.
|
privatedelete |
size_t Disassembler::ParseInstructions | ( | Target & | target, |
Address | address, | ||
Limit | limit, | ||
Stream * | error_strm_ptr, | ||
bool | force_live_memory = false |
||
) |
Definition at line 1095 of file Disassembler.cpp.
References lldb_private::InstructionList::Clear(), DecodeInstructions(), error(), lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::ArchSpec::GetByteOrder(), lldb_private::ArchSpec::GetMaximumOpcodeByteSize(), lldb_private::Disassembler::Limit::Instructions, lldb_private::Address::IsValid(), lldb_private::Disassembler::Limit::kind, LLDB_INVALID_ADDRESS, m_arch, m_instruction_list, lldb_private::Stream::Printf(), lldb_private::Target::ReadMemory(), ResolveAddress(), UINT32_MAX, and lldb_private::Disassembler::Limit::value.
void Disassembler::PrintInstructions | ( | Debugger & | debugger, |
const ArchSpec & | arch, | ||
const ExecutionContext & | exe_ctx, | ||
bool | mixed_source_and_assembly, | ||
uint32_t | num_mixed_context_lines, | ||
uint32_t | options, | ||
Stream & | strm | ||
) |
Definition at line 286 of file Disassembler.cpp.
References AddLineToSourceLineTables(), lldb_private::SymbolContext::Clear(), lldb_private::Disassembler::SourceLine::column, lldb_private::LineEntry::column, lldb_private::SymbolContext::comp_unit, lldb_private::AddressRange::ContainsFileAddress(), lldb_private::Disassembler::SourceLinesToDisplay::current_source_line, lldb_private::SourceManager::DisplaySourceLinesWithLineNumbers(), lldb_private::Instruction::Dump(), lldb_private::SupportFile::eEqualFileSpecAndChecksumIfSet, ElideMixedSourceAndDisassemblyLine(), lldb_private::Stream::EOL(), eOptionMarkPCSourceLine, eOptionShowBytes, eOptionShowControlFlowKind, lldb_private::Disassembler::SourceLine::file, lldb_private::LineEntry::file_sp, lldb_private::Debugger::FormatDisassemblerAddress(), lldb_private::SymbolContext::function, lldb_private::Instruction::GetAddress(), lldb_private::SymbolContext::GetAddressRange(), lldb_private::Target::GetDebugger(), lldb_private::Debugger::GetDisassemblyFormat(), lldb_private::LineEntry::GetFile(), lldb_private::StackFrame::GetFrameCodeAddress(), lldb_private::ExecutionContext::GetFramePtr(), GetFunctionDeclLineEntry(), lldb_private::InstructionList::GetInstructionAtIndex(), GetInstructionList(), lldb_private::InstructionList::GetMaxOpcocdeByteSize(), lldb_private::Address::GetModule(), lldb_private::InstructionList::GetSize(), lldb_private::StreamString::GetSizeOfLastLine(), lldb_private::Debugger::GetSourceManager(), lldb_private::Function::GetStartLineSourceInfo(), lldb_private::ExecutionContext::GetTargetRef(), lldb_private::ExecutionContext::GetTargetSP(), lldb_private::ExecutionContext::HasTargetScope(), lldb_private::LineEntry::IsValid(), lldb_private::Disassembler::SourceLine::line, lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::Disassembler::SourceLinesToDisplay::lines, lldb_private::LineEntry::original_file_sp, lldb_private::FormatEntity::Parse(), lldb_private::Disassembler::SourceLinesToDisplay::print_source_context_end_eol, and lldb_private::SymbolContext::symbol.
|
protected |
Definition at line 550 of file Disassembler.h.
Referenced by Disassembler(), GetArchitecture(), and ParseInstructions().
|
protected |
Definition at line 552 of file Disassembler.h.
Referenced by Disassembler(), DisassemblerLLVMC::DisassemblerLLVMC(), and GetFlavor().
|
protected |
Definition at line 551 of file Disassembler.h.
Referenced by DisassemblerLLVMC::DecodeInstructions(), GetInstructionList(), and ParseInstructions().