| 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" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 79 | #include "lldb/API/SBCommandInterpreter.h" | 
|  | 80 | #include "lldb/API/SBCommandReturnObject.h" | 
|  | 81 | #include "lldb/API/SBCompileUnit.h" | 
|  | 82 | #include "lldb/API/SBDebugger.h" | 
|  | 83 | #include "lldb/API/SBError.h" | 
|  | 84 | #include "lldb/API/SBEvent.h" | 
| Johnny Chen | 23fd10c | 2010-08-27 22:35:26 +0000 | [diff] [blame] | 85 | #include "lldb/API/SBFileSpec.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 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" | 
| Caroline Tice | dde9cff | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 93 | #include "lldb/API/SBStream.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 94 | #include "lldb/API/SBStringList.h" | 
|  | 95 | #include "lldb/API/SBSymbol.h" | 
|  | 96 | #include "lldb/API/SBSymbolContext.h" | 
|  | 97 | #include "lldb/API/SBTarget.h" | 
|  | 98 | #include "lldb/API/SBThread.h" | 
|  | 99 | #include "lldb/API/SBType.h" | 
|  | 100 | #include "lldb/API/SBValue.h" | 
| Caroline Tice | 7740412 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 101 | #include "lldb/API/SBValueList.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 102 | using namespace lldb_private; | 
|  | 103 | %} | 
|  | 104 |  | 
|  | 105 | /* Various liblldb typedefs that SWIG needs to know about.  */ | 
|  | 106 |  | 
|  | 107 | %{ | 
|  | 108 | typedef unsigned int uint32_t; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 109 | typedef int int32_t; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 110 | typedef uint32_t tid_t; | 
|  | 111 | typedef uint64_t addr_t; | 
| Greg Clayton | c0cc73e | 2010-06-12 15:34:20 +0000 | [diff] [blame] | 112 | typedef int32_t break_id_t; | 
|  | 113 | typedef lldb::SBStringList SBStringList; | 
|  | 114 | typedef lldb::RegisterKind RegisterKind; | 
|  | 115 | const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 116 | %} | 
|  | 117 |  | 
|  | 118 | typedef unsigned int uint32_t; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 119 | typedef int int32_t; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 120 | typedef uint32_t tid_t; | 
|  | 121 | typedef uint64_t addr_t; | 
| Greg Clayton | c0cc73e | 2010-06-12 15:34:20 +0000 | [diff] [blame] | 122 | typedef int32_t break_id_t; | 
|  | 123 | typedef lldb::SBStringList SBStringList; | 
|  | 124 | typedef lldb::RegisterKind RegisterKind; | 
|  | 125 | const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ; | 
| Johnny Chen | 5fca8ca | 2010-08-26 20:04:17 +0000 | [diff] [blame] | 126 | typedef int StopReason; | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 127 |  | 
|  | 128 |  | 
|  | 129 | %include "lldb/API/SBAddress.h" | 
|  | 130 | %include "lldb/API/SBBlock.h" | 
|  | 131 | %include "lldb/API/SBBreakpoint.h" | 
|  | 132 | %include "lldb/API/SBBreakpointLocation.h" | 
|  | 133 | %include "lldb/API/SBBroadcaster.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 134 | %include "lldb/API/SBCommandInterpreter.h" | 
|  | 135 | %include "lldb/API/SBCommandReturnObject.h" | 
|  | 136 | %include "lldb/API/SBCompileUnit.h" | 
|  | 137 | %include "lldb/API/SBDebugger.h" | 
|  | 138 | %include "lldb/API/SBError.h" | 
|  | 139 | %include "lldb/API/SBEvent.h" | 
| Johnny Chen | 23fd10c | 2010-08-27 22:35:26 +0000 | [diff] [blame] | 140 | %include "lldb/API/SBFileSpec.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 141 | %include "lldb/API/SBFrame.h" | 
|  | 142 | %include "lldb/API/SBFunction.h" | 
|  | 143 | %include "lldb/API/SBLineEntry.h" | 
|  | 144 | %include "lldb/API/SBListener.h" | 
|  | 145 | %include "lldb/API/SBModule.h" | 
|  | 146 | %include "lldb/API/SBProcess.h" | 
|  | 147 | %include "lldb/API/SBSourceManager.h" | 
| Caroline Tice | dde9cff | 2010-09-20 05:20:02 +0000 | [diff] [blame] | 148 | %include "lldb/API/SBStream.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 149 | %include "lldb/API/SBStringList.h" | 
|  | 150 | %include "lldb/API/SBSymbol.h" | 
|  | 151 | %include "lldb/API/SBSymbolContext.h" | 
|  | 152 | %include "lldb/API/SBTarget.h" | 
|  | 153 | %include "lldb/API/SBThread.h" | 
|  | 154 | %include "lldb/API/SBType.h" | 
|  | 155 | %include "lldb/API/SBValue.h" | 
| Caroline Tice | 7740412 | 2010-09-22 16:41:52 +0000 | [diff] [blame] | 156 | %include "lldb/API/SBValueList.h" | 
| Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 157 | %include "lldb/lldb-types.h" | 
|  | 158 |  | 
| Caroline Tice | dac97f3 | 2010-09-22 23:01:29 +0000 | [diff] [blame] | 159 | %include "./Python/python-extensions.swig" |