Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | /* |
| 2 | lldb.swig |
| 3 | |
| 4 | Created by Caroline Tice 1/18/2010 |
| 5 | |
| 6 | This is the input file for SWIG, to create the appropriate C++ wrappers and |
| 7 | functions for various scripting languages, to enable them to call the |
| 8 | liblldb Script Bridge functions. |
| 9 | |
| 10 | */ |
| 11 | |
| 12 | /* The name of the module to be created. */ |
| 13 | |
| 14 | %module lldb |
| 15 | |
| 16 | %typemap(in) lldb::ReturnStatus { |
| 17 | $1 = (int) $input; |
| 18 | } |
| 19 | |
| 20 | %typemap(freearg) lldb::ReturnStatus { |
| 21 | } |
| 22 | |
| 23 | %typemap(out) lldb::ReturnStatus { |
| 24 | $result = SWIG_From_unsigned_SS_int(static_cast< unsigned int >($1)); |
| 25 | } |
| 26 | |
| 27 | /* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */ |
| 28 | |
| 29 | %typemap(in) char ** { |
| 30 | /* Check if is a list */ |
| 31 | if (PyList_Check($input)) { |
| 32 | int size = PyList_Size($input); |
| 33 | int i = 0; |
| 34 | $1 = (char **) malloc((size+1) * sizeof(char)); |
| 35 | for (i = 0; i < size; i++) { |
| 36 | PyObject *o = PyList_GetItem($input,i); |
| 37 | if (PyString_Check(o)) |
| 38 | $1[i] = PyString_AsString(PyList_GetItem($input,i)); |
| 39 | else { |
| 40 | PyErr_SetString(PyExc_TypeError,"list must contain strings"); |
| 41 | free($1); |
| 42 | return NULL; |
| 43 | } |
| 44 | } |
| 45 | $1[i] = 0; |
Caroline Tice | ebc1bb2 | 2010-06-30 16:22:25 +0000 | [diff] [blame] | 46 | } else if ($input == Py_None) { |
| 47 | $1 = NULL; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 48 | } else { |
| 49 | PyErr_SetString(PyExc_TypeError,"not a list"); |
| 50 | return NULL; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | %typemap(freearg) char** { |
| 55 | free((char *) $1); |
| 56 | } |
| 57 | |
| 58 | %typemap(out) char** { |
| 59 | int len; |
| 60 | int i; |
| 61 | len = 0; |
| 62 | while ($1[len]) len++; |
| 63 | $result = PyList_New(len); |
| 64 | for (i = 0; i < len; i++) { |
| 65 | PyList_SetItem($result, i, PyString_FromString($1[i])); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | |
Greg Clayton | c0cc73e | 2010-06-12 15:34:20 +0000 | [diff] [blame] | 70 | /* The liblldb header files to be included. */ |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 71 | |
| 72 | %{ |
| 73 | #include "lldb/lldb-types.h" |
| 74 | #include "lldb/API/SBAddress.h" |
| 75 | #include "lldb/API/SBBlock.h" |
| 76 | #include "lldb/API/SBBreakpoint.h" |
| 77 | #include "lldb/API/SBBreakpointLocation.h" |
| 78 | #include "lldb/API/SBBroadcaster.h" |
| 79 | #include "lldb/API/SBCommandContext.h" |
| 80 | #include "lldb/API/SBCommandInterpreter.h" |
| 81 | #include "lldb/API/SBCommandReturnObject.h" |
| 82 | #include "lldb/API/SBCompileUnit.h" |
| 83 | #include "lldb/API/SBDebugger.h" |
| 84 | #include "lldb/API/SBError.h" |
| 85 | #include "lldb/API/SBEvent.h" |
| 86 | #include "lldb/API/SBFrame.h" |
| 87 | #include "lldb/API/SBFunction.h" |
| 88 | #include "lldb/API/SBLineEntry.h" |
| 89 | #include "lldb/API/SBListener.h" |
| 90 | #include "lldb/API/SBModule.h" |
| 91 | #include "lldb/API/SBProcess.h" |
| 92 | #include "lldb/API/SBSourceManager.h" |
| 93 | #include "lldb/API/SBStringList.h" |
| 94 | #include "lldb/API/SBSymbol.h" |
| 95 | #include "lldb/API/SBSymbolContext.h" |
| 96 | #include "lldb/API/SBTarget.h" |
| 97 | #include "lldb/API/SBThread.h" |
| 98 | #include "lldb/API/SBType.h" |
| 99 | #include "lldb/API/SBValue.h" |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 100 | using namespace lldb_private; |
| 101 | %} |
| 102 | |
| 103 | /* Various liblldb typedefs that SWIG needs to know about. */ |
| 104 | |
| 105 | %{ |
| 106 | typedef unsigned int uint32_t; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 107 | typedef int int32_t; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 108 | typedef uint32_t tid_t; |
| 109 | typedef uint64_t addr_t; |
Greg Clayton | c0cc73e | 2010-06-12 15:34:20 +0000 | [diff] [blame] | 110 | typedef int32_t break_id_t; |
| 111 | typedef lldb::SBStringList SBStringList; |
| 112 | typedef lldb::RegisterKind RegisterKind; |
| 113 | const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 114 | %} |
| 115 | |
| 116 | typedef unsigned int uint32_t; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 117 | typedef int int32_t; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 118 | typedef uint32_t tid_t; |
| 119 | typedef uint64_t addr_t; |
Greg Clayton | c0cc73e | 2010-06-12 15:34:20 +0000 | [diff] [blame] | 120 | typedef int32_t break_id_t; |
| 121 | typedef lldb::SBStringList SBStringList; |
| 122 | typedef lldb::RegisterKind RegisterKind; |
| 123 | const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ; |
Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame^] | 124 | typedef int StopReason; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 125 | |
| 126 | |
| 127 | %include "lldb/API/SBAddress.h" |
| 128 | %include "lldb/API/SBBlock.h" |
| 129 | %include "lldb/API/SBBreakpoint.h" |
| 130 | %include "lldb/API/SBBreakpointLocation.h" |
| 131 | %include "lldb/API/SBBroadcaster.h" |
| 132 | %include "lldb/API/SBCommandContext.h" |
| 133 | %include "lldb/API/SBCommandInterpreter.h" |
| 134 | %include "lldb/API/SBCommandReturnObject.h" |
| 135 | %include "lldb/API/SBCompileUnit.h" |
| 136 | %include "lldb/API/SBDebugger.h" |
| 137 | %include "lldb/API/SBError.h" |
| 138 | %include "lldb/API/SBEvent.h" |
| 139 | %include "lldb/API/SBFrame.h" |
| 140 | %include "lldb/API/SBFunction.h" |
| 141 | %include "lldb/API/SBLineEntry.h" |
| 142 | %include "lldb/API/SBListener.h" |
| 143 | %include "lldb/API/SBModule.h" |
| 144 | %include "lldb/API/SBProcess.h" |
| 145 | %include "lldb/API/SBSourceManager.h" |
| 146 | %include "lldb/API/SBStringList.h" |
| 147 | %include "lldb/API/SBSymbol.h" |
| 148 | %include "lldb/API/SBSymbolContext.h" |
| 149 | %include "lldb/API/SBTarget.h" |
| 150 | %include "lldb/API/SBThread.h" |
| 151 | %include "lldb/API/SBType.h" |
| 152 | %include "lldb/API/SBValue.h" |
| 153 | %include "lldb/lldb-types.h" |
| 154 | |
| 155 | |