4 This is the input file for SWIG, to create the appropriate C++ wrappers and
5 functions for various scripting languages, to enable them to call the
6 liblldb Script Bridge functions.
9 /* Define our module docstring. */
11 "The lldb module contains the public APIs for Python binding.
13 Some of the important classes are described here:
15 o SBTarget: Represents the target program running under the debugger.
16 o SBProcess: Represents the process associated with the target program.
17 o SBThread: Represents a thread of execution. SBProcess contains SBThread(s).
18 o SBFrame: Represents one of the stack frames associated with a thread. SBThread
20 o SBSymbolContext: A container that stores various debugger related info.
21 o SBValue: Represents the value of a variable, a register, or an expression.
22 o SBModule: Represents an executable image and its associated object and symbol
23 files. SBTarget contains SBModule(s).
24 o SBBreakpoint: Represents a logical breakpoint and its associated settings.
25 SBTarget contains SBBreakpoint(s).
26 o SBSymbol: Represents the symbol possibly associated with a stack frame.
27 o SBCompileUnit: Represents a compilation unit, or compiled source file.
28 o SBFunction: Represents a generic function, which can be inlined or not.
29 o SBBlock: Represents a lexical block. SBFunction contains SBBlock(s).
30 o SBLineEntry: Specifies an association with a contiguous range of instructions
31 and a source file location. SBCompileUnit contains SBLineEntry(s)."
35 Since version 3.0.9, swig's logic for importing the native module has changed in
36 a way that is incompatible with our usage of the python module as __init__.py
37 (See swig bug #769). Fortunately, since version 3.0.11, swig provides a way for
38 us to override the module import logic to suit our needs. This does that.
40 Older swig versions will simply ignore this setting.
44 # Try an absolute import first. If we're being loaded from lldb,
45 # _lldb should be a built-in module.
48 # Relative import should work if we are being loaded by Python.
49 from . import $module"
51 // These versions will not generate working python modules, so error out early.
52 #if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
53 #error Swig versions 3.0.9 and 3.0.10 are incompatible with lldb.
56 // The name of the module to be created.
57 %module(docstring=DOCSTRING, moduleimport=MODULEIMPORT) lldb
59 // Parameter types will be used in the autodoc string.
60 %feature("autodoc", "1");
62 %define ARRAYHELPER(type,name)
64 type *new_ ## name (int nitems) {
65 return (type *) malloc(sizeof(type)*nitems);
67 void delete_ ## name(type *t) {
70 type name ## _get(type *t, int index) {
73 void name ## _set(type *t, int index, type val) {
87 // Include the version of swig that was used to generate this interface.
88 %define EMBED_VERSION(VERSION)
90 # SWIG_VERSION is written as a single hex number, but the components of it are
91 # meant to be interpreted in decimal. So, 0x030012 is swig 3.0.12, and not
94 return hex // 0x10 % 0x10 * 10 + hex % 0x10
95 swig_version = (_to_int(VERSION // 0x10000), _to_int(VERSION // 0x100), _to_int(VERSION))
99 EMBED_VERSION(SWIG_VERSION)
102 # ===================================
103 # Iterator for lldb container objects
104 # ===================================
105 def lldb_iter(obj, getsize, getelem):
106 """A generator adaptor to support iteration for lldb container objects."""
107 size = getattr(obj, getsize)
108 elem = getattr(obj, getelem)
109 for i in range(size()):
113 %include <std_string.i>
114 %include "./python/python-typemaps.swig"
115 %include "./macros.swig"
116 %include "./headers.swig"
119 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
120 #include "../bindings/python/python-swigsafecast.swig"
121 using namespace lldb_private;
122 using namespace lldb_private::python;
123 using namespace lldb;
126 %include "./interfaces.swig"
127 %include "./python/python-extensions.swig"
128 %include "./python/python-wrapper.swig"
131 debugger_unique_id = 0
132 SBDebugger.Initialize()