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  virtual bool IsLoad() = 0;
154 
155  virtual bool IsAuthenticated() = 0;
156 
157  bool CanSetBreakpoint ();
158 
159  virtual size_t Decode(const Disassembler &disassembler,
160  const DataExtractor &data,
161  lldb::offset_t data_offset) = 0;
162 
163  virtual void SetDescription(llvm::StringRef) {
164  } // May be overridden in sub-classes that have descriptions.
165 
166  lldb::OptionValueSP ReadArray(FILE *in_file, Stream *out_stream,
167  OptionValue::Type data_type);
168 
169  lldb::OptionValueSP ReadDictionary(FILE *in_file, Stream *out_stream);
170 
171  bool DumpEmulation(const ArchSpec &arch);
172 
173  virtual bool TestEmulation(Stream *stream, const char *test_file_name);
174 
175  bool Emulate(const ArchSpec &arch, uint32_t evaluate_options, void *baton,
176  EmulateInstruction::ReadMemoryCallback read_mem_callback,
177  EmulateInstruction::WriteMemoryCallback write_mem_calback,
179  EmulateInstruction::WriteRegisterCallback write_reg_callback);
180 
181  const Opcode &GetOpcode() const { return m_opcode; }
182 
184 
185  struct Operand {
186  enum class Type {
187  Invalid = 0,
188  Register,
189  Immediate,
190  Dereference,
191  Sum,
192  Product
193  } m_type = Type::Invalid;
194  std::vector<Operand> m_children;
197  bool m_negative = false;
198  bool m_clobbered = false;
199 
200  bool IsValid() { return m_type != Type::Invalid; }
201 
202  static Operand BuildRegister(ConstString &r);
203  static Operand BuildImmediate(lldb::addr_t imm, bool neg);
204  static Operand BuildImmediate(int64_t imm);
205  static Operand BuildDereference(const Operand &ref);
206  static Operand BuildSum(const Operand &lhs, const Operand &rhs);
207  static Operand BuildProduct(const Operand &lhs, const Operand &rhs);
208  };
209 
211  return false;
212  }
213 
214  virtual bool IsCall() { return false; }
215 
216 protected:
217  Address m_address; // The section offset address of this instruction
218  // We include an address class in the Instruction class to
219  // allow the instruction specify the
220  // AddressClass::eCodeAlternateISA (currently used for
221  // thumb), and also to specify data (AddressClass::eData).
222  // The usual value will be AddressClass::eCode, but often
223  // when disassembling memory, you might run into data.
224  // This can help us to disassemble appropriately.
225 private:
226  AddressClass m_address_class; // Use GetAddressClass () accessor function!
227 
228 protected:
229  Opcode m_opcode; // The opcode for this instruction
234 
235  void
237  if (!m_calculated_strings) {
238  m_calculated_strings = true;
240  }
241  }
242 };
243 
244 namespace OperandMatchers {
245 std::function<bool(const Instruction::Operand &)>
246 MatchBinaryOp(std::function<bool(const Instruction::Operand &)> base,
247  std::function<bool(const Instruction::Operand &)> left,
248  std::function<bool(const Instruction::Operand &)> right);
249 
250 std::function<bool(const Instruction::Operand &)>
251 MatchUnaryOp(std::function<bool(const Instruction::Operand &)> base,
252  std::function<bool(const Instruction::Operand &)> child);
253 
254 std::function<bool(const Instruction::Operand &)>
255 MatchRegOp(const RegisterInfo &info);
256 
257 std::function<bool(const Instruction::Operand &)> FetchRegOp(ConstString &reg);
258 
259 std::function<bool(const Instruction::Operand &)> MatchImmOp(int64_t imm);
260 
261 std::function<bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm);
262 
263 std::function<bool(const Instruction::Operand &)>
265 }
266 
268 public:
269  InstructionList();
271 
272  size_t GetSize() const;
273 
275 
276  lldb::InstructionSP GetInstructionAtIndex(size_t idx) const;
277 
278  /// Get the instruction at the given address.
279  ///
280  /// \return
281  /// A valid \a InstructionSP if the address could be found, or null
282  /// otherwise.
283  lldb::InstructionSP GetInstructionAtAddress(const Address &addr);
284 
285  //------------------------------------------------------------------
286  /// Get the index of the next branch instruction.
287  ///
288  /// Given a list of instructions, find the next branch instruction
289  /// in the list by returning an index.
290  ///
291  /// @param[in] start
292  /// The instruction index of the first instruction to check.
293  ///
294  /// @param[in] ignore_calls
295  /// It true, then fine the first branch instruction that isn't
296  /// a function call (a branch that calls and returns to the next
297  /// instruction). If false, find the instruction index of any
298  /// branch in the list.
299  ///
300  /// @param[out] found_calls
301  /// If non-null, this will be set to true if any calls were found in
302  /// extending the range.
303  ///
304  /// @return
305  /// The instruction index of the first branch that is at or past
306  /// \a start. Returns UINT32_MAX if no matching branches are
307  /// found.
308  //------------------------------------------------------------------
310  bool ignore_calls,
311  bool *found_calls) const;
312 
314  Target &target);
315 
317 
318  void Clear();
319 
320  void Append(lldb::InstructionSP &inst_sp);
321 
322  void Dump(Stream *s, bool show_address, bool show_bytes,
323  const ExecutionContext *exe_ctx);
324 
325 private:
326  typedef std::vector<lldb::InstructionSP> collection;
327  typedef collection::iterator iterator;
328  typedef collection::const_iterator const_iterator;
329 
331 };
332 
334 public:
336 
337  ~PseudoInstruction() override;
338 
339  bool DoesBranch() override;
340 
341  bool HasDelaySlot() override;
342 
343  bool IsLoad() override;
344 
345  bool IsAuthenticated() override;
346 
348  const ExecutionContext *exe_ctx) override {
349  // TODO: fill this in and put opcode name into Instruction::m_opcode_name,
350  // mnemonic into Instruction::m_mnemonics, and any comment into
351  // Instruction::m_comment
352  }
353 
354  size_t Decode(const Disassembler &disassembler, const DataExtractor &data,
355  lldb::offset_t data_offset) override;
356 
357  void SetOpcode(size_t opcode_size, void *opcode_data);
358 
359  void SetDescription(llvm::StringRef description) override;
360 
361 protected:
363 
364  PseudoInstruction(const PseudoInstruction &) = delete;
365  const PseudoInstruction &operator=(const PseudoInstruction &) = delete;
366 };
367 
368 class Disassembler : public std::enable_shared_from_this<Disassembler>,
369  public PluginInterface {
370 public:
371  enum {
373  eOptionShowBytes = (1u << 0),
374  eOptionRawOuput = (1u << 1),
375  eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains
376  // the current PC (mixed mode only)
378  (1u << 3) // Mark the disassembly line the contains the PC
379  };
380 
384  };
385 
386  // FindPlugin should be lax about the flavor string (it is too annoying to
387  // have various internal uses of the disassembler fail because the global
388  // flavor string gets set wrong. Instead, if you get a flavor string you
389  // don't understand, use the default. Folks who care to check can use the
390  // FlavorValidForArchSpec method on the disassembler they got back.
391  static lldb::DisassemblerSP
392  FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name);
393 
394  // This version will use the value in the Target settings if flavor is NULL;
395  static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
396  const ArchSpec &arch,
397  const char *flavor,
398  const char *plugin_name);
399 
400  struct Limit {
403  };
404 
405  static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch,
406  const char *plugin_name,
407  const char *flavor,
408  Target &target,
409  const AddressRange &disasm_range,
410  bool force_live_memory = false);
411 
412  static lldb::DisassemblerSP
413  DisassembleBytes(const ArchSpec &arch, const char *plugin_name,
414  const char *flavor, const Address &start, const void *bytes,
415  size_t length, uint32_t max_num_instructions,
416  bool data_from_file);
417 
418  static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
419  const char *plugin_name, const char *flavor,
420  const ExecutionContext &exe_ctx, const Address &start,
421  Limit limit, bool mixed_source_and_assembly,
422  uint32_t num_mixed_context_lines, uint32_t options,
423  Stream &strm);
424 
425  static bool Disassemble(Debugger &debugger, const ArchSpec &arch,
426  StackFrame &frame, Stream &strm);
427 
428  // Constructors and Destructors
429  Disassembler(const ArchSpec &arch, const char *flavor);
430  ~Disassembler() override;
431 
432  void PrintInstructions(Debugger &debugger, const ArchSpec &arch,
433  const ExecutionContext &exe_ctx,
434  bool mixed_source_and_assembly,
435  uint32_t num_mixed_context_lines, uint32_t options,
436  Stream &strm);
437 
438  size_t ParseInstructions(Target &target, Address address, Limit limit,
439  Stream *error_strm_ptr,
440  bool force_live_memory = false);
441 
442  virtual size_t DecodeInstructions(const Address &base_addr,
443  const DataExtractor &data,
444  lldb::offset_t data_offset,
445  size_t num_instructions, bool append,
446  bool data_from_file) = 0;
447 
449 
450  const InstructionList &GetInstructionList() const;
451 
452  const ArchSpec &GetArchitecture() const { return m_arch; }
453 
454  const char *GetFlavor() const { return m_flavor.c_str(); }
455 
456  virtual bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch,
457  const char *flavor) = 0;
458 
459 protected:
460  // SourceLine and SourceLinesToDisplay structures are only used in the mixed
461  // source and assembly display methods internal to this class.
462 
463  struct SourceLine {
467 
468  SourceLine() : file() {}
469 
470  bool operator==(const SourceLine &rhs) const {
471  return file == rhs.file && line == rhs.line && rhs.column == column;
472  }
473 
474  bool operator!=(const SourceLine &rhs) const {
475  return file != rhs.file || line != rhs.line || column != rhs.column;
476  }
477 
478  bool IsValid() const { return line != LLDB_INVALID_LINE_NUMBER; }
479  };
480 
482  std::vector<SourceLine> lines;
483 
484  // index of the "current" source line, if we want to highlight that when
485  // displaying the source lines. (as opposed to the surrounding source
486  // lines provided to give context)
487  size_t current_source_line = -1;
488 
489  // Whether to print a blank line at the end of the source lines.
491 
493  };
494 
495  // Get the function's declaration line number, hopefully a line number
496  // earlier than the opening curly brace at the start of the function body.
497  static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc);
498 
499  // Add the provided SourceLine to the map of filenames-to-source-lines-seen.
500  static void AddLineToSourceLineTables(
501  SourceLine &line,
502  std::map<FileSpec, std::set<uint32_t>> &source_lines_seen);
503 
504  // Given a source line, determine if we should print it when we're doing
505  // mixed source & assembly output. We're currently using the
506  // target.process.thread.step-avoid-regexp setting (which is used for
507  // stepping over inlined STL functions by default) to determine what source
508  // lines to avoid showing.
509  //
510  // Returns true if this source line should be elided (if the source line
511  // should not be displayed).
512  static bool
514  const SymbolContext &sc, SourceLine &line);
515 
516  static bool
518  const SymbolContext &sc, LineEntry &line) {
519  SourceLine sl;
520  sl.file = line.file;
521  sl.line = line.line;
522  sl.column = line.column;
523  return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
524  };
525 
526  // Classes that inherit from Disassembler can see and modify these
531 
532 private:
533  // For Disassembler only
534  Disassembler(const Disassembler &) = delete;
535  const Disassembler &operator=(const Disassembler &) = delete;
536 };
537 
538 } // namespace lldb_private
539 
540 #endif // LLDB_CORE_DISASSEMBLER_H
lldb_private::Disassembler::SourceLinesToDisplay::current_source_line
size_t current_source_line
Definition: Disassembler.h:487
lldb_private::Disassembler::SourceLine::SourceLine
SourceLine()
Definition: Disassembler.h:468
lldb_private::Disassembler::eOptionNone
@ eOptionNone
Definition: Disassembler.h:372
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:292
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:214
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:195
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:197
lldb_private::Instruction::Operand::m_register
ConstString m_register
Definition: Disassembler.h:196
lldb_private::Opcode
Definition: Opcode.h:29
lldb_private::OperandMatchers::FetchImmOp
std::function< bool(const Instruction::Operand &)> FetchImmOp(int64_t &imm)
Definition: Disassembler.h:261
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:264
lldb_private::Disassembler::~Disassembler
~Disassembler() override
lldb_private::Disassembler::m_base_addr
lldb::addr_t m_base_addr
Definition: Disassembler.h:529
lldb_private::Disassembler::SourceLine::file
FileSpec file
Definition: Disassembler.h:464
lldb_private::PluginInterface
Definition: PluginInterface.h:16
lldb-defines.h
lldb_private::Instruction::m_mnemonics
std::string m_mnemonics
Definition: Disassembler.h:231
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:362
lldb_private::Disassembler::SourceLinesToDisplay::SourceLinesToDisplay
SourceLinesToDisplay()
Definition: Disassembler.h:492
lldb_private::PseudoInstruction
Definition: Disassembler.h:333
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:401
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:400
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:226
lldb_private::Instruction::Operand::m_children
std::vector< Operand > m_children
Definition: Disassembler.h:194
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:454
lldb_private::Disassembler::eOptionShowBytes
@ eOptionShowBytes
Definition: Disassembler.h:373
lldb_private::Instruction::m_opcode_name
std::string m_opcode_name
Definition: Disassembler.h:230
lldb_private::AddressClass::eInvalid
@ eInvalid
lldb_private::Instruction::IsLoad
virtual bool IsLoad()=0
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:181
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:186
lldb_private::Disassembler::m_flavor
std::string m_flavor
Definition: Disassembler.h:530
lldb_private::Disassembler::SourceLinesToDisplay::print_source_context_end_eol
bool print_source_context_end_eol
Definition: Disassembler.h:490
lldb_private::InstructionList
Definition: Disassembler.h:267
lldb_private::OperandMatchers::FetchRegOp
std::function< bool(const Instruction::Operand &)> FetchRegOp(ConstString &reg)
Definition: Disassembler.h:257
lldb_private::Disassembler::eHexStyleC
@ eHexStyleC
Definition: Disassembler.h:382
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:246
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:383
lldb_private::Disassembler::SourceLine::IsValid
bool IsValid() const
Definition: Disassembler.h:478
lldb_private::PseudoInstruction::Decode
size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) override
Definition: Disassembler.cpp:1130
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:229
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:236
lldb_private::Disassembler::SourceLine::line
uint32_t line
Definition: Disassembler.h:465
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:1200
lldb_private::Disassembler::SourceLine::operator==
bool operator==(const SourceLine &rhs) const
Definition: Disassembler.h:470
lldb_private::OperandMatchers::MatchImmOp
std::function< bool(const Instruction::Operand &)> MatchImmOp(int64_t imm)
Definition: Disassembler.h:259
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:185
lldb_private::PseudoInstruction::IsAuthenticated
bool IsAuthenticated() override
Definition: Disassembler.cpp:1128
lldb_private::Disassembler::m_instruction_list
InstructionList m_instruction_list
Definition: Disassembler.h:528
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::Instruction::Operand::BuildImmediate
static Operand BuildImmediate(lldb::addr_t imm, bool neg)
Definition: Disassembler.cpp:1177
lldb_private::InstructionList::GetMaxOpcocdeByteSize
uint32_t GetMaxOpcocdeByteSize() const
Definition: Disassembler.cpp:934
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
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:146
lldb_private::Instruction::Operand::BuildRegister
static Operand BuildRegister(ConstString &r)
Definition: Disassembler.cpp:1170
Address.h
lldb_private::Disassembler::SourceLine
Definition: Disassembler.h:463
lldb_private::Instruction::m_comment
std::string m_comment
Definition: Disassembler.h:232
lldb_private::Disassembler::operator=
const Disassembler & operator=(const Disassembler &)=delete
lldb_private::Disassembler::Limit::value
lldb::addr_t value
Definition: Disassembler.h:402
lldb_private::Disassembler::eOptionMarkPCAddress
@ eOptionMarkPCAddress
Definition: Disassembler.h:377
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:327
LLDB_INVALID_LINE_NUMBER
#define LLDB_INVALID_LINE_NUMBER
Definition: lldb-defines.h:98
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:255
lldb_private::InstructionList::const_iterator
collection::const_iterator const_iterator
Definition: Disassembler.h:328
lldb_private::Disassembler::ElideMixedSourceAndDisassemblyLine
static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, LineEntry &line)
Definition: Disassembler.h:517
lldb_private::Instruction::Operand::BuildProduct
static Operand BuildProduct(const Operand &lhs, const Operand &rhs)
Definition: Disassembler.cpp:1215
lldb_private::PseudoInstruction::DoesBranch
bool DoesBranch() override
Definition: Disassembler.cpp:1116
lldb_private::PseudoInstruction::IsLoad
bool IsLoad() override
Definition: Disassembler.cpp:1126
lldb_private::Instruction::Operand::BuildSum
static Operand BuildSum(const Operand &lhs, const Operand &rhs)
Definition: Disassembler.cpp:1207
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:347
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:251
uint32_t
lldb_private::InstructionList::collection
std::vector< lldb::InstructionSP > collection
Definition: Disassembler.h:326
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:401
lldb_private::Disassembler::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Disassembler.h:452
lldb_private::Instruction::m_address
Address m_address
Definition: Disassembler.h:217
lldb_private::Disassembler::HexImmediateStyle
HexImmediateStyle
Definition: Disassembler.h:381
lldb_private::InstructionList::m_instructions
collection m_instructions
Definition: Disassembler.h:330
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:233
lldb_private::Disassembler::SourceLinesToDisplay
Definition: Disassembler.h:481
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:163
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:466
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:368
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:474
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:210
lldb_private::PseudoInstruction::SetOpcode
void SetOpcode(size_t opcode_size, void *opcode_data)
Definition: Disassembler.cpp:1136
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:454
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:524
lldb_private::StackFrame
Definition: StackFrame.h:40
lldb_private::PseudoInstruction::SetDescription
void SetDescription(llvm::StringRef description) override
Definition: Disassembler.cpp:1166
lldb_private::Instruction::Operand::IsValid
bool IsValid()
Definition: Disassembler.h:200
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::Instruction::IsAuthenticated
virtual bool IsAuthenticated()=0
lldb_private::Disassembler::eOptionMarkPCSourceLine
@ eOptionMarkPCSourceLine
Definition: Disassembler.h:375
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:198
lldb_private::Disassembler::eOptionRawOuput
@ eOptionRawOuput
Definition: Disassembler.h:374
lldb_private::Disassembler::SourceLinesToDisplay::lines
std::vector< SourceLine > lines
Definition: Disassembler.h:482
lldb_private::Instruction::Operand::Type::Immediate
@ Immediate
lldb_private::PseudoInstruction::HasDelaySlot
bool HasDelaySlot() override
Definition: Disassembler.cpp:1121