44#include "llvm/Support/Compiler.h"
45#include "llvm/TargetParser/Triple.h"
53#define DEFAULT_DISASM_BYTE_SIZE 32
59 const char *flavor,
const char *cpu,
61 const char *plugin_name) {
70 if (create_callback) {
71 if (
auto disasm_sp = create_callback(arch, flavor, cpu, features))
75 for (uint32_t idx = 0;
79 if (
auto disasm_sp = create_callback(arch, flavor, cpu, features))
88 const char *cpu,
const char *features,
const char *plugin_name) {
93 if (arch.
GetTriple().getArch() == llvm::Triple::x86 ||
94 arch.
GetTriple().getArch() == llvm::Triple::x86_64)
102 return FindPlugin(arch, flavor, cpu, features, plugin_name);
117 if (is_resolved && resolved_addr.
IsValid())
118 return resolved_addr;
124 const ArchSpec &arch,
const char *plugin_name,
const char *flavor,
125 const char *cpu,
const char *features,
Target &target,
134 target, arch, flavor, cpu, features, plugin_name);
139 const size_t bytes_disassembled = disasm_sp->ParseInstructions(
140 target, range.
GetBaseAddress(), {Limit::Bytes, range.GetByteSize()},
141 nullptr, force_live_memory);
142 if (bytes_disassembled == 0)
150 const char *flavor,
const char *cpu,
151 const char *features,
const Address &start,
152 const void *src,
size_t src_len,
153 uint32_t num_instructions,
bool data_from_file) {
166 (void)disasm_sp->DecodeInstructions(start, data, 0, num_instructions,
false,
172 const char *plugin_name,
const char *flavor,
173 const char *cpu,
const char *features,
176 bool mixed_source_and_assembly,
177 uint32_t num_mixed_context_lines,
178 uint32_t options,
Stream &strm) {
183 exe_ctx.
GetTargetRef(), arch, flavor, cpu, features, plugin_name));
187 const bool force_live_memory =
true;
188 size_t bytes_disassembled = disasm_sp->ParseInstructions(
189 exe_ctx.
GetTargetRef(), address, limit, &strm, force_live_memory);
190 if (bytes_disassembled == 0)
193 disasm_sp->PrintInstructions(debugger, arch, exe_ctx,
194 mixed_source_and_assembly,
195 num_mixed_context_lines, options, strm);
209 uint32_t func_decl_line;
212 if (!func_decl_file_sp)
214 if (!func_decl_file_sp->Equal(*prologue_end_line.
file_sp,
221 decl_line.
file = func_decl_file_sp->GetSpecOnly();
222 decl_line.
line = func_decl_line;
231 std::map<
FileSpec, std::set<uint32_t>> &source_lines_seen) {
233 auto source_lines_seen_pos = source_lines_seen.find(line.
file);
234 if (source_lines_seen_pos == source_lines_seen.end()) {
235 std::set<uint32_t> lines;
236 lines.insert(line.
line);
237 source_lines_seen.emplace(line.
file, lines);
239 source_lines_seen_pos->second.insert(line.
line);
258 avoid_regex = thread_sp->GetSymbolsToAvoidRegexp();
263 OptionValueSP value_sp = target_sp->GetDebugger().GetPropertyValue(
264 &exe_ctx,
"target.process.thread.step-avoid-regexp",
error);
273 if (avoid_regex && sc.
symbol !=
nullptr) {
274 const char *function_name =
277 if (function_name && avoid_regex->
Execute(function_name)) {
288 bool mixed_source_and_assembly,
289 uint32_t num_mixed_context_lines,
290 uint32_t options,
Stream &strm) {
294 const uint32_t max_opcode_byte_size =
299 const Address *pc_addr_ptr =
nullptr;
309 const uint32_t scope =
310 eSymbolContextLineEntry | eSymbolContextFunction | eSymbolContextSymbol;
311 const bool use_inline_block_range =
false;
320 disassembly_format = &format;
331 std::map<FileSpec, std::set<uint32_t>> source_lines_seen;
332 Symbol *previous_symbol =
nullptr;
334 size_t address_text_size = 0;
335 for (
size_t i = 0; i < num_instructions_found; ++i) {
341 const SymbolContextItem resolve_mask = eSymbolContextFunction |
342 eSymbolContextSymbol |
343 eSymbolContextLineEntry;
344 uint32_t resolved_mask =
345 module_sp->ResolveSymbolContextForAddress(addr, resolve_mask, sc);
349 &exe_ctx, &addr, strmstr);
351 if (cur_line > address_text_size)
352 address_text_size = cur_line;
362 if (sc.
symbol != previous_symbol) {
382 previous_symbol =
nullptr;
384 for (
size_t i = 0; i < num_instructions_found; ++i) {
389 const bool inst_is_at_pc = pc_addr_ptr && addr == *pc_addr_ptr;
396 uint32_t resolved_mask = module_sp->ResolveSymbolContextForAddress(
397 addr, eSymbolContextEverything, sc);
399 if (mixed_source_and_assembly) {
404 if (previous_symbol != sc.
symbol) {
409 if (previous_symbol !=
nullptr)
412 previous_symbol = sc.
symbol;
416 prologue_end_line)) {
418 uint32_t func_decl_line;
421 if (func_decl_file_sp &&
422 (func_decl_file_sp->Equal(
425 func_decl_file_sp->Equal(
431 for (uint32_t lineno = func_decl_line;
432 lineno <= prologue_end_line.
line; lineno++) {
434 this_line.
file = func_decl_file_sp->GetSpecOnly();
435 this_line.
line = lineno;
436 source_lines_to_display.
lines.push_back(this_line);
440 if (source_lines_to_display.
lines.size() > 0)
442 source_lines_to_display.
lines.size() - 1;
447 current_source_line_range);
454 current_source_line_range);
468 if (this_line != previous_line) {
470 std::vector<uint32_t> previous_lines;
472 i < num_mixed_context_lines &&
473 (this_line.
line - num_mixed_context_lines) > 0;
476 this_line.
line - num_mixed_context_lines + i;
477 auto pos = source_lines_seen.find(this_line.
file);
478 if (pos != source_lines_seen.end()) {
479 if (pos->second.count(line) == 1) {
480 previous_lines.clear();
482 previous_lines.push_back(line);
486 for (
size_t i = 0; i < previous_lines.size(); i++) {
488 previous_line.
file = this_line.
file;
489 previous_line.
line = previous_lines[i];
490 auto pos = source_lines_seen.find(previous_line.
file);
491 if (pos != source_lines_seen.end()) {
492 pos->second.insert(previous_line.
line);
494 source_lines_to_display.
lines.push_back(previous_line);
497 source_lines_to_display.
lines.push_back(this_line);
499 source_lines_to_display.
lines.size() - 1;
501 for (uint32_t i = 0; i < num_mixed_context_lines; i++) {
504 next_line.
line = this_line.
line + i + 1;
505 auto pos = source_lines_seen.find(next_line.
file);
506 if (pos != source_lines_seen.end()) {
507 if (pos->second.count(next_line.
line) == 1)
509 pos->second.insert(next_line.
line);
511 source_lines_to_display.
lines.push_back(next_line);
514 previous_line = this_line;
524 if (source_lines_to_display.
lines.size() > 0) {
526 for (
size_t idx = 0; idx < source_lines_to_display.
lines.size();
529 const char *line_highlight =
"";
531 line_highlight =
"->";
533 line_highlight =
"**";
537 line_highlight, &strm);
544 const bool show_control_flow_kind =
546 inst->
Dump(&strm, max_opcode_byte_size,
true, show_bytes,
547 show_control_flow_kind, &exe_ctx, &sc, &prev_sc,
nullptr,
575 if (limit.
value == 0)
578 return Disassemble(debugger, arch,
nullptr,
nullptr,
nullptr,
nullptr,
583 : m_address(address), m_address_class(addr_class), m_opcode(),
584 m_calculated_strings(false) {}
596 switch (instruction_control_flow_kind) {
616 llvm_unreachable(
"Fully covered switch above!");
620 bool show_address,
bool show_bytes,
621 bool show_control_flow_kind,
626 size_t max_address_text_size) {
627 size_t opcode_column_width = 7;
628 const size_t operand_column_width = 25;
645 if (max_opcode_byte_size > 0)
652 if (max_opcode_byte_size > 0)
659 if (show_control_flow_kind) {
663 instruction_control_flow_kind));
666 bool show_color =
false;
669 show_color = target_sp->GetDebugger().GetUseColor();
673 const std::string &opcode_name =
692 opcode_pos + opcode_column_width + operand_column_width,
' ');
700 std::unique_ptr<EmulateInstruction> insn_emulator_up(
702 if (insn_emulator_up) {
704 return insn_emulator_up->EvaluateInstruction(0);
724 auto option_value_sp = std::make_shared<OptionValueArray>(1u << data_type);
728 if (!fgets(buffer, 1023, in_file)) {
730 "Instruction::ReadArray: Error reading file (fgets).\n");
731 option_value_sp.reset();
732 return option_value_sp;
735 std::string line(buffer);
737 size_t len = line.size();
738 if (line[len - 1] ==
'\n') {
739 line[len - 1] =
'\0';
740 line.resize(len - 1);
743 if ((line.size() == 1) && line[0] ==
']') {
751 llvm::StringRef(
"^[ \t]*([^ \t]+)[ \t]*$"));
752 llvm::SmallVector<llvm::StringRef, 2> matches;
753 if (g_reg_exp.
Execute(line, &matches))
754 value = matches[1].str();
761 data_value_sp = std::make_shared<OptionValueUInt64>(0, 0);
762 data_value_sp->SetValueFromString(value);
766 data_value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
770 option_value_sp->GetAsArray()->InsertValue(idx, data_value_sp);
775 return option_value_sp;
782 auto option_value_sp = std::make_shared<OptionValueDictionary>();
783 static constexpr llvm::StringLiteral encoding_key(
"data_encoding");
788 if (!fgets(buffer, 1023, in_file)) {
790 "Instruction::ReadDictionary: Error reading file (fgets).\n");
791 option_value_sp.reset();
792 return option_value_sp;
796 std::string line(buffer);
798 size_t len = line.size();
799 if (line[len - 1] ==
'\n') {
800 line[len - 1] =
'\0';
801 line.resize(len - 1);
804 if ((line.size() == 1) && (line[0] ==
'}')) {
813 "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)[ \t]*$"));
815 llvm::SmallVector<llvm::StringRef, 3> matches;
817 bool reg_exp_success = g_reg_exp.
Execute(line, &matches);
820 if (reg_exp_success) {
821 key = matches[1].str();
822 value = matches[2].str();
824 out_stream.
Printf(
"Instruction::ReadDictionary: Failure executing "
825 "regular expression.\n");
826 option_value_sp.reset();
827 return option_value_sp;
833 assert(value.empty() ==
false);
834 assert(key.empty() ==
false);
836 if (value[0] ==
'{') {
837 assert(value.size() == 1);
841 option_value_sp.reset();
842 return option_value_sp;
844 }
else if (value[0] ==
'[') {
845 assert(value.size() == 1);
847 value_sp =
ReadArray(in_file, out_stream, data_type);
849 option_value_sp.reset();
850 return option_value_sp;
855 }
else if ((value[0] ==
'0') && (value[1] ==
'x')) {
856 value_sp = std::make_shared<OptionValueUInt64>(0, 0);
857 value_sp->SetValueFromString(value);
859 size_t len = value.size();
860 if ((value[0] ==
'"') && (value[len - 1] ==
'"'))
861 value = value.substr(1, len - 2);
862 value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
865 if (key == encoding_key) {
869 if (llvm::StringRef(value) ==
"uint32_t")
872 option_value_sp->GetAsDictionary()->SetValueForKey(key, value_sp,
877 return option_value_sp;
882 out_stream.
Printf(
"Instruction::TestEmulation: Missing file_name.");
888 "Instruction::TestEmulation: Attempt to open test file failed.");
893 if (!fgets(buffer, 255, test_file)) {
895 "Instruction::TestEmulation: Error reading first line of test file.\n");
900 if (strncmp(buffer,
"InstructionEmulationState={", 27) != 0) {
901 out_stream.
Printf(
"Instructin::TestEmulation: Test file does not contain "
902 "emulation state dictionary\n");
911 if (!data_dictionary_sp) {
913 "Instruction::TestEmulation: Error reading Dictionary Object.\n");
922 static constexpr llvm::StringLiteral description_key(
"assembly_string");
923 static constexpr llvm::StringLiteral triple_key(
"triple");
928 out_stream.
Printf(
"Instruction::TestEmulation: Test file does not "
929 "contain description string.\n");
933 SetDescription(value_sp->GetValueAs<llvm::StringRef>().value_or(
""));
938 "Instruction::TestEmulation: Test file does not contain triple.\n");
944 llvm::Triple(value_sp->GetValueAs<llvm::StringRef>().value_or(
"")));
946 bool success =
false;
947 std::unique_ptr<EmulateInstruction> insn_emulator_up(
949 if (insn_emulator_up)
951 insn_emulator_up->TestEmulation(out_stream, arch, data_dictionary);
954 out_stream.
Printf(
"Emulation test succeeded.");
956 out_stream.
Printf(
"Emulation test failed.");
962 const ArchSpec &arch, uint32_t evaluate_options,
void *baton,
967 std::unique_ptr<EmulateInstruction> insn_emulator_up(
969 if (insn_emulator_up) {
970 insn_emulator_up->SetBaton(baton);
971 insn_emulator_up->SetCallbacks(read_mem_callback, write_mem_callback,
972 read_reg_callback, write_reg_callback);
974 return insn_emulator_up->EvaluateInstruction(evaluate_options);
991 uint32_t max_inst_size = 0;
992 collection::const_iterator pos, end;
995 uint32_t inst_size = (*pos)->GetOpcode().GetByteSize();
996 if (max_inst_size < inst_size)
997 max_inst_size = inst_size;
999 return max_inst_size;
1017 bool show_control_flow_kind,
1020 collection::const_iterator pos, begin, end;
1025 disassembly_format =
1029 disassembly_format = &format;
1033 pos != end; ++pos) {
1036 (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes,
1037 show_control_flow_kind, exe_ctx,
nullptr,
nullptr,
1038 disassembly_format, 0);
1052 bool *found_calls)
const {
1058 *found_calls =
false;
1059 for (
size_t i = start; i < num_instructions; i++) {
1063 *found_calls =
true;
1078 for (
size_t i = 0; i < num_instructions; i++) {
1097 bool force_live_memory) {
1108 auto data_sp = std::make_shared<DataBufferHeap>(byte_size,
'\0');
1112 const size_t bytes_read =
1113 target.
ReadMemory(start, data_sp->GetBytes(), data_sp->GetByteSize(),
1114 error, force_live_memory, &load_addr);
1117 if (bytes_read == 0) {
1118 if (error_strm_ptr) {
1119 if (
const char *error_cstr =
error.AsCString())
1120 error_strm_ptr->
Printf(
"error: %s\n", error_cstr);
1125 if (bytes_read != data_sp->GetByteSize())
1126 data_sp->SetByteSize(bytes_read);
1132 false, data_from_file);
1137 : m_arch(arch), m_instruction_list(), m_flavor() {
1138 if (flavor ==
nullptr)
1146 std::string thumb_arch_name(arch.
GetTriple().getArchName().str());
1148 if (thumb_arch_name.size() > 3) {
1149 thumb_arch_name.erase(0, 3);
1150 thumb_arch_name.insert(0,
"thumb");
1197 switch (opcode_size) {
1199 uint8_t value8 = *((uint8_t *)opcode_data);
1204 uint16_t value16 = *((uint16_t *)opcode_data);
1209 uint32_t value32 = *((uint32_t *)opcode_data);
1214 uint64_t value64 = *((uint64_t *)opcode_data);
1237 ret.
m_type = Type::Immediate;
1245 ret.
m_type = Type::Immediate;
1259 ret.
m_type = Type::Dereference;
1275 ret.
m_type = Type::Product;
1286 return (base(op) && op.m_children.size() == 2 &&
1287 ((left(op.m_children[0]) && right(op.m_children[1])) ||
1288 (left(op.m_children[1]) && right(op.m_children[0]))));
1297 return (base(op) && op.m_children.size() == 1 && child(op.m_children[0]));
1316 reg = op.m_register;
1325 ((op.m_negative && op.m_immediate == (uint64_t)-imm) ||
1326 (!op.m_negative && op.m_immediate == (uint64_t)imm)));
1336 if (op.m_negative) {
1337 imm = -((int64_t)op.m_immediate);
1339 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 FindPluginForTarget(const Target &target, const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name)
size_t ParseInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false)
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name)
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)
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 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 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 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)
@ eOptionMarkPCSourceLine
@ eOptionShowControlFlowKind
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.
void GetStartLineSourceInfo(lldb::SupportFileSP &source_file_sp, uint32_t &line_no)
Find the file and line number of the source location of the start of the function.
const AddressRange & GetAddressRange()
DEPRECATED: Use GetAddressRanges instead.
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(lldb::SupportFileSP support_file_sp, 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.
@ eEqualFileSpecAndChecksumIfSet
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 * GetDisassemblyFeatures() const
const char * GetDisassemblyFlavor() const
const char * GetDisassemblyCPU() const
SectionLoadList & GetSectionLoadList()
virtual 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, const char *cpu, const char *features)
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::SupportFile > SupportFileSP
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::@5 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.
uint16_t column
The column number of the source line, or zero if there is no column information.
lldb::SupportFileSP original_file_sp
The original source file, from debug info.
bool IsValid() const
Check if a line entry object is valid.
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
const FileSpec & GetFile() const
Helper to access the file.
lldb::SupportFileSP file_sp
The source file, possibly mapped by the target.source-map setting.
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.