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"
14 #include "lldb/Core/FormatEntity.h"
15 #include "lldb/Core/Opcode.h"
18 #include "lldb/Symbol/LineEntry.h"
20 #include "lldb/Utility/ArchSpec.h"
22 #include "lldb/Utility/FileSpec.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 
41 namespace llvm {
42 template <typename T> class SmallVectorImpl;
43 }
44 
45 namespace lldb_private {
46 class AddressRange;
47 class DataExtractor;
48 class Debugger;
49 class Disassembler;
50 class Module;
51 class StackFrame;
52 class Stream;
53 class SymbolContext;
54 class SymbolContextList;
55 class Target;
56 struct RegisterInfo;
57 
58 class Instruction {
59 public:
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) {
69  return m_opcode_name.c_str();
70  }
71 
72  const char *GetOperands(const ExecutionContext *exe_ctx) {
74  return m_mnemonics.c_str();
75  }
76 
77  const char *GetComment(const ExecutionContext *exe_ctx) {
79  return m_comment.c_str();
80  }
81 
82  virtual void
84 
86 
87  void SetAddress(const Address &addr) {
88  // Invalidate the address class to lazily discover it if we need to.
90  m_address = addr;
91  }
92 
93  /// Dump the text representation of this Instruction to a Stream
94  ///
95  /// Print the (optional) address, (optional) bytes, opcode,
96  /// operands, and instruction comments to a stream.
97  ///
98  /// \param[in] s
99  /// The Stream to add the text to.
100  ///
101  /// \param[in] show_address
102  /// Whether the address (using disassembly_addr_format_spec formatting)
103  /// should be printed.
104  ///
105  /// \param[in] show_bytes
106  /// Whether the bytes of the assembly instruction should be printed.
107  ///
108  /// \param[in] max_opcode_byte_size
109  /// The size (in bytes) of the largest instruction in the list that
110  /// we are printing (for text justification/alignment purposes)
111  /// Only needed if show_bytes is true.
112  ///
113  /// \param[in] exe_ctx
114  /// The current execution context, if available. May be used in
115  /// the assembling of the operands+comments for this instruction.
116  /// Pass NULL if not applicable.
117  ///
118  /// \param[in] sym_ctx
119  /// The SymbolContext for this instruction.
120  /// Pass NULL if not available/computed.
121  /// Only needed if show_address is true.
122  ///
123  /// \param[in] prev_sym_ctx
124  /// The SymbolContext for the previous instruction. Depending on
125  /// the disassembly address format specification, a change in
126  /// Symbol / Function may mean that a line is printed with the new
127  /// symbol/function name.
128  /// Pass NULL if unavailable, or if this is the first instruction of
129  /// the InstructionList.
130  /// Only needed if show_address is true.
131  ///
132  /// \param[in] disassembly_addr_format
133  /// The format specification for how addresses are printed.
134  /// Only needed if show_address is true.
135  ///
136  /// \param[in] max_address_text_size
137  /// The length of the longest address string at the start of the
138  /// disassembly line that will be printed (the
139  /// Debugger::FormatDisassemblerAddress() string)
140  /// so this method can properly align the instruction opcodes.
141  /// May be 0 to indicate no indentation/alignment of the opcodes.
142  virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address,
143  bool show_bytes, const ExecutionContext *exe_ctx,
144  const SymbolContext *sym_ctx,
145  const SymbolContext *prev_sym_ctx,
146  const FormatEntity::Entry *disassembly_addr_format,
147  size_t max_address_text_size);
148 
149  virtual bool DoesBranch() = 0;
150 
151  virtual bool HasDelaySlot();
152 
153  bool CanSetBreakpoint ();
154 
155  virtual size_t Decode(const Disassembler &disassembler,
156  const DataExtractor &data,
157  lldb::offset_t data_offset) = 0;
158 
159  virtual void SetDescription(llvm::StringRef) {
160  } // May be overridden in sub-classes that have descriptions.
161 
162  lldb::OptionValueSP ReadArray(FILE *in_file, Stream *out_stream,
163  OptionValue::Type data_type);
164 
165  lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream *out_stream);
166 
167  bool DumpEmulation(const ArchSpec &arch);
168 
169  virtual bool TestEmulation(Stream *stream, const char *test_file_name);
170 
171  bool Emulate(const ArchSpec &arch, uint32_t evaluate_options, void *baton,
172  EmulateInstruction::ReadMemoryCallback read_mem_callback,
173  EmulateInstruction::WriteMemoryCallback write_mem_calback,
175  EmulateInstruction::WriteRegisterCallback write_reg_callback);
176 
177  const Opcode &GetOpcode() const { return m_opcode; }
178 
180 
181  struct Operand {
182  enum class Type {
183  Invalid = 0,
184  Register,
185  Immediate,
186  Dereference,
187  Sum,
188  Product
189  } m_type = Type::Invalid;
190  std::vector<Operand> m_children;
193  bool m_negative = false;
194  bool m_clobbered = false;
195 
196  bool IsValid() { return m_type != Type::Invalid; }
197 
198  static Operand BuildRegister(ConstString &r);
199  static Operand BuildImmediate(lldb::addr_t imm, bool neg);
200  static Operand BuildImmediate(int64_t imm);
201  static Operand BuildDereference(const Operand &ref);
202  static Operand BuildSum(const Operand &lhs, const Operand &rhs);
203  static Operand BuildProduct(const Operand &lhs, const Operand &rhs);
204  };
205 
207  return false;
208  }
209 
210  virtual bool IsCall() { return false; }
211 
212 protected:
213  Address m_address; // The section offset address of this instruction
214  // We include an address class in the Instruction class to
215  // allow the instruction specify the
216  // AddressClass::eCodeAlternateISA (currently used for
217  // thumb), and also to specify data (AddressClass::eData).
218  // The usual value will be AddressClass::eCode, but often
219  // when disassembling memory, you might run into data.
220  // This can help us to disassemble appropriately.
221 private:
222  AddressClass m_address_class; // Use GetAddressClass () accessor function!
223 
224 protected:
225  Opcode m_opcode; // The opcode for this instruction
230 
231  void
233  if (!m_calculated_strings) {
234  m_calculated_strings = true;
236  }
237  }
238 };
239 
240 namespace OperandMatchers {
241 std::function<bool(const Instruction::Operand &)>
242 MatchBinaryOp(std::function<bool(const Instruction::Operand &)> base,
243  std::function<bool(const Instruction::Operand &)> left,
244  std::function<bool(const Instruction::Operand &)> right);
245 
246 std::function<bool(const Instruction::Operand &)>
247 MatchUnaryOp(std::function<bool(const Instruction::Operand &)> base,
248  std::function<bool(const Instruction::Operand &)> child);
249 
250 std::function<bool(const Instruction::Operand &)>
251 MatchRegOp(const RegisterInfo &info);
252 
253 std::function<bool(const Instruction::Operand &)> FetchRegOp(ConstString &reg);
254 
255 std::function<bool(const Instruction::Operand &)> MatchImmOp(int64_t imm);
256 
257 std::function<bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm);
258 
259 std::function<bool(const Instruction::Operand &)>
261 }
262 
264 public:
265  InstructionList();
267 
268  size_t GetSize() const;
269 
271 
272  lldb::InstructionSP GetInstructionAtIndex(size_t idx) const;
273 
274  /// Get the instruction at the given address.
275  ///
276  /// \return
277  /// A valid \a InstructionSP if the address could be found, or null
278  /// otherwise.
279  lldb::InstructionSP GetInstructionAtAddress(const Address &addr);
280 
281  //------------------------------------------------------------------
282  /// Get the index of the next branch instruction.
283  ///
284  /// Given a list of instructions, find the next branch instruction
285  /// in the list by returning an index.
286  ///
287  /// @param[in] start
288  /// The instruction index of the first instruction to check.
289  ///
290  /// @param[in] ignore_calls
291  /// It true, then fine the first branch instruction that isn't
292  /// a function call (a branch that calls and returns to the next
293  /// instruction). If false, find the instruction index of any
294  /// branch in the list.
295  ///
296  /// @param[out] found_calls
297  /// If non-null, this will be set to true if any calls were found in
298  /// extending the range.
299  ///
300  /// @return
301  /// The instruction index of the first branch that is at or past
302  /// \a start. Returns UINT32_MAX if no matching branches are
303  /// found.
304  //------------------------------------------------------------------
306  bool ignore_calls,
307  bool *found_calls) const;
308 
310  Target &target);
311 
313 
314  void Clear();
315 
316  void Append(lldb::InstructionSP &inst_sp);
317 
318  void Dump(Stream *s, bool show_address, bool show_bytes,
319  const ExecutionContext *exe_ctx);
320 
321 private:
322  typedef std::vector<lldb::InstructionSP> collection;
323  typedef collection::iterator iterator;
324  typedef collection::const_iterator const_iterator;
325 
327 };
328 
330 public:
332 
333  ~PseudoInstruction() override;
334 
335  bool DoesBranch() override;
336 
337  bool HasDelaySlot() override;
338 
340  const ExecutionContext *exe_ctx) override {
341  // TODO: fill this in and put opcode name into Instruction::m_opcode_name,
342  // mnemonic into Instruction::m_mnemonics, and any comment into
343  // Instruction::m_comment
344  }
345 
346  size_t Decode(const Disassembler &disassembler, const DataExtractor &data,
347  lldb::offset_t data_offset) override;
348 
349  void SetOpcode(size_t opcode_size, void *opcode_data);
350 
351  void SetDescription(llvm::StringRef description) override;
352 
353 protected:
355 
356  PseudoInstruction(const PseudoInstruction &) = delete;
357  const PseudoInstruction &operator=(const PseudoInstruction &) = delete;
358 };
359 
360 class Disassembler : public std::enable_shared_from_this<Disassembler>,
361  public PluginInterface {
362 public:
363  enum {
365  eOptionShowBytes = (1u << 0),
366  eOptionRawOuput = (1u << 1),
367  eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains
368  // the current PC (mixed mode only)
370  (1u << 3) // Mark the disassembly line the contains the PC
371  };
372 
376  };
377 
378  // FindPlugin should be lax about the flavor string (it is too annoying to
379  // have various internal uses of the disassembler fail because the global
380  // flavor string gets set wrong. Instead, if you get a flavor string you
381  // don't understand, use the default. Folks who care to check can use the
382  // FlavorValidForArchSpec method on the disassembler they got back.
383  static lldb::DisassemblerSP
384  FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name);
385 
386  // This version will use the value in the Target settings if flavor is NULL;
387  static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
388  const ArchSpec &arch,
389  const char *flavor,
390  const char *plugin_name);
391 
392  struct Limit {
395  };
396 
397  static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch,
398  const char *plugin_name,
399  const char *flavor,
400  Target &target,
401  const AddressRange &disasm_range,
402  bool force_live_memory = false);
403 
404  static lldb::DisassemblerSP
405  DisassembleBytes(const ArchSpec &arch, const char *plugin_name,
406  const char *flavor, const Address &start, const void *bytes,
407  size_t length, uint32_t max_num_instructions,
408  bool data_from_file);
409 
410  static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
411  const char *plugin_name, const char *flavor,
412  const ExecutionContext &exe_ctx, const Address &start,
413  Limit limit, bool mixed_source_and_assembly,
414  uint32_t num_mixed_context_lines, uint32_t options,
415  Stream &strm);
416 
417  static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
418  StackFrame &frame, Stream &strm);
419 
420  // Constructors and Destructors
421  Disassembler(const ArchSpec &arch, const char *flavor);
422  ~Disassembler() override;
423 
424  void PrintInstructions(Debugger &debugger, const ArchSpec &arch,
425  const ExecutionContext &exe_ctx,
426  bool mixed_source_and_assembly,
427  uint32_t num_mixed_context_lines, uint32_t options,
428  Stream &strm);
429 
430  size_t ParseInstructions(Target &target, Address address, Limit limit,
431  Stream *error_strm_ptr,
432  bool force_live_memory = false);
433 
434  virtual size_t DecodeInstructions(const Address &base_addr,
435  const DataExtractor &data,
436  lldb::offset_t data_offset,
437  size_t num_instructions, bool append,
438  bool data_from_file) = 0;
439 
441 
442  const InstructionList &GetInstructionList() const;
443 
444  const ArchSpec &GetArchitecture() const { return m_arch; }
445 
446  const char *GetFlavor() const { return m_flavor.c_str(); }
447 
448  virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch,
449  const char *flavor) = 0;
450 
451 protected:
452  // SourceLine and SourceLinesToDisplay structures are only used in the mixed
453  // source and assembly display methods internal to this class.
454 
455  struct SourceLine {
459 
461 
462  bool operator==(const SourceLine &rhs) const {
463  return file == rhs.file && line == rhs.line && rhs.column == column;
464  }
465 
466  bool operator!=(const SourceLine &rhs) const {
467  return file != rhs.file || line != rhs.line || column != rhs.column;
468  }
469 
470  bool IsValid() const { return line != LLDB_INVALID_LINE_NUMBER; }
471  };
472 
474  std::vector<SourceLine> lines;
475 
476  // index of the "current" source line, if we want to highlight that when
477  // displaying the source lines. (as opposed to the surrounding source
478  // lines provided to give context)
480 
481  // Whether to print a blank line at the end of the source lines.
483 
486  }
487  };
488 
489  // Get the function's declaration line number, hopefully a line number
490  // earlier than the opening curly brace at the start of the function body.
491  static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc);
492 
493  // Add the provided SourceLine to the map of filenames-to-source-lines-seen.
494  static void AddLineToSourceLineTables(
495  SourceLine &line,
496  std::map<FileSpec, std::set<uint32_t>> &source_lines_seen);
497 
498  // Given a source line, determine if we should print it when we're doing
499  // mixed source & assembly output. We're currently using the
500  // target.process.thread.step-avoid-regexp setting (which is used for
501  // stepping over inlined STL functions by default) to determine what source
502  // lines to avoid showing.
503  //
504  // Returns true if this source line should be elided (if the source line
505  // should not be displayed).
506  static bool
508  const SymbolContext &sc, SourceLine &line);
509 
510  static bool
512  const SymbolContext &sc, LineEntry &line) {
513  SourceLine sl;
514  sl.file = line.file;
515  sl.line = line.line;
516  sl.column = line.column;
517  return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
518  };
519 
520  // Classes that inherit from Disassembler can see and modify these
525 
526 private:
527  // For Disassembler only
528  Disassembler(const Disassembler &) = delete;
529  const Disassembler &operator=(const Disassembler &) = delete;
530 };
531 
532 } // namespace lldb_private
533 
534 #endif // LLDB_CORE_DISASSEMBLER_H
lldb_private::Disassembler::SourceLinesToDisplay::current_source_line
size_t current_source_line
Definition: Disassembler.h:479
lldb_private::Disassembler::SourceLine::SourceLine
SourceLine()
Definition: Disassembler.h:460
lldb_private::Disassembler::eOptionNone
@ eOptionNone
Definition: Disassembler.h:364
lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, SourceLine &line)
Definition: Disassembler.cpp:237
lldb_private::ExecutionContext
Definition: ExecutionContext.h:291
llvm
Definition: Debugger.h:49
lldb_private::EmulateInstruction::ReadMemoryCallback
size_t(* ReadMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, void *dst, size_t length)
Definition: EmulateInstruction.h:326
lldb_private::LineEntry::file
FileSpec file
The source file, possibly mapped by the target.source-map setting.
Definition: LineEntry.h:140
lldb_private::Instruction::IsCall
virtual bool IsCall()
Definition: Disassembler.h:210
lldb_private::EmulateInstruction::WriteRegisterCallback
bool(* WriteRegisterCallback)(EmulateInstruction *instruction, void *baton, const Context &context, const RegisterInfo *reg_info, const RegisterValue &reg_value)
Definition: EmulateInstruction.h:341
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::Instruction::Operand::m_immediate
lldb::addr_t m_immediate
Definition: Disassembler.h:191
lldb_private::Instruction::GetData
uint32_t GetData(DataExtractor &data)
Definition: Disassembler.cpp:924
lldb_private::Instruction::Operand::m_negative
bool m_negative
Definition: Disassembler.h:193
lldb_private::Instruction::Operand::m_register
ConstString m_register
Definition: Disassembler.h:192
lldb_private::Opcode
Definition: Opcode.h:29
lldb_private::OperandMatchers::FetchImmOp
std::function< bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm)
Definition: Disassembler.h:257
lldb_private::Instruction::GetOperands
const char * GetOperands(const ExecutionContext *exe_ctx)
Definition: Disassembler.h:72
lldb_private::AddressClass
AddressClass
Definition: lldb-private-enumerations.h:48
Opcode.h
lldb_private::OperandMatchers::MatchOpType
std::function< bool(const Instruction::Operand &)> MatchOpType(Instruction::Operand::Type type)
Definition: Disassembler.h:260
lldb_private::Disassembler::~Disassembler
~Disassembler() override
lldb_private::Disassembler::m_base_addr
lldb::addr_t m_base_addr
Definition: Disassembler.h:523
lldb_private::Disassembler::SourceLine::file
FileSpec file
Definition: Disassembler.h:456
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb-defines.h
lldb_private::Instruction::m_mnemonics
std::string m_mnemonics
Definition: Disassembler.h:227
lldb_private::Instruction::GetAddressClass
AddressClass GetAddressClass()
Definition: Disassembler.cpp:572
lldb_private::Disassembler::FindPlugin
static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name)
Definition: Disassembler.cpp:58
lldb_private::PseudoInstruction::m_description
std::string m_description
Definition: Disassembler.h:354
lldb_private::Disassembler::SourceLinesToDisplay::SourceLinesToDisplay
SourceLinesToDisplay()
Definition: Disassembler.h:484
lldb_private::PseudoInstruction
Definition: Disassembler.h:329
lldb_private::Instruction::Decode
virtual size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset)=0
lldb_private::Disassembler::Limit::Bytes
@ Bytes
Definition: Disassembler.h:393
lldb_private::InstructionList::GetIndexOfInstructionAtLoadAddress
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target)
Definition: Disassembler.cpp:1030
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
lldb_private::InstructionList::GetInstructionAtIndex
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const
Definition: Disassembler.cpp:946
lldb_private::Disassembler::Limit
Definition: Disassembler.h:392
lldb_private::Instruction
Definition: Disassembler.h:58
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::Instruction::m_address_class
AddressClass m_address_class
Definition: Disassembler.h:222
lldb_private::Instruction::Operand::m_children
std::vector< Operand > m_children
Definition: Disassembler.h:190
lldb_private::Disassembler::Limit::kind
enum lldb_private::Disassembler::Limit::@6 kind
lldb-private-enumerations.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:445
lldb_private::Disassembler::eOptionShowBytes
@ eOptionShowBytes
Definition: Disassembler.h:365
lldb_private::Instruction::m_opcode_name
std::string m_opcode_name
Definition: Disassembler.h:226
lldb_private::AddressClass::eInvalid
@ eInvalid
lldb_private::Instruction::CalculateMnemonicOperandsAndComment
virtual void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx)=0
lldb_private::Disassembler::DisassembleBytes
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)
Definition: Disassembler.cpp:148
lldb_private::Instruction::GetOpcode
const Opcode & GetOpcode() const
Definition: Disassembler.h:177
lldb_private::Instruction::~Instruction
virtual ~Instruction()
lldb_private::Instruction::DumpEmulation
bool DumpEmulation(const ArchSpec &arch)
Definition: Disassembler.cpp:639
lldb_private::Instruction::Instruction
Instruction(const Address &address, AddressClass addr_class=AddressClass::eInvalid)
Definition: Disassembler.cpp:566
OptionValue.h
lldb_private::Instruction::Operand::Type::Sum
@ Sum
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::Instruction::Operand::Type
Type
Definition: Disassembler.h:182
lldb_private::Disassembler::m_flavor
std::string m_flavor
Definition: Disassembler.h:524
lldb_private::Disassembler::SourceLinesToDisplay::print_source_context_end_eol
bool print_source_context_end_eol
Definition: Disassembler.h:482
lldb_private::InstructionList
Definition: Disassembler.h:263
lldb_private::OperandMatchers::FetchRegOp
std::function< bool(const Instruction::Operand &)> FetchRegOp(ConstString &reg)
Definition: Disassembler.h:253
lldb_private::Disassembler::eHexStyleC
@ eHexStyleC
Definition: Disassembler.h:374
lldb_private::Disassembler::DisassembleRange
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)
Definition: Disassembler.cpp:123
lldb_private::Instruction::Dump
virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, 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.
Definition: Disassembler.cpp:578
EmulateInstruction.h
lldb_private::OperandMatchers::MatchBinaryOp
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)
Definition: Disassembler.h:242
lldb_private::DataExtractor
Definition: DataExtractor.h:48
lldb_private::Instruction::ReadArray
lldb::OptionValueSP ReadArray(FILE *in_file, Stream *out_stream, OptionValue::Type data_type)
Definition: Disassembler.cpp:659
lldb_private::Disassembler::eHexStyleAsm
@ eHexStyleAsm
Definition: Disassembler.h:375
lldb_private::Disassembler::SourceLine::IsValid
bool IsValid() const
Definition: Disassembler.h:470
lldb_private::PseudoInstruction::Decode
size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) override
Definition: Disassembler.cpp:1126
LineEntry.h
lldb_private::Disassembler::DecodeInstructions
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
lldb_private::Instruction::m_opcode
Opcode m_opcode
Definition: Disassembler.h:225
lldb_private::Disassembler::PrintInstructions
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)
Definition: Disassembler.cpp:279
lldb_private::Instruction::GetAddress
const Address & GetAddress() const
Definition: Disassembler.h:65
lldb_private::Disassembler::Disassemble
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)
Definition: Disassembler.cpp:169
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::Instruction::HasDelaySlot
virtual bool HasDelaySlot()
Definition: Disassembler.cpp:654
lldb_private::Instruction::CalculateMnemonicOperandsAndCommentIfNeeded
void CalculateMnemonicOperandsAndCommentIfNeeded(const ExecutionContext *exe_ctx)
Definition: Disassembler.h:232
lldb_private::Disassembler::SourceLine::line
uint32_t line
Definition: Disassembler.h:457
lldb_private::Instruction::GetComment
const char * GetComment(const ExecutionContext *exe_ctx)
Definition: Disassembler.h:77
PluginInterface.h
lldb_private::Instruction::Operand::BuildDereference
static Operand BuildDereference(const Operand &ref)
Definition: Disassembler.cpp:1196
lldb_private::Disassembler::SourceLine::operator==
bool operator==(const SourceLine &rhs) const
Definition: Disassembler.h:462
lldb_private::OperandMatchers::MatchImmOp
std::function< bool(const Instruction::Operand &)> MatchImmOp(int64_t imm)
Definition: Disassembler.h:255
lldb_private::InstructionList::GetIndexOfNextBranchInstruction
uint32_t GetIndexOfNextBranchInstruction(uint32_t start, bool ignore_calls, bool *found_calls) const
Get the index of the next branch instruction.
Definition: Disassembler.cpp:992
lldb_private::Instruction::Operand
Definition: Disassembler.h:181
lldb_private::Disassembler::m_instruction_list
InstructionList m_instruction_list
Definition: Disassembler.h:522
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::Instruction::Operand::BuildImmediate
static Operand BuildImmediate(lldb::addr_t imm, bool neg)
Definition: Disassembler.cpp:1173
lldb_private::InstructionList::GetMaxOpcocdeByteSize
uint32_t GetMaxOpcocdeByteSize() const
Definition: Disassembler.cpp:934
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:38
lldb_private::EmulateInstruction::WriteMemoryCallback
size_t(* WriteMemoryCallback)(EmulateInstruction *instruction, void *baton, const Context &context, lldb::addr_t addr, const void *dst, size_t length)
Definition: EmulateInstruction.h:331
lldb_private::LineEntry::column
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition: LineEntry.h:145
lldb_private::Instruction::Operand::BuildRegister
static Operand BuildRegister(ConstString &r)
Definition: Disassembler.cpp:1166
Address.h
lldb_private::Disassembler::SourceLine
Definition: Disassembler.h:455
lldb_private::Instruction::m_comment
std::string m_comment
Definition: Disassembler.h:228
lldb_private::Disassembler::operator=
const Disassembler & operator=(const Disassembler &)=delete
lldb_private::Disassembler::Limit::value
lldb::addr_t value
Definition: Disassembler.h:394
lldb_private::Disassembler::eOptionMarkPCAddress
@ eOptionMarkPCAddress
Definition: Disassembler.h:369
lldb_private::Instruction::Operand::Type::Register
@ Register
lldb_private::LineEntry::line
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:143
lldb_private::InstructionList::iterator
collection::iterator iterator
Definition: Disassembler.h:323
LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_LINE_NUMBER
Definition: lldb-defines.h:97
lldb_private::Instruction::Operand::Type::Invalid
@ Invalid
lldb-types.h
lldb_private::Disassembler::GetFunctionDeclLineEntry
static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc)
Definition: Disassembler.cpp:197
lldb_private::Instruction::Operand::Type::Dereference
@ Dereference
lldb_private::OperandMatchers::MatchRegOp
std::function< bool(const Instruction::Operand &)> MatchRegOp(const RegisterInfo &info)
Definition: Disassembler.h:251
lldb_private::InstructionList::const_iterator
collection::const_iterator const_iterator
Definition: Disassembler.h:324
lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, LineEntry &line)
Definition: Disassembler.h:511
lldb_private::Instruction::Operand::BuildProduct
static Operand BuildProduct(const Operand &lhs, const Operand &rhs)
Definition: Disassembler.cpp:1211
lldb_private::PseudoInstruction::DoesBranch
bool DoesBranch() override
Definition: Disassembler.cpp:1116
lldb_private::Instruction::Operand::BuildSum
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
Definition: Disassembler.cpp:1203
lldb_private::PseudoInstruction::PseudoInstruction
PseudoInstruction()
Definition: Disassembler.cpp:1111
lldb_private::OptionValue::Type
Type
Definition: OptionValue.h:26
lldb_private::PseudoInstruction::CalculateMnemonicOperandsAndComment
void CalculateMnemonicOperandsAndComment(const ExecutionContext *exe_ctx) override
Definition: Disassembler.h:339
lldb_private::OperandMatchers::MatchUnaryOp
std::function< bool(const Instruction::Operand &)> MatchUnaryOp(std::function< bool(const Instruction::Operand &)> base, std::function< bool(const Instruction::Operand &)> child)
Definition: Disassembler.h:247
uint32_t
lldb_private::InstructionList::collection
std::vector< lldb::InstructionSP > collection
Definition: Disassembler.h:322
lldb_private::Address
Definition: Address.h:59
lldb_private::Instruction::GetMnemonic
const char * GetMnemonic(const ExecutionContext *exe_ctx)
Definition: Disassembler.h:67
lldb_private::Disassembler::Limit::Instructions
@ Instructions
Definition: Disassembler.h:393
lldb_private::Disassembler::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Disassembler.h:444
lldb_private::Instruction::m_address
Address m_address
Definition: Disassembler.h:213
lldb_private::Disassembler::HexImmediateStyle
HexImmediateStyle
Definition: Disassembler.h:373
lldb_private::InstructionList::m_instructions
collection m_instructions
Definition: Disassembler.h:326
ArchSpec.h
lldb_private::FormatEntity::Entry
Definition: FormatEntity.h:40
FormatEntity.h
lldb_private::Instruction::m_calculated_strings
bool m_calculated_strings
Definition: Disassembler.h:229
lldb_private::Disassembler::SourceLinesToDisplay
Definition: Disassembler.h:473
lldb_private::InstructionList::InstructionList
InstructionList()
Definition: Disassembler.cpp:928
lldb_private::Instruction::Operand::m_type
enum lldb_private::Instruction::Operand::Type m_type
lldb_private::InstructionList::Clear
void Clear()
Definition: Disassembler.cpp:984
lldb_private::Instruction::SetDescription
virtual void SetDescription(llvm::StringRef)
Definition: Disassembler.h:159
lldb_private::InstructionList::GetSize
size_t GetSize() const
Definition: Disassembler.cpp:932
lldb-forward.h
lldb_private::Disassembler::SourceLine::column
uint32_t column
Definition: Disassembler.h:458
lldb_private::Disassembler::AddLineToSourceLineTables
static void AddLineToSourceLineTables(SourceLine &line, std::map< FileSpec, std::set< uint32_t >> &source_lines_seen)
Definition: Disassembler.cpp:222
lldb_private::InstructionList::GetInstructionAtAddress
lldb::InstructionSP GetInstructionAtAddress(const Address &addr)
Get the instruction at the given address.
Definition: Disassembler.cpp:953
lldb_private::Instruction::DoesBranch
virtual bool DoesBranch()=0
lldb_private::Disassembler
Definition: Disassembler.h:360
lldb_private::Disassembler::FlavorValidForArchSpec
virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, const char *flavor)=0
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Instruction::Operand::Type::Product
@ Product
lldb_private::PseudoInstruction::~PseudoInstruction
~PseudoInstruction() override
lldb_private::Disassembler::SourceLine::operator!=
bool operator!=(const SourceLine &rhs) const
Definition: Disassembler.h:466
lldb_private::Disassembler::GetInstructionList
InstructionList & GetInstructionList()
Definition: Disassembler.cpp:1101
lldb_private::Instruction::ReadDictionary
lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream *out_stream)
Definition: Disassembler.cpp:718
lldb_private::Instruction::ParseOperands
virtual bool ParseOperands(llvm::SmallVectorImpl< Operand > &operands)
Definition: Disassembler.h:206
lldb_private::PseudoInstruction::SetOpcode
void SetOpcode(size_t opcode_size, void *opcode_data)
Definition: Disassembler.cpp:1132
FileSpec.h
lldb_private::Instruction::SetAddress
void SetAddress(const Address &addr)
Definition: Disassembler.h:87
ConstString.h
lldb_private::InstructionList::Dump
void Dump(Stream *s, bool show_address, bool show_bytes, const ExecutionContext *exe_ctx)
Definition: Disassembler.cpp:960
lldb_private::Disassembler::GetFlavor
const char * GetFlavor() const
Definition: Disassembler.h:446
lldb_private::Disassembler::FindPluginForTarget
static lldb::DisassemblerSP FindPluginForTarget(const Target &target, const ArchSpec &arch, const char *flavor, const char *plugin_name)
Definition: Disassembler.cpp:90
lldb_private::InstructionList::Append
void Append(lldb::InstructionSP &inst_sp)
Definition: Disassembler.cpp:986
lldb_private::InstructionList::~InstructionList
~InstructionList()
llvm::SmallVectorImpl
Definition: Disassembler.h:42
lldb_private::PseudoInstruction::operator=
const PseudoInstruction & operator=(const PseudoInstruction &)=delete
lldb_private::Instruction::CanSetBreakpoint
bool CanSetBreakpoint()
Definition: Disassembler.cpp:650
lldb_private::InstructionList::GetIndexOfInstructionAtAddress
uint32_t GetIndexOfInstructionAtAddress(const Address &addr)
Definition: Disassembler.cpp:1017
lldb_private::Disassembler::m_arch
ArchSpec m_arch
Definition: Disassembler.h:518
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::PseudoInstruction::SetDescription
void SetDescription(llvm::StringRef description) override
Definition: Disassembler.cpp:1162
lldb_private::Instruction::Operand::IsValid
bool IsValid()
Definition: Disassembler.h:196
lldb_private::Disassembler::ParseInstructions
size_t ParseInstructions(Target &target, Address address, Limit limit, Stream *error_strm_ptr, bool force_live_memory=false)
Definition: Disassembler.cpp:1037
lldb_private::Instruction::Emulate
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)
Definition: Disassembler.cpp:905
lldb_private::Disassembler::eOptionMarkPCSourceLine
@ eOptionMarkPCSourceLine
Definition: Disassembler.h:367
lldb_private::LineEntry
Definition: LineEntry.h:20
lldb_private::Disassembler::Disassembler
Disassembler(const ArchSpec &arch, const char *flavor)
Definition: Disassembler.cpp:1078
ExecutionContext.h
lldb_private::Instruction::TestEmulation
virtual bool TestEmulation(Stream *stream, const char *test_file_name)
Definition: Disassembler.cpp:822
lldb_private::EmulateInstruction::ReadRegisterCallback
bool(* ReadRegisterCallback)(EmulateInstruction *instruction, void *baton, const RegisterInfo *reg_info, RegisterValue &reg_value)
Definition: EmulateInstruction.h:336
lldb_private::Instruction::Operand::m_clobbered
bool m_clobbered
Definition: Disassembler.h:194
lldb_private::Disassembler::eOptionRawOuput
@ eOptionRawOuput
Definition: Disassembler.h:366
lldb_private::Disassembler::SourceLinesToDisplay::lines
std::vector< SourceLine > lines
Definition: Disassembler.h:474
lldb_private::Instruction::Operand::Type::Immediate
@ Immediate
lldb_private::PseudoInstruction::HasDelaySlot
bool HasDelaySlot() override
Definition: Disassembler.cpp:1121