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.
GetFile() &&
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.
GetFile() ||
415 for (uint32_t lineno = func_decl_line;
416 lineno <= prologue_end_line.
line; lineno++) {
418 this_line.
file = func_decl_file;
419 this_line.
line = lineno;
420 source_lines_to_display.
lines.push_back(this_line);
424 if (source_lines_to_display.
lines.size() > 0)
426 source_lines_to_display.
lines.size() - 1;
431 current_source_line_range);
438 current_source_line_range);
452 if (this_line != previous_line) {
454 std::vector<uint32_t> previous_lines;
456 i < num_mixed_context_lines &&
457 (this_line.
line - num_mixed_context_lines) > 0;
460 this_line.
line - num_mixed_context_lines + i;
461 auto pos = source_lines_seen.find(this_line.
file);
462 if (pos != source_lines_seen.end()) {
463 if (pos->second.count(line) == 1) {
464 previous_lines.clear();
466 previous_lines.push_back(line);
470 for (
size_t i = 0; i < previous_lines.size(); i++) {
472 previous_line.
file = this_line.
file;
473 previous_line.
line = previous_lines[i];
474 auto pos = source_lines_seen.find(previous_line.
file);
475 if (pos != source_lines_seen.end()) {
476 pos->second.insert(previous_line.
line);
478 source_lines_to_display.
lines.push_back(previous_line);
481 source_lines_to_display.
lines.push_back(this_line);
483 source_lines_to_display.
lines.size() - 1;
485 for (uint32_t i = 0; i < num_mixed_context_lines; i++) {
488 next_line.
line = this_line.
line + i + 1;
489 auto pos = source_lines_seen.find(next_line.
file);
490 if (pos != source_lines_seen.end()) {
491 if (pos->second.count(next_line.
line) == 1)
493 pos->second.insert(next_line.
line);
495 source_lines_to_display.
lines.push_back(next_line);
498 previous_line = this_line;
508 if (source_lines_to_display.
lines.size() > 0) {
510 for (
size_t idx = 0; idx < source_lines_to_display.
lines.size();
513 const char *line_highlight =
"";
515 line_highlight =
"->";
517 line_highlight =
"**";
527 const bool show_control_flow_kind =
529 inst->
Dump(&strm, max_opcode_byte_size,
true, show_bytes,
530 show_control_flow_kind, &exe_ctx, &sc, &prev_sc,
nullptr,
558 if (limit.
value == 0)
561 return Disassemble(debugger, arch,
nullptr,
nullptr, frame,
566 : m_address(address), m_address_class(addr_class), m_opcode(),
567 m_calculated_strings(false) {}
579 switch (instruction_control_flow_kind) {
599 llvm_unreachable(
"Fully covered switch above!");
603 bool show_address,
bool show_bytes,
604 bool show_control_flow_kind,
609 size_t max_address_text_size) {
610 size_t opcode_column_width = 7;
611 const size_t operand_column_width = 25;
628 if (max_opcode_byte_size > 0)
635 if (max_opcode_byte_size > 0)
642 if (show_control_flow_kind) {
646 instruction_control_flow_kind));
649 bool show_color =
false;
652 show_color = target_sp->GetDebugger().GetUseColor();
656 const std::string &opcode_name =
675 opcode_pos + opcode_column_width + operand_column_width,
' ');
683 std::unique_ptr<EmulateInstruction> insn_emulator_up(
685 if (insn_emulator_up) {
687 return insn_emulator_up->EvaluateInstruction(0);
707 auto option_value_sp = std::make_shared<OptionValueArray>(1u << data_type);
711 if (!fgets(buffer, 1023, in_file)) {
713 "Instruction::ReadArray: Error reading file (fgets).\n");
714 option_value_sp.reset();
715 return option_value_sp;
718 std::string line(buffer);
720 size_t len = line.size();
721 if (line[len - 1] ==
'\n') {
722 line[len - 1] =
'\0';
723 line.resize(len - 1);
726 if ((line.size() == 1) && line[0] ==
']') {
734 llvm::StringRef(
"^[ \t]*([^ \t]+)[ \t]*$"));
735 llvm::SmallVector<llvm::StringRef, 2> matches;
736 if (g_reg_exp.
Execute(line, &matches))
737 value = matches[1].str();
744 data_value_sp = std::make_shared<OptionValueUInt64>(0, 0);
745 data_value_sp->SetValueFromString(value);
749 data_value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
753 option_value_sp->GetAsArray()->InsertValue(idx, data_value_sp);
758 return option_value_sp;
765 auto option_value_sp = std::make_shared<OptionValueDictionary>();
766 static constexpr llvm::StringLiteral encoding_key(
"data_encoding");
771 if (!fgets(buffer, 1023, in_file)) {
773 "Instruction::ReadDictionary: Error reading file (fgets).\n");
774 option_value_sp.reset();
775 return option_value_sp;
779 std::string line(buffer);
781 size_t len = line.size();
782 if (line[len - 1] ==
'\n') {
783 line[len - 1] =
'\0';
784 line.resize(len - 1);
787 if ((line.size() == 1) && (line[0] ==
'}')) {
796 "^[ \t]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*=[ \t]*(.*)[ \t]*$"));
798 llvm::SmallVector<llvm::StringRef, 3> matches;
800 bool reg_exp_success = g_reg_exp.
Execute(line, &matches);
803 if (reg_exp_success) {
804 key = matches[1].str();
805 value = matches[2].str();
807 out_stream.
Printf(
"Instruction::ReadDictionary: Failure executing "
808 "regular expression.\n");
809 option_value_sp.reset();
810 return option_value_sp;
816 assert(value.empty() ==
false);
817 assert(key.empty() ==
false);
819 if (value[0] ==
'{') {
820 assert(value.size() == 1);
824 option_value_sp.reset();
825 return option_value_sp;
827 }
else if (value[0] ==
'[') {
828 assert(value.size() == 1);
830 value_sp =
ReadArray(in_file, out_stream, data_type);
832 option_value_sp.reset();
833 return option_value_sp;
838 }
else if ((value[0] ==
'0') && (value[1] ==
'x')) {
839 value_sp = std::make_shared<OptionValueUInt64>(0, 0);
840 value_sp->SetValueFromString(value);
842 size_t len = value.size();
843 if ((value[0] ==
'"') && (value[len - 1] ==
'"'))
844 value = value.substr(1, len - 2);
845 value_sp = std::make_shared<OptionValueString>(value.c_str(),
"");
848 if (key == encoding_key) {
852 if (llvm::StringRef(value) ==
"uint32_t")
855 option_value_sp->GetAsDictionary()->SetValueForKey(key, value_sp,
860 return option_value_sp;
865 out_stream.
Printf(
"Instruction::TestEmulation: Missing file_name.");
871 "Instruction::TestEmulation: Attempt to open test file failed.");
876 if (!fgets(buffer, 255, test_file)) {
878 "Instruction::TestEmulation: Error reading first line of test file.\n");
883 if (strncmp(buffer,
"InstructionEmulationState={", 27) != 0) {
884 out_stream.
Printf(
"Instructin::TestEmulation: Test file does not contain "
885 "emulation state dictionary\n");
894 if (!data_dictionary_sp) {
896 "Instruction::TestEmulation: Error reading Dictionary Object.\n");
905 static constexpr llvm::StringLiteral description_key(
"assembly_string");
906 static constexpr llvm::StringLiteral triple_key(
"triple");
911 out_stream.
Printf(
"Instruction::TestEmulation: Test file does not "
912 "contain description string.\n");
916 SetDescription(value_sp->GetValueAs<llvm::StringRef>().value_or(
""));
921 "Instruction::TestEmulation: Test file does not contain triple.\n");
927 llvm::Triple(value_sp->GetValueAs<llvm::StringRef>().value_or(
"")));
929 bool success =
false;
930 std::unique_ptr<EmulateInstruction> insn_emulator_up(
932 if (insn_emulator_up)
934 insn_emulator_up->TestEmulation(out_stream, arch, data_dictionary);
937 out_stream.
Printf(
"Emulation test succeeded.");
939 out_stream.
Printf(
"Emulation test failed.");
945 const ArchSpec &arch, uint32_t evaluate_options,
void *baton,
950 std::unique_ptr<EmulateInstruction> insn_emulator_up(
952 if (insn_emulator_up) {
953 insn_emulator_up->SetBaton(baton);
954 insn_emulator_up->SetCallbacks(read_mem_callback, write_mem_callback,
955 read_reg_callback, write_reg_callback);
957 return insn_emulator_up->EvaluateInstruction(evaluate_options);
974 uint32_t max_inst_size = 0;
975 collection::const_iterator pos, end;
978 uint32_t inst_size = (*pos)->GetOpcode().GetByteSize();
979 if (max_inst_size < inst_size)
980 max_inst_size = inst_size;
982 return max_inst_size;
1000 bool show_control_flow_kind,
1003 collection::const_iterator pos, begin, end;
1008 disassembly_format =
1012 disassembly_format = &format;
1016 pos != end; ++pos) {
1019 (*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes,
1020 show_control_flow_kind, exe_ctx,
nullptr,
nullptr,
1021 disassembly_format, 0);
1035 bool *found_calls)
const {
1041 *found_calls =
false;
1042 for (
size_t i = start; i < num_instructions; i++) {
1046 *found_calls =
true;
1061 for (
size_t i = 0; i < num_instructions; i++) {
1080 bool force_live_memory) {
1091 auto data_sp = std::make_shared<DataBufferHeap>(byte_size,
'\0');
1095 const size_t bytes_read =
1096 target.
ReadMemory(start, data_sp->GetBytes(), data_sp->GetByteSize(),
1097 error, force_live_memory, &load_addr);
1100 if (bytes_read == 0) {
1101 if (error_strm_ptr) {
1102 if (
const char *error_cstr =
error.AsCString())
1103 error_strm_ptr->
Printf(
"error: %s\n", error_cstr);
1108 if (bytes_read != data_sp->GetByteSize())
1109 data_sp->SetByteSize(bytes_read);
1115 false, data_from_file);
1120 : m_arch(arch), m_instruction_list(), m_flavor() {
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)
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)
@ eOptionMarkPCSourceLine
@ eOptionShowControlFlowKind
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()
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)
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::@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.
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.