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