xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBInstructionExtensions.i (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
1 STRING_EXTENSION_OUTSIDE(SBInstruction)
2 
3 %extend lldb::SBInstruction {
4 #ifdef SWIGPYTHON
5     %pythoncode %{
6         def __hex__(self):
7             """ Returns the address of the instruction. """
8             return self.GetAddress()
9 
10         def __len__(self):
11             """ Returns the size of the instruction. """
12             return self.GetByteSize()
13 
14         def __mnemonic_property__ (self):
15             return self.GetMnemonic (target)
16         def __operands_property__ (self):
17             return self.GetOperands (target)
18         def __comment_property__ (self):
19             return self.GetComment (target)
20         def __file_addr_property__ (self):
21             return self.GetAddress ().GetFileAddress()
22         def __load_adrr_property__ (self):
23             return self.GetComment (target)
24 
25         mnemonic = property(__mnemonic_property__, None, doc='''A read only property that returns the mnemonic for this instruction as a string.''')
26         operands = property(__operands_property__, None, doc='''A read only property that returns the operands for this instruction as a string.''')
27         comment = property(__comment_property__, None, doc='''A read only property that returns the comment for this instruction as a string.''')
28         addr = property(GetAddress, None, doc='''A read only property that returns an lldb object that represents the address (lldb.SBAddress) for this instruction.''')
29         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes for this instruction as an integer.''')
30         is_branch = property(DoesBranch, None, doc='''A read only property that returns a boolean value that indicates if this instruction is a branch instruction.''')
31     %}
32 #endif
33 }
34