xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBInstructionExtensions.i (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
106c3fb27SDimitry Andric STRING_EXTENSION_OUTSIDE(SBInstruction)
206c3fb27SDimitry Andric 
306c3fb27SDimitry Andric %extend lldb::SBInstruction {
406c3fb27SDimitry Andric #ifdef SWIGPYTHON
506c3fb27SDimitry Andric     %pythoncode %{
6*5f757f3fSDimitry Andric         def __hex__(self):
7*5f757f3fSDimitry Andric             """ Returns the address of the instruction. """
8*5f757f3fSDimitry Andric             return self.GetAddress()
9*5f757f3fSDimitry Andric 
10*5f757f3fSDimitry Andric         def __len__(self):
11*5f757f3fSDimitry Andric             """ Returns the size of the instruction. """
12*5f757f3fSDimitry Andric             return self.GetByteSize()
13*5f757f3fSDimitry Andric 
1406c3fb27SDimitry Andric         def __mnemonic_property__ (self):
1506c3fb27SDimitry Andric             return self.GetMnemonic (target)
1606c3fb27SDimitry Andric         def __operands_property__ (self):
1706c3fb27SDimitry Andric             return self.GetOperands (target)
1806c3fb27SDimitry Andric         def __comment_property__ (self):
1906c3fb27SDimitry Andric             return self.GetComment (target)
2006c3fb27SDimitry Andric         def __file_addr_property__ (self):
2106c3fb27SDimitry Andric             return self.GetAddress ().GetFileAddress()
2206c3fb27SDimitry Andric         def __load_adrr_property__ (self):
2306c3fb27SDimitry Andric             return self.GetComment (target)
2406c3fb27SDimitry Andric 
2506c3fb27SDimitry Andric         mnemonic = property(__mnemonic_property__, None, doc='''A read only property that returns the mnemonic for this instruction as a string.''')
2606c3fb27SDimitry Andric         operands = property(__operands_property__, None, doc='''A read only property that returns the operands for this instruction as a string.''')
2706c3fb27SDimitry Andric         comment = property(__comment_property__, None, doc='''A read only property that returns the comment for this instruction as a string.''')
2806c3fb27SDimitry Andric         addr = property(GetAddress, None, doc='''A read only property that returns an lldb object that represents the address (lldb.SBAddress) for this instruction.''')
2906c3fb27SDimitry Andric         size = property(GetByteSize, None, doc='''A read only property that returns the size in bytes for this instruction as an integer.''')
3006c3fb27SDimitry Andric         is_branch = property(DoesBranch, None, doc='''A read only property that returns a boolean value that indicates if this instruction is a branch instruction.''')
3106c3fb27SDimitry Andric     %}
3206c3fb27SDimitry Andric #endif
3306c3fb27SDimitry Andric }
34