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;
214 bool m_negative = false;
215 bool m_clobbered = false;
216
217 bool IsValid() { return m_type != Type::Invalid; }
218
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
236protected:
237 Address m_address; // The section offset address of this instruction
238 // We include an address class in the Instruction class to
239 // allow the instruction specify the
240 // AddressClass::eCodeAlternateISA (currently used for
241 // thumb), and also to specify data (AddressClass::eData).
242 // The usual value will be AddressClass::eCode, but often
243 // when disassembling memory, you might run into data.
244 // This can help us to disassemble appropriately.
245private:
246 AddressClass m_address_class; // Use GetAddressClass () accessor function!
247
248protected:
249 Opcode m_opcode; // The opcode for this instruction
250 std::string m_opcode_name;
252 std::string m_mnemonics;
254 std::string m_comment;
256
257 void
264};
265
267std::function<bool(const Instruction::Operand &)>
268MatchBinaryOp(std::function<bool(const Instruction::Operand &)> base,
269 std::function<bool(const Instruction::Operand &)> left,
270 std::function<bool(const Instruction::Operand &)> right);
271
272std::function<bool(const Instruction::Operand &)>
273MatchUnaryOp(std::function<bool(const Instruction::Operand &)> base,
274 std::function<bool(const Instruction::Operand &)> child);
275
276std::function<bool(const Instruction::Operand &)>
277MatchRegOp(const RegisterInfo &info);
278
279std::function<bool(const Instruction::Operand &)> FetchRegOp(ConstString &reg);
280
281std::function<bool(const Instruction::Operand &)> MatchImmOp(int64_t imm);
282
283std::function<bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm);
284
285std::function<bool(const Instruction::Operand &)>
287} // namespace OperandMatchers
288
290public:
293
294 size_t GetSize() const;
295
296 size_t GetTotalByteSize() const;
297
298 uint32_t GetMaxOpcocdeByteSize() const;
299
301
302 llvm::ArrayRef<lldb::InstructionSP> Instructions() const {
303 return m_instructions;
304 }
305
306 /// Get the instruction at the given address.
307 ///
308 /// \return
309 /// A valid \a InstructionSP if the address could be found, or null
310 /// otherwise.
312
313 //------------------------------------------------------------------
314 /// Get the index of the next branch instruction.
315 ///
316 /// Given a list of instructions, find the next branch instruction
317 /// in the list by returning an index.
318 ///
319 /// @param[in] start
320 /// The instruction index of the first instruction to check.
321 ///
322 /// @param[in] ignore_calls
323 /// It true, then fine the first branch instruction that isn't
324 /// a function call (a branch that calls and returns to the next
325 /// instruction). If false, find the instruction index of any
326 /// branch in the list.
327 ///
328 /// @param[out] found_calls
329 /// If non-null, this will be set to true if any calls were found in
330 /// extending the range.
331 ///
332 /// @return
333 /// The instruction index of the first branch that is at or past
334 /// \a start. Returns UINT32_MAX if no matching branches are
335 /// found.
336 //------------------------------------------------------------------
337 uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls,
338 bool *found_calls) const;
339
341 Target &target);
342
343 uint32_t GetIndexOfInstructionAtAddress(const Address &addr);
344
345 void Clear();
346
347 void Append(lldb::InstructionSP &inst_sp);
348
349 void Dump(Stream *s, bool show_address, bool show_bytes,
350 bool show_control_flow_kind, const ExecutionContext *exe_ctx);
351
352private:
353 typedef std::vector<lldb::InstructionSP> collection;
354 typedef collection::iterator iterator;
355 typedef collection::const_iterator const_iterator;
356
358};
359
361public:
363
365
366 bool DoesBranch() override;
367
368 bool HasDelaySlot() override;
369
370 bool IsLoad() override;
371
372 bool IsBarrier() override;
373
374 bool IsAuthenticated() override;
375
377 const ExecutionContext *exe_ctx) override {
378 // TODO: fill this in and put opcode name into Instruction::m_opcode_name,
379 // mnemonic into Instruction::m_mnemonics, and any comment into
380 // Instruction::m_comment
381 }
382
383 size_t Decode(const Disassembler &disassembler, const DataExtractor &data,
384 lldb::offset_t data_offset) override;
385
386 void SetOpcode(size_t opcode_size, void *opcode_data);
387
388 void SetDescription(llvm::StringRef description) override;
389
390protected:
391 std::string m_description;
392
395};
396
397class Disassembler : public std::enable_shared_from_this<Disassembler>,
398 public PluginInterface {
399public:
400 enum {
402 eOptionShowBytes = (1u << 0),
403 eOptionRawOuput = (1u << 1),
404 eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains
405 // the current PC (mixed mode only)
407 (1u << 3), // Mark the disassembly line the contains the PC
410 };
411
416
417 // FindPlugin should be lax about the flavor string (it is too annoying to
418 // have various internal uses of the disassembler fail because the global
419 // flavor string gets set wrong. Instead, if you get a flavor string you
420 // don't understand, use the default. Folks who care to check can use the
421 // FlavorValidForArchSpec method on the disassembler they got back.
422 static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch,
423 const char *flavor, const char *cpu,
424 const char *features,
425 const char *plugin_name);
426
427 // This version will use the value in the Target settings if flavor is NULL;
429 FindPluginForTarget(const Target &target, const ArchSpec &arch,
430 const char *flavor, const char *cpu, const char *features,
431 const char *plugin_name);
432
437
439 DisassembleRange(const ArchSpec &arch, const char *plugin_name,
440 const char *flavor, const char *cpu, const char *features,
441 Target &target, llvm::ArrayRef<AddressRange> disasm_ranges,
442 bool force_live_memory = false);
443
445 DisassembleBytes(const ArchSpec &arch, const char *plugin_name,
446 const char *flavor, const char *cpu, const char *features,
447 const Address &start, const void *bytes, size_t length,
448 uint32_t max_num_instructions, bool data_from_file);
449
450 static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
451 const char *plugin_name, const char *flavor,
452 const char *cpu, const char *features,
453 const ExecutionContext &exe_ctx, const Address &start,
454 Limit limit, bool mixed_source_and_assembly,
455 uint32_t num_mixed_context_lines, uint32_t options,
456 Stream &strm);
457
458 static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
459 StackFrame &frame, Stream &strm);
460
461 // Constructors and Destructors
462 Disassembler(const ArchSpec &arch, const char *flavor);
463 ~Disassembler() override;
464
465 void PrintInstructions(Debugger &debugger, const ArchSpec &arch,
466 const ExecutionContext &exe_ctx,
467 bool mixed_source_and_assembly,
468 uint32_t num_mixed_context_lines, uint32_t options,
469 Stream &strm);
470
471 size_t ParseInstructions(Target &target, Address address, Limit limit,
472 Stream *error_strm_ptr,
473 bool force_live_memory = false) {
474 m_instruction_list.Clear();
475 return AppendInstructions(target, address, limit, error_strm_ptr,
476 force_live_memory);
477 }
478
479 virtual size_t DecodeInstructions(const Address &base_addr,
480 const DataExtractor &data,
481 lldb::offset_t data_offset,
482 size_t num_instructions, bool append,
483 bool data_from_file) = 0;
484
486
487 const InstructionList &GetInstructionList() const;
488
489 const ArchSpec &GetArchitecture() const { return m_arch; }
490
491 const char *GetFlavor() const { return m_flavor.c_str(); }
492
494 const char *flavor) = 0;
495
496protected:
497 size_t AppendInstructions(Target &target, Address address, Limit limit,
498 Stream *error_strm_ptr, bool force_live_memory);
499
500 // SourceLine and SourceLinesToDisplay structures are only used in the mixed
501 // source and assembly display methods internal to this class.
502
503 struct SourceLine {
506 uint32_t column = 0;
507
508 SourceLine() = default;
509
510 bool operator==(const SourceLine &rhs) const {
511 return file == rhs.file && line == rhs.line && rhs.column == column;
512 }
513
514 bool operator!=(const SourceLine &rhs) const {
515 return file != rhs.file || line != rhs.line || column != rhs.column;
516 }
517
518 bool IsValid() const { return line != LLDB_INVALID_LINE_NUMBER; }
519 };
520
522 std::vector<SourceLine> lines;
523
524 // index of the "current" source line, if we want to highlight that when
525 // displaying the source lines. (as opposed to the surrounding source
526 // lines provided to give context)
528
529 // Whether to print a blank line at the end of the source lines.
531
533 };
534
535 // Get the function's declaration line number, hopefully a line number
536 // earlier than the opening curly brace at the start of the function body.
538
539 // Add the provided SourceLine to the map of filenames-to-source-lines-seen.
540 static void AddLineToSourceLineTables(
541 SourceLine &line,
542 std::map<FileSpec, std::set<uint32_t>> &source_lines_seen);
543
544 // Given a source line, determine if we should print it when we're doing
545 // mixed source & assembly output. We're currently using the
546 // target.process.thread.step-avoid-regexp setting (which is used for
547 // stepping over inlined STL functions by default) to determine what source
548 // lines to avoid showing.
549 //
550 // Returns true if this source line should be elided (if the source line
551 // should not be displayed).
552 static bool
554 const SymbolContext &sc, SourceLine &line);
555
556 static bool
558 const SymbolContext &sc, LineEntry &line) {
559 SourceLine sl;
560 sl.file = line.GetFile();
561 sl.line = line.line;
562 sl.column = line.column;
563 return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
564 };
565
566 // Classes that inherit from Disassembler can see and modify these
569 std::string m_flavor;
570
571private:
572 // For Disassembler only
573 Disassembler(const Disassembler &) = delete;
574 const Disassembler &operator=(const Disassembler &) = delete;
575};
576
577/// Structured data for a single variable annotation.
579 std::string variable_name;
580 /// Location description (e.g., "r15", "undef", "const_0").
582 /// Whether variable is live at this instruction.
584 /// Register numbering scheme for location interpretation.
586 /// Where this annotation is valid.
587 std::optional<lldb_private::AddressRange> address_range;
588 /// Source file where variable was declared.
589 std::optional<std::string> decl_file;
590 /// Line number where variable was declared.
591 std::optional<uint32_t> decl_line;
592 /// Variable's type name.
593 std::optional<std::string> type_name;
594};
595
596/// Tracks live variable annotations across instructions and produces
597/// per-instruction "events" like `name = RDI` or `name = <undef>`.
599
600 // Live state from the previous instruction, keyed by Variable::GetID().
601 llvm::DenseMap<lldb::user_id_t, VariableAnnotation> m_live_vars;
602
603public:
604 /// Compute annotation strings for a single instruction and update
605 /// `m_live_vars`. Returns only the events that should be printed *at this
606 /// instruction*.
607 std::vector<std::string> Annotate(Instruction &inst);
608
609 /// Returns structured data for all variables relevant at this instruction.
610 std::vector<VariableAnnotation> AnnotateStructured(Instruction &inst);
611};
612
613} // namespace lldb_private
614
615#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:80
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)
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
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.