• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- SBInstruction.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_API_SBINSTRUCTION_H
10 #define LLDB_API_SBINSTRUCTION_H
11 
12 #include "lldb/API/SBData.h"
13 #include "lldb/API/SBDefines.h"
14 
15 #include <stdio.h>
16 
17 // There's a lot to be fixed here, but need to wait for underlying insn
18 // implementation to be revised & settle down first.
19 
20 class InstructionImpl;
21 
22 namespace lldb {
23 
24 class LLDB_API SBInstruction {
25 public:
26   SBInstruction();
27 
28   SBInstruction(const SBInstruction &rhs);
29 
30   const SBInstruction &operator=(const SBInstruction &rhs);
31 
32   ~SBInstruction();
33 
34   explicit operator bool() const;
35 
36   bool IsValid();
37 
38   SBAddress GetAddress();
39 
40   const char *GetMnemonic(lldb::SBTarget target);
41 
42   const char *GetOperands(lldb::SBTarget target);
43 
44   const char *GetComment(lldb::SBTarget target);
45 
46   lldb::SBData GetData(lldb::SBTarget target);
47 
48   size_t GetByteSize();
49 
50   bool DoesBranch();
51 
52   bool HasDelaySlot();
53 
54   bool CanSetBreakpoint();
55 
56   void Print(FILE *out);
57 
58   void Print(SBFile out);
59 
60   void Print(FileSP out);
61 
62   bool GetDescription(lldb::SBStream &description);
63 
64   bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
65 
66   bool DumpEmulation(const char *triple); // triple is to specify the
67                                           // architecture, e.g. 'armv6' or
68                                           // 'armv7-apple-ios'
69 
70   bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
71 
72 protected:
73   friend class SBInstructionList;
74 
75   SBInstruction(const lldb::DisassemblerSP &disasm_sp,
76                 const lldb::InstructionSP &inst_sp);
77 
78   void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
79                  const lldb::InstructionSP &inst_sp);
80 
81   lldb::InstructionSP GetOpaque();
82 
83 private:
84   std::shared_ptr<InstructionImpl> m_opaque_sp;
85 };
86 
87 } // namespace lldb
88 
89 #endif // LLDB_API_SBINSTRUCTION_H
90