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