1 //===-- SBInstruction.h -----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBInstruction_h_
11 #define LLDB_SBInstruction_h_
12 
13 #include "lldb/API/SBData.h"
14 #include "lldb/API/SBDefines.h"
15 
16 #include <stdio.h>
17 
18 // There's a lot to be fixed here, but need to wait for underlying insn
19 // implementation to be revised & settle down first.
20 
21 class InstructionImpl;
22 
23 namespace lldb {
24 
25 class LLDB_API SBInstruction {
26 public:
27   SBInstruction();
28 
29   SBInstruction(const SBInstruction &rhs);
30 
31   const SBInstruction &operator=(const SBInstruction &rhs);
32 
33   ~SBInstruction();
34 
35   bool IsValid();
36 
37   SBAddress GetAddress();
38 
39   const char *GetMnemonic(lldb::SBTarget target);
40 
41   const char *GetOperands(lldb::SBTarget target);
42 
43   const char *GetComment(lldb::SBTarget target);
44 
45   lldb::SBData GetData(lldb::SBTarget target);
46 
47   size_t GetByteSize();
48 
49   bool DoesBranch();
50 
51   bool HasDelaySlot();
52 
53   bool CanSetBreakpoint();
54 
55   void Print(FILE *out);
56 
57   bool GetDescription(lldb::SBStream &description);
58 
59   bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
60 
61   bool DumpEmulation(const char *triple); // triple is to specify the
62                                           // architecture, e.g. 'armv6' or
63                                           // 'armv7-apple-ios'
64 
65   bool TestEmulation(lldb::SBStream &output_stream, const char *test_file);
66 
67 protected:
68   friend class SBInstructionList;
69 
70   SBInstruction(const lldb::DisassemblerSP &disasm_sp,
71                 const lldb::InstructionSP &inst_sp);
72 
73   void SetOpaque(const lldb::DisassemblerSP &disasm_sp,
74                  const lldb::InstructionSP &inst_sp);
75 
76   lldb::InstructionSP GetOpaque();
77 
78 private:
79   std::shared_ptr<InstructionImpl> m_opaque_sp;
80 };
81 
82 } // namespace lldb
83 
84 #endif // LLDB_SBInstruction_h_
85