blob: 31dca479704c0d6c5af5c3077efcc76a99524bb1 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001/*
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 Ticeebc1bb22010-06-30 16:22:25 +000046 } else if ($input == Py_None) {
47 $1 = NULL;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000048 } 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 Claytonc0cc73e2010-06-12 15:34:20 +000070/* The liblldb header files to be included. */
Chris Lattner30fdc8d2010-06-08 16:52:24 +000071
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 Lattner30fdc8d2010-06-08 16:52:24 +0000100using namespace lldb_private;
101%}
102
103/* Various liblldb typedefs that SWIG needs to know about. */
104
105%{
106typedef unsigned int uint32_t;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000107typedef int int32_t;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000108typedef uint32_t tid_t;
109typedef uint64_t addr_t;
Greg Claytonc0cc73e2010-06-12 15:34:20 +0000110typedef int32_t break_id_t;
111typedef lldb::SBStringList SBStringList;
112typedef lldb::RegisterKind RegisterKind;
113const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000114%}
115
116typedef unsigned int uint32_t;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000117typedef int int32_t;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000118typedef uint32_t tid_t;
119typedef uint64_t addr_t;
Greg Claytonc0cc73e2010-06-12 15:34:20 +0000120typedef int32_t break_id_t;
121typedef lldb::SBStringList SBStringList;
122typedef lldb::RegisterKind RegisterKind;
123const RegisterKind kNumRegisterKinds = lldb::kNumRegisterKinds ;
Johnny Chen5fca8ca2010-08-26 20:04:17 +0000124typedef int StopReason;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000125
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