1//===-- SWIG Interface for SBInstruction ------------------------*- 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#include <stdio.h>
10
11// There's a lot to be fixed here, but need to wait for underlying insn implementation
12// to be revised & settle down first.
13
14namespace lldb {
15
16class SBInstruction
17{
18public:
19
20    SBInstruction ();
21
22    SBInstruction (const SBInstruction &rhs);
23
24    ~SBInstruction ();
25
26    bool
27    IsValid();
28
29    explicit operator bool() const;
30
31    lldb::SBAddress
32    GetAddress();
33
34
35    const char *
36    GetMnemonic (lldb::SBTarget target);
37
38    const char *
39    GetOperands (lldb::SBTarget target);
40
41    const char *
42    GetComment (lldb::SBTarget target);
43
44    lldb::SBData
45    GetData (lldb::SBTarget target);
46
47    size_t
48    GetByteSize ();
49
50    bool
51    DoesBranch ();
52
53    bool
54    HasDelaySlot ();
55
56    bool
57    CanSetBreakpoint ();
58
59    void
60    Print (lldb::SBFile out);
61
62    void
63    Print (lldb::FileSP BORROWED);
64
65    bool
66    GetDescription (lldb::SBStream &description);
67
68    bool
69    EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
70
71    bool
72    DumpEmulation (const char * triple); // triple is to specify the architecture, e.g. 'armv6' or 'armv7-apple-ios'
73
74    bool
75    TestEmulation (lldb::SBStream &output_stream, const char *test_file);
76
77    STRING_EXTENSION(SBInstruction)
78
79#ifdef SWIGPYTHON
80    %pythoncode %{
81        def __mnemonic_property__ (self):
82            return self.GetMnemonic (target)
83        def __operands_property__ (self):
84            return self.GetOperands (target)
85        def __comment_property__ (self):
86            return self.GetComment (target)
87        def __file_addr_property__ (self):
88            return self.GetAddress ().GetFileAddress()
89        def __load_adrr_property__ (self):
90            return self.GetComment (target)
91
92        mnemonic = property(__mnemonic_property__, None, doc='''A read only property that returns the mnemonic for this instruction as a string.''')
93        operands = property(__operands_property__, None, doc='''A read only property that returns the operands for this instruction as a string.''')
94        comment = property(__comment_property__, None, doc='''A read only property that returns the comment for this instruction as a string.''')
95        addr = property(GetAddress, None, doc='''A read only property that returns an lldb object that represents the address (lldb.SBAddress) for this instruction.''')
96        size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes for this instruction as an integer.''')
97        is_branch = property(DoesBranch, None, doc='''A read only property that returns a boolean value that indicates if this instruction is a branch instruction.''')
98    %}
99#endif
100
101
102};
103
104} // namespace lldb
105