44#include "llvm/Support/Compiler.h"
45#include "llvm/TargetParser/Triple.h"
53#define DEFAULT_DISASM_BYTE_SIZE 32
60 const char *plugin_name) {
69 if (create_callback) {
70 if (
auto disasm_sp = create_callback(arch, flavor))
74 for (uint32_t idx = 0;
78 if (
auto disasm_sp = create_callback(arch, flavor))
88 const char *plugin_name) {
89 if (flavor ==
nullptr) {
93 if (arch.
GetTriple().getArch() == llvm::Triple::x86 ||
94 arch.
GetTriple().getArch() == llvm::Triple::x86_64)
112 if (is_resolved && resolved_addr.
IsValid())
113 return resolved_addr;
119 const ArchSpec &arch,
const char *plugin_name,
const char *flavor,
133 const size_t bytes_disassembled = disasm_sp->ParseInstructions(
134 target, range.
GetBaseAddress(), {Limit::Bytes, range.GetByteSize()},
135 nullptr, force_live_memory);
136 if (bytes_disassembled == 0)
144 const char *flavor,
const Address &start,
145 const void *src,
size_t src_len,
146 uint32_t num_instructions,
bool data_from_file) {
159 (void)disasm_sp->DecodeInstructions(start, data, 0, num_instructions,
false,
165 const char *plugin_name,
const char *flavor,
168 bool mixed_source_and_assembly,
169 uint32_t num_mixed_context_lines,
170 uint32_t options,
Stream &strm) {
179 const bool force_live_memory =
true;
180 size_t bytes_disassembled = disasm_sp->ParseInstructions(
181 exe_ctx.
GetTargetRef(), address, limit, &strm, force_live_memory);
182 if (bytes_disassembled == 0)
185 disasm_sp->PrintInstructions(debugger, arch, exe_ctx,
186 mixed_source_and_assembly,
187 num_mixed_context_lines, options, strm);
201 uint32_t func_decl_line;
204 if (func_decl_file != prologue_end_line.
file &&
209 decl_line.
file = func_decl_file;
210 decl_line.
line = func_decl_line;
219 std::map<
FileSpec, std::set<uint32_t>> &source_lines_seen) {
221 auto source_lines_seen_pos = source_lines_seen.find(line.
file);
222 if (source_lines_seen_pos == source_lines_seen.end()) {
223 std::set<uint32_t> lines;
224 lines.insert(line.
line);
225 source_lines_seen.emplace(line.
file, lines);
227 source_lines_seen_pos->second.insert(line.
line);
246 avoid_regex = thread_sp->GetSymbolsToAvoidRegexp();
251 OptionValueSP value_sp = target_sp->GetDebugger().GetPropertyValue(
252 &exe_ctx,
"target.process.thread.step-avoid-regexp",
error);
261 if (avoid_regex && sc.
symbol !=
nullptr) {
262 const char *function_name =
265 if (function_name && avoid_regex->
Execute(function_name)) {
276 bool mixed_source_and_assembly,
277 uint32_t num_mixed_context_lines,
278 uint32_t options,
Stream &strm) {
282 const uint32_t max_opcode_byte_size =
287 const Address *pc_addr_ptr =
nullptr;
297 const uint32_t scope =
298 eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
299 const bool use_inline_block_range =
false;
308 disassembly_format = &format;
319 std::map<FileSpec, std::set<uint32_t>> source_lines_seen;
320 Symbol *previous_symbol =
nullptr;
322 size_t address_text_size = 0;
323 for (
size_t i = 0; i < num_instructions_found; ++i) {
329 const SymbolContextItem resolve_mask = eSymbolContextFunction |
330 eSymbolContextSymbol |
331 eSymbolContextLineEntry;
332 uint32_t resolved_mask =
333 module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
337 &exe_ctx, &addr, strmstr);
339 if (cur_line > address_text_size)
340 address_text_size = cur_line;
350 if (sc.
symbol != previous_symbol) {
370 previous_symbol =
nullptr;
372 for (
size_t i = 0; i < num_instructions_found; ++i) {
377 const bool inst_is_at_pc = pc_addr_ptr && addr == *pc_addr_ptr;
384 uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(
385 addr, eSymbolContextEverything, sc);
387 if (mixed_source_and_assembly) {
392 if (previous_symbol != sc.
symbol) {
397 if (previous_symbol !=
nullptr)
400 previous_symbol = sc.
symbol;
404 prologue_end_line)) {
406 uint32_t func_decl_line;
409 if (func_decl_file == prologue_end_line.
file ||
414 for (uint32_t lineno = func_decl_line;
415 lineno <= prologue_end_line.
line; lineno++) {
417 this_line.
file = func_decl_file;
418 this_line.
line = lineno;
419 source_lines_to_display.
lines.push_back(this_line);
423 if (source_lines_to_display.
lines.size() > 0)
425 source_lines_to_display.
lines.size() - 1;
430 current_source_line_range);
437 current_source_line_range);
451 if (this_line != previous_line) {
453 std::vector<uint32_t> previous_lines;
455 i < num_mixed_context_lines &&
456 (this_line.
line - num_mixed_context_lines) > 0;
459 this_line.
line - num_mixed_context_lines + i;
460 auto pos = source_lines_seen.find(this_line.
file);
461 if (pos != source_lines_seen.end()) {
462 if (pos->second.count(line) == 1) {
463 previous_lines.clear();
465 previous_lines.push_back(line);
469 for (
size_t i = 0; i < previous_lines.size(); i++) {
471 previous_line.
file = this_line.
file;
472 previous_line.
line = previous_lines[i];
473 auto pos = source_lines_seen.find(previous_line.
file);
474 if (pos != source_lines_seen.end()) {
475 pos->second.insert(previous_line.
line);
477 source_lines_to_display.
lines.push_back(previous_line);
480 source_lines_to_display.
lines.push_back(this_line);
482 source_lines_to_display.
lines.size() - 1;
484 for (uint32_t i = 0; i < num_mixed_context_lines; i++) {
487 next_line.
line = this_line.
line + i + 1;
488 auto pos = source_lines_seen.find(next_line.
file);
489 if (pos != source_lines_seen.end()) {
490 if (pos->second.count(next_line.
line) == 1)
492 pos->second.insert(next_line.
line);
494 source_lines_to_display.
lines.push_back(next_line);
497 previous_line = this_line;
507 if (source_lines_to_display.
lines.size() > 0) {
509 for (
size_t idx = 0; idx < source_lines_to_display.
lines.size();
512 const char *line_highlight =
"";
514 line_highlight =
"->";
516 line_highlight =
"**";
526 const bool show_control_flow_kind =
528 inst->
Dump(&strm, max_opcode_byte_size,
true, show_bytes,
529 show_control_flow_kind, &exe_ctx, &sc, &prev_sc,
nullptr,
557 if (limit.
value == 0)
560 return Disassemble(debugger, arch,
nullptr,
nullptr, frame,
565 : m_address(address), m_address_class(addr_class), m_opcode(),
566 m_calculated_strings(false) {}
578 switch (instruction_control_flow_kind) {
598 llvm_unreachable(
"Fully covered switch above!");
602 bool show_address,
bool show_bytes,
603 bool show_control_flow_kind,
608 size_t max_address_text_size) {
609 size_t opcode_column_width = 7;
610 const size_t operand_column_width = 25;
627 if (max_opcode_byte_size > 0)
634 if (max_opcode_byte_size > 0)
641 if (show_control_flow_kind) {
645 instruction_control_flow_kind));
648 bool show_color =
false;
651 show_color = target_sp->GetDebugger().GetUseColor();
655 const std::string &opcode_name =
674 opcode_pos + opcode_column_width + operand_column_width,
' ');
682 std::unique_ptr<EmulateInstruction> insn_emulator_up(
684 if (insn_emulator_up) {
686 return insn_emulator_up->EvaluateInstruction(0);
706 auto option_value_sp = std::make_shared<OptionValueArray>(1u << data_type);
710 if (!fgets(buffer, 1023, in_file)) {
712 "Instruction::ReadArray: Error reading file (fgets).\n");
713 option_value_sp.reset();
714 return option_value_sp;
717 std::string line(buffer);
719 size_t len = line.size();
720 if (line[len - 1] ==
'\n') {
721 line[len - 1] =
'\0';
722 line.resize(len - 1);
725 if ((line.size() == 1) && line[0] ==
']') {
733 llvm::StringRef(
"^[ \t]*([^ \t]+)[ \t]*$"));
734 llvm::SmallVector<llvm::StringRef, 2> matches;
735 if (g_reg_exp.
Execute(line, &matches))
736 value = matches[1].str();
743 data_value_sp = std::make_shared<OptionValueUInt64>(0, 0);
744 data_value_sp->SetValueFromString(value);
748 data_value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
752 option_value_sp->GetAsArray()->InsertValue(idx, data_value_sp);
757 return option_value_sp;
764 auto option_value_sp = std::make_shared<OptionValueDictionary>();
765 static constexpr llvm::StringLiteral encoding_key(
"data_encoding");
770 if (!fgets(buffer, 1023, in_file)) {
772 "Instruction::ReadDictionary: Error reading file (fgets).\n");
773 option_value_sp.reset();
774 return option_value_sp;
778 std::string line(buffer);
780 size_t len = line.size();
781 if (line[len - 1] ==
'\n') {
782 line[len - 1] =
'\0';
783 line.resize(len - 1);
786 if ((line.size() == 1) && (line[0] ==
'}')) {
795 "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)[ \t]*$"));
797 llvm::SmallVector<llvm::StringRef, 3> matches;
799 bool reg_exp_success = g_reg_exp.
Execute(line, &matches);
802 if (reg_exp_success) {
803 key = matches[1].str();
804 value = matches[2].str();
806 out_stream.
Printf(
"Instruction::ReadDictionary: Failure executing "
807 "regular expression.\n");
808 option_value_sp.reset();
809 return option_value_sp;
815 assert(value.empty() ==
false);
816 assert(key.empty() ==
false);
818 if (value[0] ==
'{') {
819 assert(value.size() == 1);
823 option_value_sp.reset();
824 return option_value_sp;
826 }
else if (value[0] ==
'[') {
827 assert(value.size() == 1);
829 value_sp =
ReadArray(in_file, out_stream, data_type);
831 option_value_sp.reset();
832 return option_value_sp;
837 }
else if ((value[0] ==
'0') && (value[1] ==
'x')) {
838 value_sp = std::make_shared<OptionValueUInt64>(0, 0);
839 value_sp->SetValueFromString(value);
841 size_t len = value.size();
842 if ((value[0] ==
'"') && (value[len - 1] ==
'"'))
843 value = value.substr(1, len - 2);
844 value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
847 if (key == encoding_key) {
851 if (llvm::StringRef(value) ==
"uint32_t")
854 option_value_sp->GetAsDictionary()->SetValueForKey(key, value_sp,
859 return option_value_sp;
864 out_stream.
Printf(
"Instruction::TestEmulation: Missing file_name.");
870 "Instruction::TestEmulation: Attempt to open test file failed.");
875 if (!fgets(buffer, 255, test_file)) {
877 "Instruction::TestEmulation: Error reading first line of test file.\n");
882 if (strncmp(buffer,
"InstructionEmulationState={", 27) != 0) {
883 out_stream.
Printf(
"Instructin::TestEmulation: Test file does not contain "
884 "emulation state dictionary\n");
893 if (!data_dictionary_sp) {
895 "Instruction::TestEmulation: Error reading Dictionary Object.\n");
904 static constexpr llvm::StringLiteral description_key(
"assembly_string");
905 static constexpr llvm::StringLiteral triple_key(
"triple");
910 out_stream.
Printf(
"Instruction::TestEmulation: Test file does not "
911 "contain description string.\n");
915 SetDescription(value_sp->GetValueAs<llvm::StringRef>().value_or(
""));
920 "Instruction::TestEmulation: Test file does not contain triple.\n");
926 llvm::Triple(value_sp->GetValueAs<llvm::StringRef>().value_or(
"")));
928 bool success =
false;
929 std::unique_ptr<EmulateInstruction> insn_emulator_up(
931 if (insn_emulator_up)
933 insn_emulator_up->TestEmulation(out_stream, arch, data_dictionary);
936 out_stream.
Printf(
"Emulation test succeeded.");
938 out_stream.
Printf(
"Emulation test failed.");
944 const ArchSpec &arch, uint32_t evaluate_options,
void *baton,
949 std::unique_ptr<EmulateInstruction> insn_emulator_up(
951 if (insn_emulator_up) {
952 insn_emulator_up->SetBaton(baton);
953 insn_emulator_up->SetCallbacks(read_mem_callback, write_mem_callback,
954 read_reg_callback, write_reg_callback);
956 return insn_emulator_up->EvaluateInstruction(evaluate_options);
973 uint32_t max_inst_size = 0;
974 collection::const_iterator pos, end;
977 uint32_t inst_size = (*pos)->GetOpcode().GetByteSize();
978 if (max_inst_size < inst_size)
979 max_inst_size = inst_size;
981 return max_inst_size;
999 bool show_control_flow_kind,
1002 collection::const_iterator pos, begin, end;
1007 disassembly_format =
1011 disassembly_format = &format;
1015 pos != end; ++pos) {
1018 (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes,
1019 show_control_flow_kind, exe_ctx,
nullptr,
nullptr,
1020 disassembly_format, 0);
1034 bool *found_calls)
const {
1040 *found_calls =
false;
1041 for (
size_t i = start; i < num_instructions; i++) {
1045 *found_calls =
true;
1060 for (
size_t i = 0; i < num_instructions; i++) {
1079 bool force_live_memory) {
1090 auto data_sp = std::make_shared<DataBufferHeap>(byte_size,
'\0');
1094 const size_t bytes_read =
1095 target.
ReadMemory(start, data_sp->GetBytes(), data_sp->GetByteSize(),
1096 error, force_live_memory, &load_addr);
1099 if (bytes_read == 0) {
1100 if (error_strm_ptr) {
1101 if (
const char *error_cstr =
error.AsCString())
1102 error_strm_ptr->
Printf(
"error: %s\n", error_cstr);
1107 if (bytes_read != data_sp->GetByteSize())
1108 data_sp->SetByteSize(bytes_read);
1114 false, data_from_file);
1121 if (flavor ==
nullptr)
1129 std::string thumb_arch_name(arch.
GetTriple().getArchName().str());
1131 if (thumb_arch_name.size() > 3) {
1132 thumb_arch_name.erase(0, 3);
1133 thumb_arch_name.insert(0,
"thumb");
1180 switch (opcode_size) {
1182 uint8_t value8 = *((uint8_t *)opcode_data);
1187 uint16_t value16 = *((uint16_t *)opcode_data);
1192 uint32_t value32 = *((uint32_t *)opcode_data);
1197 uint64_t value64 = *((uint64_t *)opcode_data);
1220 ret.
m_type = Type::Immediate;
1228 ret.
m_type = Type::Immediate;
1242 ret.
m_type = Type::Dereference;
1258 ret.
m_type = Type::Product;
1269 return (base(op) && op.m_children.size() == 2 &&
1270 ((left(op.m_children[0]) && right(op.m_children[1])) ||
1271 (left(op.m_children[1]) && right(op.m_children[0]))));
1280 return (base(op) && op.m_children.size() == 1 && child(op.m_children[0]));
1299 reg = op.m_register;
1308 ((op.m_negative && op.m_immediate == (uint64_t)-imm) ||
1309 (!op.m_negative && op.m_immediate == (uint64_t)imm)));
1319 if (op.m_negative) {
1320 imm = -((int64_t)op.m_immediate);
1322 imm = ((int64_t)op.m_immediate);
static llvm::raw_ostream & error(Stream &strm)
static Address ResolveAddress(Target &target, const Address &addr)
#define DEFAULT_DISASM_BYTE_SIZE
#define LLDB_SCOPED_TIMERF(...)
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool ContainsFileAddress(const Address &so_addr) const
Check if a section offset address is contained in this range.
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
A section + offset based address class.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
bool IsSectionOffset() const
Check if an address is section offset.
AddressClass GetAddressClass() const
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
llvm::Triple & GetTriple()
Architecture triple accessor.
bool IsAlwaysThumbInstructions() const
Detect whether this architecture uses thumb code exclusively.
bool SetTriple(const llvm::Triple &triple)
Architecture triple setter.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
uint32_t GetMaximumOpcodeByteSize() const
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
A class to manage flag bits.
SourceManager & GetSourceManager()
static bool FormatDisassemblerAddress(const FormatEntity::Entry *format, const SymbolContext *sc, const SymbolContext *prev_sc, const ExecutionContext *exe_ctx, const Address *addr, Stream &s)
const FormatEntity::Entry * GetDisassemblyFormat() const
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)
size_t ParseInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false)
InstructionList m_instruction_list
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)
@ eOptionMarkPCSourceLine
@ eOptionShowControlFlowKind
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)
Disassembler(const ArchSpec &arch, const char *flavor)
static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc)
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()
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name)
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)
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)
static lldb::DisassemblerSP FindPluginForTarget(const Target &target, const ArchSpec &arch, const char *flavor, const char *plugin_name)
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue ®_value)
size_t(* WriteMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
size_t(* ReadMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
bool(* ReadRegisterCallback)(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue ®_value)
static EmulateInstruction * FindPlugin(const ArchSpec &arch, InstructionType supported_inst_type, const char *plugin_name)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
const lldb::ThreadSP & GetThreadSP() const
Get accessor to get the thread shared pointer.
bool HasTargetScope() const
Returns true the ExecutionContext object contains a valid target.
Target & GetTargetRef() const
Returns a reference to the target object.
static FileSystem & Instance()
FILE * Fopen(const char *path, const char *mode)
Wraps ::fopen in a platform-independent way.
const AddressRange & GetAddressRange()
void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no)
Find the file and line number of the source location of the start of the function.
void Append(lldb::InstructionSP &inst_sp)
uint32_t GetIndexOfInstructionAtAddress(const Address &addr)
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target)
collection m_instructions
lldb::InstructionSP GetInstructionAtAddress(const Address &addr)
Get the instruction at the given address.
void Dump(Stream *s, bool show_address, bool show_bytes, bool show_control_flow_kind, const ExecutionContext *exe_ctx)
uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls, bool *found_calls) const
Get the index of the next branch instruction.
uint32_t GetMaxOpcocdeByteSize() const
uint32_t GetData(DataExtractor &data)
Instruction(const Address &address, AddressClass addr_class=AddressClass::eInvalid)
virtual bool HasDelaySlot()
AddressClass m_address_class
static const char * GetNameForInstructionControlFlowKind(lldb::InstructionControlFlowKind instruction_control_flow_kind)
std::string m_markup_mnemonics
virtual bool TestEmulation(Stream &stream, const char *test_file_name)
virtual lldb::InstructionControlFlowKind GetControlFlowKind(const ExecutionContext *exe_ctx)
void CalculateMnemonicOperandsAndCommentIfNeeded(const ExecutionContext *exe_ctx)
lldb::OptionValueSP ReadArray(FILE *in_file, Stream &out_stream, OptionValue::Type data_type)
const Address & GetAddress() const
bool DumpEmulation(const ArchSpec &arch)
lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream &out_stream)
virtual void SetDescription(llvm::StringRef)
const Opcode & GetOpcode() const
std::string m_opcode_name
std::string m_markup_opcode_name
AddressClass GetAddressClass()
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.
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)
@ ePreferDemangledWithoutArguments
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const
void SetOpcode16(uint16_t inst, lldb::ByteOrder order)
int Dump(Stream *s, uint32_t min_byte_width)
uint32_t GetByteSize() const
void SetOpcode64(uint64_t inst, lldb::ByteOrder order)
Opcode::Type GetType() const
void SetOpcode8(uint8_t inst, lldb::ByteOrder order)
uint32_t GetData(DataExtractor &data) const
void SetOpcode32(uint32_t inst, lldb::ByteOrder order)
lldb::OptionValueSP GetValueForKey(llvm::StringRef key) const
const RegularExpression * GetCurrentValue() const
OptionValueDictionary * GetAsDictionary()
OptionValueRegex * GetAsRegex()
static DisassemblerCreateInstance GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name)
static DisassemblerCreateInstance GetDisassemblerCreateCallbackAtIndex(uint32_t idx)
std::string m_description
void SetOpcode(size_t opcode_size, void *opcode_data)
void SetDescription(llvm::StringRef description) override
bool IsAuthenticated() override
bool HasDelaySlot() override
size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) override
~PseudoInstruction() override
bool DoesBranch() override
bool Execute(llvm::StringRef string, llvm::SmallVectorImpl< llvm::StringRef > *matches=nullptr) const
Execute a regular expression match using the compiled regular expression that is already in this obje...
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, bool allow_section_end=false) const
size_t DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line, uint32_t column, uint32_t context_before, uint32_t context_after, const char *current_line_cstr, Stream *s, const SymbolContextList *bp_locs=nullptr)
This base class provides an interface to stack frames.
const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
const Address & GetFrameCodeAddress()
Get an Address for the current pc value in this StackFrame.
size_t GetSizeOfLastLine() const
llvm::StringRef GetString() const
void FillLastLineToColumn(uint32_t column, char fill_char)
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
ConstString GetFunctionName(Mangled::NamePreference preference=Mangled::ePreferDemangled) const
Find a name of the innermost function for the symbol context.
CompileUnit * comp_unit
The CompileUnit for a given query.
void Clear(bool clear_target)
Clear the object's state.
bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const
Get the address range contained within a symbol context.
Symbol * symbol
The Symbol for a given query.
LineEntry line_entry
The LineEntry for a given query.
bool ValueIsAddress() const
Address & GetAddressRef()
lldb::addr_t GetByteSize() const
const char * GetDisassemblyFlavor() const
SectionLoadList & GetSectionLoadList()
size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr)
const ModuleList & GetImages() const
Get accessor for the images for this process.
#define LLDB_INVALID_ADDRESS
std::function< bool(const Instruction::Operand &)> MatchRegOp(const RegisterInfo &info)
std::function< bool(const Instruction::Operand &)> FetchRegOp(ConstString ®)
std::function< bool(const Instruction::Operand &)> MatchImmOp(int64_t imm)
std::function< bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm)
std::function< bool(const Instruction::Operand &)> MatchOpType(Instruction::Operand::Type type)
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)
std::function< bool(const Instruction::Operand &)> MatchUnaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> child)
A class that represents a running process on the host machine.
lldb::DisassemblerSP(* DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor)
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Instruction > InstructionSP
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
InstructionControlFlowKind
Architecture-agnostic categorization of instructions for traversing the control flow of a trace.
@ eInstructionControlFlowKindReturn
The instruction is a near (function) return.
@ eInstructionControlFlowKindFarJump
The instruction is a jump-like far transfer.
@ eInstructionControlFlowKindOther
The instruction is something not listed below, i.e.
@ eInstructionControlFlowKindFarCall
The instruction is a call-like far transfer.
@ eInstructionControlFlowKindFarReturn
The instruction is a return-like far transfer.
@ eInstructionControlFlowKindUnknown
The instruction could not be classified.
@ eInstructionControlFlowKindJump
The instruction is a near unconditional jump.
@ eInstructionControlFlowKindCall
The instruction is a near (function) call.
@ eInstructionControlFlowKindCondJump
The instruction is a near conditional jump.
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
enum lldb_private::Disassembler::Limit::@6 kind
size_t current_source_line
std::vector< SourceLine > lines
bool print_source_context_end_eol
enum lldb_private::Instruction::Operand::Type m_type
static Operand BuildImmediate(lldb::addr_t imm, bool neg)
static Operand BuildDereference(const Operand &ref)
std::vector< Operand > m_children
static Operand BuildProduct(const Operand &lhs, const Operand &rhs)
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
static Operand BuildRegister(ConstString &r)
A line table entry class.
FileSpec original_file
The original source file, from debug info.
uint16_t column
The column number of the source line, or zero if there is no column information.
bool IsValid() const
Check if a line entry object is valid.
FileSpec file
The source file, possibly mapped by the target.source-map setting.
uint32_t line
The source line number, or zero if there is no line number information.
Every register is described in detail including its name, alternate name (optional),...
const char * alt_name
Alternate name of this register, can be NULL.
const char * name
Name of this register, can't be NULL.