Go to the documentation of this file.
9 #ifndef LLDB_CORE_DISASSEMBLER_H
10 #define LLDB_CORE_DISASSEMBLER_H
28 #include "llvm/ADT/StringRef.h"
54 class SymbolContextList;
147 size_t max_address_text_size);
153 virtual bool IsLoad() = 0;
244 namespace OperandMatchers {
311 bool *found_calls)
const;
320 void Append(lldb::InstructionSP &inst_sp);
322 void Dump(
Stream *s,
bool show_address,
bool show_bytes,
357 void SetOpcode(
size_t opcode_size,
void *opcode_data);
368 class Disassembler :
public std::enable_shared_from_this<Disassembler>,
391 static lldb::DisassemblerSP
398 const char *plugin_name);
406 const char *plugin_name,
410 bool force_live_memory =
false);
412 static lldb::DisassemblerSP
414 const char *flavor,
const Address &start,
const void *bytes,
415 size_t length,
uint32_t max_num_instructions,
416 bool data_from_file);
419 const char *plugin_name,
const char *flavor,
421 Limit limit,
bool mixed_source_and_assembly,
434 bool mixed_source_and_assembly,
440 bool force_live_memory =
false);
445 size_t num_instructions,
bool append,
446 bool data_from_file) = 0;
457 const char *flavor) = 0;
502 std::map<
FileSpec, std::set<uint32_t>> &source_lines_seen);
540 #endif // LLDB_CORE_DISASSEMBLER_H
size_t current_source_line
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, SourceLine &line)
size_t(* ReadMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
FileSpec file
The source file, possibly mapped by the target.source-map setting.
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
SourceLinesToDisplay()=default
uint32_t GetData(DataExtractor &data)
std::function< bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm)
const char * GetOperands(const ExecutionContext *exe_ctx)
std::function< bool(const Instruction::Operand &)> MatchOpType(Instruction::Operand::Type type)
AddressClass GetAddressClass()
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name)
std::string m_description
virtual size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset)=0
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target)
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
AddressClass m_address_class
std::vector< Operand > m_children
enum lldb_private::Disassembler::Limit::@6 kind
std::string m_opcode_name
virtual void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx)=0
static lldb::DisassemblerSP DisassembleBytes(const ArchSpec &arch, const char *plugin_name, const char *flavor, const Address &start, const void *bytes, size_t length, uint32_t max_num_instructions, bool data_from_file)
const Opcode & GetOpcode() const
bool DumpEmulation(const ArchSpec &arch)
Instruction(const Address &address, AddressClass addr_class=AddressClass::eInvalid)
bool print_source_context_end_eol
std::function< bool(const Instruction::Operand &)> FetchRegOp(ConstString ®)
static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, const char *plugin_name, const char *flavor, Target &target, const AddressRange &disasm_range, bool force_live_memory=false)
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.
std::function< bool(const Instruction::Operand &)> MatchBinaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> left, std::function< bool(const Instruction::Operand &)> right)
lldb::OptionValueSP ReadArray(FILE *in_file, Stream *out_stream, OptionValue::Type data_type)
size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) override
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
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)
const Address & GetAddress() const
static bool Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name, const char *flavor, 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)
virtual bool HasDelaySlot()
void CalculateMnemonicOperandsAndCommentIfNeeded(const ExecutionContext *exe_ctx)
const char * GetComment(const ExecutionContext *exe_ctx)
static Operand BuildDereference(const Operand &ref)
bool operator==(const SourceLine &rhs) const
std::function< bool(const Instruction::Operand &)> MatchImmOp(int64_t imm)
uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls, bool *found_calls) const
Get the index of the next branch instruction.
bool IsAuthenticated() override
InstructionList m_instruction_list
static Operand BuildImmediate(lldb::addr_t imm, bool neg)
uint32_t GetMaxOpcocdeByteSize() const
string(SUBSTRING ${p} 10 -1 pStripped) if($
size_t(* WriteMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
uint16_t column
The column number of the source line, or zero if there is no column information.
static Operand BuildRegister(ConstString &r)
const Disassembler & operator=(const Disassembler &)=delete
uint32_t line
The source line number, or zero if there is no line number information.
collection::iterator iterator
#define LLDB_INVALID_LINE_NUMBER
static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc)
std::function< bool(const Instruction::Operand &)> MatchRegOp(const RegisterInfo &info)
collection::const_iterator const_iterator
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, LineEntry &line)
static Operand BuildProduct(const Operand &lhs, const Operand &rhs)
bool DoesBranch() override
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx) override
std::function< bool(const Instruction::Operand &)> MatchUnaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> child)
std::vector< lldb::InstructionSP > collection
const char * GetMnemonic(const ExecutionContext *exe_ctx)
const ArchSpec & GetArchitecture() const
collection m_instructions
bool m_calculated_strings
enum lldb_private::Instruction::Operand::Type m_type
virtual void SetDescription(llvm::StringRef)
static void AddLineToSourceLineTables(SourceLine &line, std::map< FileSpec, std::set< uint32_t >> &source_lines_seen)
lldb::InstructionSP GetInstructionAtAddress(const Address &addr)
Get the instruction at the given address.
virtual bool DoesBranch()=0
virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor)=0
A class that represents a running process on the host machine.
~PseudoInstruction() override
bool operator!=(const SourceLine &rhs) const
InstructionList & GetInstructionList()
lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream *out_stream)
virtual bool ParseOperands(llvm::SmallVectorImpl< Operand > &operands)
void SetOpcode(size_t opcode_size, void *opcode_data)
void SetAddress(const Address &addr)
void Dump(Stream *s, bool show_address, bool show_bytes, const ExecutionContext *exe_ctx)
const char * GetFlavor() const
static lldb::DisassemblerSP FindPluginForTarget(const Target &target, const ArchSpec &arch, const char *flavor, const char *plugin_name)
void Append(lldb::InstructionSP &inst_sp)
const PseudoInstruction & operator=(const PseudoInstruction &)=delete
uint32_t GetIndexOfInstructionAtAddress(const Address &addr)
void SetDescription(llvm::StringRef description) override
size_t ParseInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false)
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)
virtual bool IsAuthenticated()=0
@ eOptionMarkPCSourceLine
Disassembler(const ArchSpec &arch, const char *flavor)
virtual bool TestEmulation(Stream *stream, const char *test_file_name)
bool(* ReadRegisterCallback)(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
std::vector< SourceLine > lines
bool HasDelaySlot() override