LLDB mainline
Disassembler.h
Go to the documentation of this file.
1//===-- Disassembler.h ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_CORE_DISASSEMBLER_H
10#define LLDB_CORE_DISASSEMBLER_H
11
12#include "lldb/Core/Address.h"
15#include "lldb/Core/Opcode.h"
23#include "lldb/lldb-defines.h"
24#include "lldb/lldb-forward.h"
26#include "lldb/lldb-types.h"
27
28#include "llvm/ADT/StringRef.h"
29
30#include <functional>
31#include <map>
32#include <memory>
33#include <set>
34#include <string>
35#include <vector>
36
37#include <cstddef>
38#include <cstdint>
39#include <cstdio>
40
41namespace llvm {
42template <typename T> class SmallVectorImpl;
43}
44
45namespace lldb_private {
46class AddressRange;
47class DataExtractor;
48class Debugger;
49class Disassembler;
50class Module;
51class StackFrame;
52class Stream;
53class SymbolContext;
54class SymbolContextList;
55class Target;
56struct RegisterInfo;
57
59public:
60 Instruction(const Address &address,
62
63 virtual ~Instruction();
64
65 const Address &GetAddress() const { return m_address; }
66
67 const char *GetMnemonic(const ExecutionContext *exe_ctx,
68 bool markup = false) {
70 return markup ? m_markup_opcode_name.c_str() : m_opcode_name.c_str();
71 }
72
73 const char *GetOperands(const ExecutionContext *exe_ctx,
74 bool markup = false) {
76 return markup ? m_markup_mnemonics.c_str() : m_mnemonics.c_str();
77 }
78
79 const char *GetComment(const ExecutionContext *exe_ctx) {
81 return m_comment.c_str();
82 }
83
84 /// \return
85 /// The control flow kind of this instruction, or
86 /// eInstructionControlFlowKindUnknown if the instruction
87 /// can't be classified.
92
93 virtual void
95
97
98 void SetAddress(const Address &addr) {
99 // Invalidate the address class to lazily discover it if we need to.
101 m_address = addr;
102 }
103
104 /// Dump the text representation of this Instruction to a Stream
105 ///
106 /// Print the (optional) address, (optional) bytes, opcode,
107 /// operands, and instruction comments to a stream.
108 ///
109 /// \param[in] s
110 /// The Stream to add the text to.
111 ///
112 /// \param[in] show_address
113 /// Whether the address (using disassembly_addr_format_spec formatting)
114 /// should be printed.
115 ///
116 /// \param[in] show_bytes
117 /// Whether the bytes of the assembly instruction should be printed.
118 ///
119 /// \param[in] show_control_flow_kind
120 /// Whether the control flow kind of the instruction should be printed.
121 ///
122 /// \param[in] max_opcode_byte_size
123 /// The size (in bytes) of the largest instruction in the list that
124 /// we are printing (for text justification/alignment purposes)
125 /// Only needed if show_bytes is true.
126 ///
127 /// \param[in] exe_ctx
128 /// The current execution context, if available. May be used in
129 /// the assembling of the operands+comments for this instruction.
130 /// Pass NULL if not applicable.
131 ///
132 /// \param[in] sym_ctx
133 /// The SymbolContext for this instruction.
134 /// Pass NULL if not available/computed.
135 /// Only needed if show_address is true.
136 ///
137 /// \param[in] prev_sym_ctx
138 /// The SymbolContext for the previous instruction. Depending on
139 /// the disassembly address format specification, a change in
140 /// Symbol / Function may mean that a line is printed with the new
141 /// symbol/function name.
142 /// Pass NULL if unavailable, or if this is the first instruction of
143 /// the InstructionList.
144 /// Only needed if show_address is true.
145 ///
146 /// \param[in] disassembly_addr_format
147 /// The format specification for how addresses are printed.
148 /// Only needed if show_address is true.
149 ///
150 /// \param[in] max_address_text_size
151 /// The length of the longest address string at the start of the
152 /// disassembly line that will be printed (the
153 /// Debugger::FormatDisassemblerAddress() string)
154 /// so this method can properly align the instruction opcodes.
155 /// May be 0 to indicate no indentation/alignment of the opcodes.
156 virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address,
157 bool show_bytes, bool show_control_flow_kind,
158 const ExecutionContext *exe_ctx,
159 const SymbolContext *sym_ctx,
160 const SymbolContext *prev_sym_ctx,
161 const FormatEntity::Entry *disassembly_addr_format,
162 size_t max_address_text_size);
163
164 virtual bool DoesBranch() = 0;
165
166 virtual bool HasDelaySlot();
167
168 virtual bool IsLoad() = 0;
169
170 virtual bool IsBarrier() = 0;
171
172 virtual bool IsAuthenticated() = 0;
173
174 bool CanSetBreakpoint();
175
176 virtual size_t Decode(const Disassembler &disassembler,
177 const DataExtractor &data,
178 lldb::offset_t data_offset) = 0;
179
180 virtual void SetDescription(llvm::StringRef) {
181 } // May be overridden in sub-classes that have descriptions.
182
183 lldb::OptionValueSP ReadArray(FILE *in_file, Stream &out_stream,
184 OptionValue::Type data_type);
185
186 lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream &out_stream);
187
188 bool DumpEmulation(const ArchSpec &arch);
189
190 virtual bool TestEmulation(Stream &stream, const char *test_file_name);
191
192 bool Emulate(const ArchSpec &arch, uint32_t evaluate_options, void *baton,
197
198 const Opcode &GetOpcode() const { return m_opcode; }
199
200 uint32_t GetData(DataExtractor &data);
201
202 struct Operand {
211 std::vector<Operand> m_children;
213 std::string m_register;
214 bool m_negative = false;
215 bool m_clobbered = false;
216
217 bool IsValid() { return m_type != Type::Invalid; }
218
219 static Operand BuildRegister(llvm::StringRef r);
220 static Operand BuildImmediate(lldb::addr_t imm, bool neg);
221 static Operand BuildImmediate(int64_t imm);
222 static Operand BuildDereference(const Operand &ref);
223 static Operand BuildSum(const Operand &lhs, const Operand &rhs);
224 static Operand BuildProduct(const Operand &lhs, const Operand &rhs);
225 };
226
228 return false;
229 }
230
231 virtual bool IsCall() { return false; }
232
233 static const char *GetNameForInstructionControlFlowKind(
234 lldb::InstructionControlFlowKind instruction_control_flow_kind);
235
236 /// Get variable annotations for this instruction as structured data.
237 /// Returns an array of dictionaries to be used in SBInstruction class.
239
240protected:
241 Address m_address; // The section offset address of this instruction
242 // We include an address class in the Instruction class to
243 // allow the instruction specify the
244 // AddressClass::eCodeAlternateISA (currently used for
245 // thumb), and also to specify data (AddressClass::eData).
246 // The usual value will be AddressClass::eCode, but often
247 // when disassembling memory, you might run into data.
248 // This can help us to disassemble appropriately.
249private:
250 AddressClass m_address_class; // Use GetAddressClass () accessor function!
251
252protected:
253 Opcode m_opcode; // The opcode for this instruction
254 std::string m_opcode_name;
256 std::string m_mnemonics;
258 std::string m_comment;
260
261 void
268};
269
271std::function<bool(const Instruction::Operand &)>
272MatchBinaryOp(std::function<bool(const Instruction::Operand &)> base,
273 std::function<bool(const Instruction::Operand &)> left,
274 std::function<bool(const Instruction::Operand &)> right);
275
276std::function<bool(const Instruction::Operand &)>
277MatchUnaryOp(std::function<bool(const Instruction::Operand &)> base,
278 std::function<bool(const Instruction::Operand &)> child);
279
280std::function<bool(const Instruction::Operand &)>
281MatchRegOp(const RegisterInfo &info);
282
283std::function<bool(const Instruction::Operand &)> FetchRegOp(std::string &reg);
284
285std::function<bool(const Instruction::Operand &)> MatchImmOp(int64_t imm);
286
287std::function<bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm);
288
289std::function<bool(const Instruction::Operand &)>
291} // namespace OperandMatchers
292
294public:
297
298 size_t GetSize() const;
299
300 size_t GetTotalByteSize() const;
301
302 uint32_t GetMaxOpcocdeByteSize() const;
303
305
306 llvm::ArrayRef<lldb::InstructionSP> Instructions() const {
307 return m_instructions;
308 }
309
310 /// Get the instruction at the given address.
311 ///
312 /// \return
313 /// A valid \a InstructionSP if the address could be found, or null
314 /// otherwise.
316
317 //------------------------------------------------------------------
318 /// Get the index of the next branch instruction.
319 ///
320 /// Given a list of instructions, find the next branch instruction
321 /// in the list by returning an index.
322 ///
323 /// @param[in] start
324 /// The instruction index of the first instruction to check.
325 ///
326 /// @param[in] ignore_calls
327 /// It true, then fine the first branch instruction that isn't
328 /// a function call (a branch that calls and returns to the next
329 /// instruction). If false, find the instruction index of any
330 /// branch in the list.
331 ///
332 /// @param[out] found_calls
333 /// If non-null, this will be set to true if any calls were found in
334 /// extending the range.
335 ///
336 /// @return
337 /// The instruction index of the first branch that is at or past
338 /// \a start. Returns UINT32_MAX if no matching branches are
339 /// found.
340 //------------------------------------------------------------------
341 uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls,
342 bool *found_calls) const;
343
345 Target &target);
346
347 uint32_t GetIndexOfInstructionAtAddress(const Address &addr);
348
349 void Clear();
350
351 void Append(lldb::InstructionSP &inst_sp);
352
353 void Dump(Stream *s, bool show_address, bool show_bytes,
354 bool show_control_flow_kind, const ExecutionContext *exe_ctx);
355
356private:
357 typedef std::vector<lldb::InstructionSP> collection;
358 typedef collection::iterator iterator;
359 typedef collection::const_iterator const_iterator;
360
362};
363
365public:
367
369
370 bool DoesBranch() override;
371
372 bool HasDelaySlot() override;
373
374 bool IsLoad() override;
375
376 bool IsBarrier() override;
377
378 bool IsAuthenticated() override;
379
381 const ExecutionContext *exe_ctx) override {
382 // TODO: fill this in and put opcode name into Instruction::m_opcode_name,
383 // mnemonic into Instruction::m_mnemonics, and any comment into
384 // Instruction::m_comment
385 }
386
387 size_t Decode(const Disassembler &disassembler, const DataExtractor &data,
388 lldb::offset_t data_offset) override;
389
390 void SetOpcode(size_t opcode_size, void *opcode_data);
391
392 void SetDescription(llvm::StringRef description) override;
393
394protected:
395 std::string m_description;
396
399};
400
401class Disassembler : public std::enable_shared_from_this<Disassembler>,
402 public PluginInterface {
403public:
404 enum {
406 eOptionShowBytes = (1u << 0),
407 eOptionRawOuput = (1u << 1),
408 eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains
409 // the current PC (mixed mode only)
411 (1u << 3), // Mark the disassembly line the contains the PC
414 };
415
420
421 // FindPlugin should be lax about the flavor string (it is too annoying to
422 // have various internal uses of the disassembler fail because the global
423 // flavor string gets set wrong. Instead, if you get a flavor string you
424 // don't understand, use the default. Folks who care to check can use the
425 // FlavorValidForArchSpec method on the disassembler they got back.
426 static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch,
427 const char *flavor, const char *cpu,
428 const char *features,
429 const char *plugin_name);
430
431 // This version will use the value in the Target settings if flavor is NULL;
433 FindPluginForTarget(const Target &target, const ArchSpec &arch,
434 const char *flavor, const char *cpu, const char *features,
435 const char *plugin_name);
436
441
443 DisassembleRange(const ArchSpec &arch, const char *plugin_name,
444 const char *flavor, const char *cpu, const char *features,
445 Target &target, llvm::ArrayRef<AddressRange> disasm_ranges,
446 bool force_live_memory = false);
447
449 DisassembleBytes(const ArchSpec &arch, const char *plugin_name,
450 const char *flavor, const char *cpu, const char *features,
451 const Address &start, const void *bytes, size_t length,
452 uint32_t max_num_instructions, bool data_from_file);
453
454 static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
455 const char *plugin_name, const char *flavor,
456 const char *cpu, const char *features,
457 const ExecutionContext &exe_ctx, const Address &start,
458 Limit limit, bool mixed_source_and_assembly,
459 uint32_t num_mixed_context_lines, uint32_t options,
460 Stream &strm);
461
462 static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
463 StackFrame &frame, Stream &strm);
464
465 // Constructors and Destructors
466 Disassembler(const ArchSpec &arch, const char *flavor);
467 ~Disassembler() override;
468
469 void PrintInstructions(Debugger &debugger, const ArchSpec &arch,
470 const ExecutionContext &exe_ctx,
471 bool mixed_source_and_assembly,
472 uint32_t num_mixed_context_lines, uint32_t options,
473 Stream &strm);
474
475 size_t ParseInstructions(Target &target, Address address, Limit limit,
476 Stream *error_strm_ptr,
477 bool force_live_memory = false) {
478 m_instruction_list.Clear();
479 return AppendInstructions(target, address, limit, error_strm_ptr,
480 force_live_memory);
481 }
482
483 virtual size_t DecodeInstructions(const Address &base_addr,
484 const DataExtractor &data,
485 lldb::offset_t data_offset,
486 size_t num_instructions, bool append,
487 bool data_from_file) = 0;
488
490
491 const InstructionList &GetInstructionList() const;
492
493 const ArchSpec &GetArchitecture() const { return m_arch; }
494
495 const char *GetFlavor() const { return m_flavor.c_str(); }
496
498 const char *flavor) = 0;
499
500protected:
501 size_t AppendInstructions(Target &target, Address address, Limit limit,
502 Stream *error_strm_ptr, bool force_live_memory);
503
504 // SourceLine and SourceLinesToDisplay structures are only used in the mixed
505 // source and assembly display methods internal to this class.
506
507 struct SourceLine {
510 uint32_t column = 0;
511
512 SourceLine() = default;
513
514 bool operator==(const SourceLine &rhs) const {
515 return file == rhs.file && line == rhs.line && rhs.column == column;
516 }
517
518 bool operator!=(const SourceLine &rhs) const {
519 return file != rhs.file || line != rhs.line || column != rhs.column;
520 }
521
522 bool IsValid() const { return line != LLDB_INVALID_LINE_NUMBER; }
523 };
524
526 std::vector<SourceLine> lines;
527
528 // index of the "current" source line, if we want to highlight that when
529 // displaying the source lines. (as opposed to the surrounding source
530 // lines provided to give context)
532
533 // Whether to print a blank line at the end of the source lines.
535
537 };
538
539 // Get the function's declaration line number, hopefully a line number
540 // earlier than the opening curly brace at the start of the function body.
542
543 // Add the provided SourceLine to the map of filenames-to-source-lines-seen.
544 static void AddLineToSourceLineTables(
545 SourceLine &line,
546 std::map<FileSpec, std::set<uint32_t>> &source_lines_seen);
547
548 // Given a source line, determine if we should print it when we're doing
549 // mixed source & assembly output. We're currently using the
550 // target.process.thread.step-avoid-regexp setting (which is used for
551 // stepping over inlined STL functions by default) to determine what source
552 // lines to avoid showing.
553 //
554 // Returns true if this source line should be elided (if the source line
555 // should not be displayed).
556 static bool
558 const SymbolContext &sc, SourceLine &line);
559
560 static bool
562 const SymbolContext &sc, LineEntry &line) {
563 SourceLine sl;
564 sl.file = line.GetFile();
565 sl.line = line.line;
566 sl.column = line.column;
567 return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
568 };
569
570 // Classes that inherit from Disassembler can see and modify these
573 std::string m_flavor;
574
575private:
576 // For Disassembler only
577 Disassembler(const Disassembler &) = delete;
578 const Disassembler &operator=(const Disassembler &) = delete;
579};
580
581/// Structured data for a single variable annotation.
583 std::string variable_name;
584 /// Location description (e.g., "r15", "undef", "const_0").
586 /// Whether variable is live at this instruction.
588 /// Register numbering scheme for location interpretation.
590 /// Where this annotation is valid.
591 std::optional<lldb_private::AddressRange> address_range;
592 /// Source file where variable was declared.
593 std::optional<std::string> decl_file;
594 /// Line number where variable was declared.
595 std::optional<uint32_t> decl_line;
596 /// Variable's type name.
597 std::optional<std::string> type_name;
598};
599
600/// Tracks live variable annotations across instructions and produces
601/// per-instruction "events" like `name = RDI` or `name = <undef>`.
603
604 // Live state from the previous instruction, keyed by Variable::GetID().
605 llvm::DenseMap<lldb::user_id_t, VariableAnnotation> m_live_vars;
606
607public:
608 /// Compute annotation strings for a single instruction and update
609 /// `m_live_vars`. Returns only the events that should be printed *at this
610 /// instruction*.
611 std::vector<std::string> Annotate(Instruction &inst);
612
613 /// Returns structured data for all variables relevant at this instruction.
614 std::vector<VariableAnnotation> AnnotateStructured(Instruction &inst);
615};
616
617} // namespace lldb_private
618
619#endif // LLDB_CORE_DISASSEMBLER_H
A section + offset based address class.
Definition Address.h:62
An architecture specification class.
Definition ArchSpec.h:32
An data extractor class.
A class to manage flag bits.
Definition Debugger.h:100
static lldb::DisassemblerSP FindPluginForTarget(const Target &target, const ArchSpec &arch, const char *flavor, const char *cpu, const char *features, const char *plugin_name)
static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, const char *plugin_name, const char *flavor, const char *cpu, const char *features, Target &target, llvm::ArrayRef< AddressRange > disasm_ranges, 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)
size_t AppendInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory)
const ArchSpec & GetArchitecture() const
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, LineEntry &line)
size_t ParseInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false)
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, SourceLine &line)
Disassembler(const Disassembler &)=delete
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
const Disassembler & operator=(const Disassembler &)=delete
virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor)=0
const char * GetFlavor() const
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)
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_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 &reg_value)
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A file utility class.
Definition FileSpec.h:56
llvm::ArrayRef< lldb::InstructionSP > Instructions() const
void Append(lldb::InstructionSP &inst_sp)
uint32_t GetIndexOfInstructionAtAddress(const Address &addr)
collection::iterator iterator
collection::const_iterator const_iterator
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target)
std::vector< lldb::InstructionSP > collection
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 ParseOperands(llvm::SmallVectorImpl< Operand > &operands)
virtual void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx)=0
static const char * GetNameForInstructionControlFlowKind(lldb::InstructionControlFlowKind instruction_control_flow_kind)
virtual bool TestEmulation(Stream &stream, const char *test_file_name)
virtual size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset)=0
virtual lldb::InstructionControlFlowKind GetControlFlowKind(const ExecutionContext *exe_ctx)
void CalculateMnemonicOperandsAndCommentIfNeeded(const ExecutionContext *exe_ctx)
StructuredData::ArraySP GetVariableAnnotations()
Get variable annotations for this instruction as structured data.
void SetAddress(const Address &addr)
lldb::OptionValueSP ReadArray(FILE *in_file, Stream &out_stream, OptionValue::Type data_type)
const Address & GetAddress() const
const char * GetMnemonic(const ExecutionContext *exe_ctx, bool markup=false)
bool DumpEmulation(const ArchSpec &arch)
const char * GetComment(const ExecutionContext *exe_ctx)
const char * GetOperands(const ExecutionContext *exe_ctx, bool markup=false)
virtual bool DoesBranch()=0
lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream &out_stream)
virtual void SetDescription(llvm::StringRef)
const Opcode & GetOpcode() const
virtual bool IsBarrier()=0
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)
virtual bool IsLoad()=0
virtual bool IsAuthenticated()=0
const PseudoInstruction & operator=(const PseudoInstruction &)=delete
void SetOpcode(size_t opcode_size, void *opcode_data)
void SetDescription(llvm::StringRef description) override
void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx) override
PseudoInstruction(const PseudoInstruction &)=delete
size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) override
This base class provides an interface to stack frames.
Definition StackFrame.h:44
A stream class that can stream formatted output to a file.
Definition Stream.h:28
std::shared_ptr< Array > ArraySP
Defines a symbol context baton that can be handed other debug core functions.
Tracks live variable annotations across instructions and produces per-instruction "events" like name ...
std::vector< std::string > Annotate(Instruction &inst)
Compute annotation strings for a single instruction and update m_live_vars.
std::vector< VariableAnnotation > AnnotateStructured(Instruction &inst)
Returns structured data for all variables relevant at this instruction.
llvm::DenseMap< lldb::user_id_t, VariableAnnotation > m_live_vars
#define LLDB_INVALID_LINE_NUMBER
std::function< bool(const Instruction::Operand &)> FetchRegOp(std::string &reg)
std::function< bool(const Instruction::Operand &)> MatchRegOp(const RegisterInfo &info)
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.
uint64_t offset_t
Definition lldb-types.h:86
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.
@ eInstructionControlFlowKindUnknown
The instruction could not be classified.
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::OptionValue > OptionValueSP
RegisterKind
Register numbering types.
enum lldb_private::Disassembler::Limit::@153225075164054222165007100131150321273323317332 kind
bool operator==(const SourceLine &rhs) const
bool operator!=(const SourceLine &rhs) const
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 BuildRegister(llvm::StringRef r)
static Operand BuildProduct(const Operand &lhs, const Operand &rhs)
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
A line table entry class.
Definition LineEntry.h:21
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition LineEntry.h:155
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
Definition LineEntry.h:151
const FileSpec & GetFile() const
Helper to access the file.
Definition LineEntry.h:134
Every register is described in detail including its name, alternate name (optional),...
Structured data for a single variable annotation.
std::optional< uint32_t > decl_line
Line number where variable was declared.
std::optional< lldb_private::AddressRange > address_range
Where this annotation is valid.
bool is_live
Whether variable is live at this instruction.
std::string location_description
Location description (e.g., "r15", "undef", "const_0").
std::optional< std::string > decl_file
Source file where variable was declared.
std::optional< std::string > type_name
Variable's type name.
lldb::RegisterKind register_kind
Register numbering scheme for location interpretation.