lldb.swig revision 9ae7cef26612773c6b3422834cec83f0fbb2cf8c
1/*
2   lldb.swig
3
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.
7*/
8
9/* Define our module docstring. */
10%define DOCSTRING
11"The lldb module contains the public APIs for Python binding.
12
13Some of the important classes are describe here:
14
15o SBTarget: Represents the target program running under the debugger.
16o SBProcess: Represents the process associated with the target program.
17o SBThread: Represents a thread of execution. SBProcess contains SBThread(s).
18o SBFrame: Represents one of the stack frames associated with a thread. SBThread
19      contains SBFrame(s).
20o SBSymbolContext: A container that stores various debugger related info.
21o SBValue: Represents the value of a variable, a register, or an expression.
22o SBModule: Represents an executable image and its associated object and symbol
23      files.  SBTarget conatins SBModule(s).
24o SBBreakpoint: Represents a logical breakpoint and its associated settings.
25      SBTarget conatins SBBreakpoint(s).
26o SBSymbol: Represents the symbol possibly associated with a stack frame.
27o SBCompileUnit: Represents a compilation unit, or compiled source file.
28o SBFunction: Represents a generic function, which can be inlined or not.
29o SBBlock: Represents a lexical block. SBFunction contains SBBlock(s).
30o SBLineEntry: Specifies an association with a contiguous range of instructions
31      and a source file location. SBCompileUnit contains SBLineEntry(s)."
32%enddef
33
34// The name of the module to be created.
35%module(docstring=DOCSTRING) lldb
36
37// Parameter types will be used in the autodoc string.
38%feature("autodoc", "1");
39
40/* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */
41
42%typemap(in) char ** {
43  /* Check if is a list  */
44  if (PyList_Check($input)) {
45    int size = PyList_Size($input);
46    int i = 0;
47    $1 = (char **) malloc((size+1) * sizeof(char*));
48    for (i = 0; i < size; i++) {
49      PyObject *o = PyList_GetItem($input,i);
50      if (PyString_Check(o))
51        $1[i] = PyString_AsString(o);
52      else {
53        PyErr_SetString(PyExc_TypeError,"list must contain strings");
54        free($1);
55        return NULL;
56      }
57    }
58    $1[i] = 0;
59  } else if ($input == Py_None) {
60    $1 =  NULL;
61  } else {
62    PyErr_SetString(PyExc_TypeError,"not a list");
63    return NULL;
64  }
65}
66
67%typemap(freearg) char** {
68  free((char *) $1);
69}
70
71%typemap(out) char** {
72  int len;
73  int i;
74  len = 0;
75  while ($1[len]) len++;
76  $result = PyList_New(len);
77  for (i = 0; i < len; i++) {
78    PyList_SetItem($result, i, PyString_FromString($1[i]));
79  }
80}
81
82/* Typemap definitions to allow SWIG to properly handle char buffer. */
83
84// typemap for a char buffer
85// See also SBThread::GetStopDescription.
86%typemap(in) (char *dst, size_t dst_len) {
87   if (!PyInt_Check($input)) {
88       PyErr_SetString(PyExc_ValueError, "Expecting an integer");
89       return NULL;
90   }
91   $2 = PyInt_AsLong($input);
92   if ($2 <= 0) {
93       PyErr_SetString(PyExc_ValueError, "Positive integer expected");
94       return NULL;
95   }
96   $1 = (char *) malloc($2);
97}
98
99// Return the char buffer.  Discarding any previous return result
100// See also SBThread::GetStopDescription.
101%typemap(argout) (char *dst, size_t dst_len) {
102   Py_XDECREF($result);   /* Blow away any previous result */
103   $result = PyString_FromStringAndSize(($1),result);
104   free($1);
105}
106
107
108// typemap for an outgoing buffer
109// See also SBEvent::SBEvent(uint32_t event, const char *cstr, uint32_t cstr_len).
110%typemap(in) (const char *cstr, uint32_t cstr_len) {
111   if (!PyString_Check($input)) {
112       PyErr_SetString(PyExc_ValueError, "Expecting a string");
113       return NULL;
114   }
115   $1 = (char *) PyString_AsString($input);
116   $2 = PyString_Size($input);
117}
118// And SBProcess::WriteMemory.
119%typemap(in) (const void *buf, size_t size) {
120   if (!PyString_Check($input)) {
121       PyErr_SetString(PyExc_ValueError, "Expecting a string");
122       return NULL;
123   }
124   $1 = (void *) PyString_AsString($input);
125   $2 = PyString_Size($input);
126}
127
128// typemap for an incoming buffer
129// See also SBProcess::ReadMemory.
130%typemap(in) (void *buf, size_t size) {
131   if (!PyInt_Check($input)) {
132       PyErr_SetString(PyExc_ValueError, "Expecting an integer");
133       return NULL;
134   }
135   $2 = PyInt_AsLong($input);
136   if ($2 <= 0) {
137       PyErr_SetString(PyExc_ValueError, "Positive integer expected");
138       return NULL;
139   }
140   $1 = (void *) malloc($2);
141}
142
143// Return the buffer.  Discarding any previous return result
144// See also SBProcess::ReadMemory.
145%typemap(argout) (void *buf, size_t size) {
146   Py_XDECREF($result);   /* Blow away any previous result */
147   $result = PyString_FromStringAndSize(static_cast<const char*>($1),result);
148   free($1);
149}
150
151/* The liblldb header files to be included. */
152
153%{
154#include "lldb/lldb-public.h"
155#include "lldb/API/SBAddress.h"
156#include "lldb/API/SBBlock.h"
157#include "lldb/API/SBBreakpoint.h"
158#include "lldb/API/SBBreakpointLocation.h"
159#include "lldb/API/SBBroadcaster.h"
160#include "lldb/API/SBCommandInterpreter.h"
161#include "lldb/API/SBCommandReturnObject.h"
162#include "lldb/API/SBCommunication.h"
163#include "lldb/API/SBCompileUnit.h"
164#include "lldb/API/SBDebugger.h"
165#include "lldb/API/SBError.h"
166#include "lldb/API/SBEvent.h"
167#include "lldb/API/SBFileSpec.h"
168#include "lldb/API/SBFrame.h"
169#include "lldb/API/SBFunction.h"
170#include "lldb/API/SBHostOS.h"
171#include "lldb/API/SBInputReader.h"
172#include "lldb/API/SBInstruction.h"
173#include "lldb/API/SBInstructionList.h"
174#include "lldb/API/SBLineEntry.h"
175#include "lldb/API/SBListener.h"
176#include "lldb/API/SBModule.h"
177#include "lldb/API/SBProcess.h"
178#include "lldb/API/SBSourceManager.h"
179#include "lldb/API/SBStream.h"
180#include "lldb/API/SBStringList.h"
181#include "lldb/API/SBSymbol.h"
182#include "lldb/API/SBSymbolContext.h"
183#include "lldb/API/SBSymbolContextList.h"
184#include "lldb/API/SBTarget.h"
185#include "lldb/API/SBThread.h"
186#include "lldb/API/SBType.h"
187#include "lldb/API/SBValue.h"
188#include "lldb/API/SBValueList.h"
189%}
190
191/* Various liblldb typedefs that SWIG needs to know about.  */
192#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
193%include <stdint.h>
194%include "lldb/lldb-defines.h"
195%include "lldb/lldb-enumerations.h"
196%include "lldb/lldb-forward.h"
197%include "lldb/lldb-forward-rtti.h"
198%include "lldb/lldb-types.h"
199
200/* Forward declaration of SB classes. */
201%include "lldb/API/SBDefines.h"
202
203/* Python interface files with docstrings. */
204%include "./Python/interface/SBAddress.i"
205%include "./Python/interface/SBBlock.i"
206%include "./Python/interface/SBBreakpoint.i"
207%include "./Python/interface/SBBreakpointLocation.i"
208%include "./Python/interface/SBBroadcaster.i"
209%include "./Python/interface/SBCommandInterpreter.i"
210%include "./Python/interface/SBCommandReturnObject.i"
211%include "./Python/interface/SBCommunication.i"
212%include "./Python/interface/SBCompileUnit.i"
213%include "./Python/interface/SBDebugger.i"
214%include "./Python/interface/SBError.i"
215%include "./Python/interface/SBEvent.i"
216%include "./Python/interface/SBFileSpec.i"
217%include "./Python/interface/SBFrame.i"
218%include "./Python/interface/SBFunction.i"
219%include "./Python/interface/SBHostOS.i"
220%include "./Python/interface/SBInputReader.i"
221%include "./Python/interface/SBInstruction.i"
222%include "./Python/interface/SBInstructionList.i"
223%include "./Python/interface/SBLineEntry.i"
224%include "./Python/interface/SBListener.i"
225%include "./Python/interface/SBModule.i"
226%include "./Python/interface/SBProcess.i"
227%include "./Python/interface/SBSourceManager.i"
228%include "./Python/interface/SBStream.i"
229%include "./Python/interface/SBStringList.i"
230%include "./Python/interface/SBSymbol.i"
231%include "./Python/interface/SBSymbolContext.i"
232%include "./Python/interface/SBSymbolContextList.i"
233%include "./Python/interface/SBTarget.i"
234%include "./Python/interface/SBThread.i"
235%include "./Python/interface/SBType.i"
236%include "./Python/interface/SBValue.i"
237%include "./Python/interface/SBValueList.i"
238
239%include "./Python/python-extensions.swig"
240
241
242%wrapper %{
243
244// This function is called by lldb_private::ScriptInterpreterPython::BreakpointCallbackFunction(...)
245// and is used when a script command is attached to a breakpoint for execution.
246
247SWIGEXPORT bool
248LLDBSwigPythonBreakpointCallbackFunction
249(
250    const char *python_function_name,
251    const char *session_dictionary_name,
252    const lldb::StackFrameSP& frame_sp,
253    const lldb::BreakpointLocationSP& bp_loc_sp
254)
255{
256    lldb::SBFrame sb_frame (frame_sp);
257    lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
258
259    bool stop_at_breakpoint = true;
260    PyObject *Frame_PyObj = SWIG_NewPointerObj((void *) &sb_frame, SWIGTYPE_p_lldb__SBFrame, 0);
261    PyObject *Bp_Loc_PyObj = SWIG_NewPointerObj ((void *) &sb_bp_loc, SWIGTYPE_p_lldb__SBBreakpointLocation, 0);
262
263    if (Frame_PyObj == NULL || Bp_Loc_PyObj == NULL)
264        return stop_at_breakpoint;
265
266    if (!python_function_name || !session_dictionary_name)
267        return stop_at_breakpoint;
268
269    PyObject *pmodule, *main_dict, *session_dict, *pfunc;
270    PyObject *pargs, *pvalue;
271
272    pmodule = PyImport_AddModule ("__main__");
273    if (pmodule != NULL)
274    {
275        main_dict = PyModule_GetDict (pmodule);
276        if (main_dict != NULL)
277        {
278            PyObject *key, *value;
279            Py_ssize_t pos = 0;
280
281            // Find the current session's dictionary in the main module's dictionary.
282
283            if (PyDict_Check (main_dict))
284            {
285                session_dict = NULL;
286                while (PyDict_Next (main_dict, &pos, &key, &value))
287                {
288                    // We have stolen references to the key and value objects in the dictionary; we need to increment
289                    // them now so that Python's garbage collector doesn't collect them out from under us.
290                    Py_INCREF (key);
291                    Py_INCREF (value);
292                    if (strcmp (PyString_AsString (key), session_dictionary_name) == 0)
293                    {
294                        session_dict = value;
295                        break;
296                    }
297                }
298            }
299
300            if (!session_dict || !PyDict_Check (session_dict))
301                return stop_at_breakpoint;
302
303            // Find the function we need to call in the current session's dictionary.
304
305            pos = 0;
306            pfunc = NULL;
307            while (PyDict_Next (session_dict, &pos, &key, &value))
308            {
309                if (PyString_Check (key))
310                {
311                    // We have stolen references to the key and value objects in the dictionary; we need to increment
312                    // them now so that Python's garbage collector doesn't collect them out from under us.
313                    Py_INCREF (key);
314                    Py_INCREF (value);
315                    if (strcmp (PyString_AsString (key), python_function_name) == 0)
316                    {
317                        pfunc = value;
318                        break;
319                    }
320                }
321            }
322
323            // Set up the arguments and call the function.
324
325            if (pfunc && PyCallable_Check (pfunc))
326            {
327                pargs = PyTuple_New (3);
328                if (pargs == NULL)
329                {
330                    if (PyErr_Occurred())
331                        PyErr_Clear();
332                    return stop_at_breakpoint;
333                }
334
335                PyTuple_SetItem (pargs, 0, Frame_PyObj);  // This "steals" a reference to Frame_PyObj
336                PyTuple_SetItem (pargs, 1, Bp_Loc_PyObj); // This "steals" a reference to Bp_Loc_PyObj
337                PyTuple_SetItem (pargs, 2, session_dict); // This "steals" a reference to session_dict
338                pvalue = PyObject_CallObject (pfunc, pargs);
339                Py_DECREF (pargs);
340
341                if (pvalue != NULL)
342                {
343                    Py_DECREF (pvalue);
344                }
345                else if (PyErr_Occurred ())
346                {
347                    PyErr_Clear();
348                }
349                Py_INCREF (session_dict);
350            }
351            else if (PyErr_Occurred())
352            {
353                PyErr_Clear();
354            }
355        }
356        else if (PyErr_Occurred())
357        {
358            PyErr_Clear();
359        }
360    }
361    else if (PyErr_Occurred ())
362    {
363        PyErr_Clear ();
364    }
365    return stop_at_breakpoint;
366}
367
368SWIGEXPORT std::string
369LLDBSwigPythonCallTypeScript
370(
371    const char *python_function_name,
372    const char *session_dictionary_name,
373    const lldb::ValueObjectSP& valobj_sp
374)
375{
376    lldb::SBValue sb_value (valobj_sp);
377
378    std::string retval = "";
379
380    PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) &valobj_sp, SWIGTYPE_p_lldb__SBValue, 0);
381
382    if (ValObj_PyObj == NULL)
383        return retval;
384
385    if (!python_function_name || !session_dictionary_name)
386        return retval;
387
388    PyObject *pmodule, *main_dict, *session_dict, *pfunc;
389    PyObject *pargs, *pvalue;
390
391    pmodule = PyImport_AddModule ("__main__");
392    if (pmodule != NULL)
393    {
394        main_dict = PyModule_GetDict (pmodule);
395        if (main_dict != NULL)
396        {
397            PyObject *key, *value;
398            Py_ssize_t pos = 0;
399
400            // Find the current session's dictionary in the main module's dictionary.
401
402            if (PyDict_Check (main_dict))
403            {
404                session_dict = NULL;
405                while (PyDict_Next (main_dict, &pos, &key, &value))
406                {
407                    // We have stolen references to the key and value objects in the dictionary; we need to increment
408                    // them now so that Python's garbage collector doesn't collect them out from under us.
409                    Py_INCREF (key);
410                    Py_INCREF (value);
411                    if (strcmp (PyString_AsString (key), session_dictionary_name) == 0)
412                    {
413                        session_dict = value;
414                        break;
415                    }
416                }
417            }
418
419            if (!session_dict || !PyDict_Check (session_dict))
420                return retval;
421
422            // Find the function we need to call in the current session's dictionary.
423
424            pos = 0;
425            pfunc = NULL;
426            while (PyDict_Next (session_dict, &pos, &key, &value))
427            {
428                if (PyString_Check (key))
429                {
430                    // We have stolen references to the key and value objects in the dictionary; we need to increment
431                    // them now so that Python's garbage collector doesn't collect them out from under us.
432                    Py_INCREF (key);
433                    Py_INCREF (value);
434                    if (strcmp (PyString_AsString (key), python_function_name) == 0)
435                    {
436                        pfunc = value;
437                        break;
438                    }
439                }
440            }
441
442            // Set up the arguments and call the function.
443
444            if (pfunc && PyCallable_Check (pfunc))
445            {
446                pargs = PyTuple_New (2);
447                if (pargs == NULL)
448                {
449                    if (PyErr_Occurred())
450                        PyErr_Clear();
451                    return retval;
452                }
453
454                PyTuple_SetItem (pargs, 0, ValObj_PyObj);  // This "steals" a reference to ValObj_PyObj
455                PyTuple_SetItem (pargs, 1, session_dict); // This "steals" a reference to session_dict
456                pvalue = PyObject_CallObject (pfunc, pargs);
457                Py_DECREF (pargs);
458
459                if (pvalue != NULL)
460                {
461                    if (pvalue != Py_None)
462                        retval = std::string(PyString_AsString(pvalue));
463                    else
464                        retval = "None";
465                    Py_DECREF (pvalue);
466                }
467                else if (PyErr_Occurred ())
468                {
469                    PyErr_Print();
470                    PyErr_Clear();
471                }
472                Py_INCREF (session_dict);
473            }
474            else if (PyErr_Occurred())
475            {
476                PyErr_Print();
477                PyErr_Clear();
478            }
479        }
480        else if (PyErr_Occurred())
481        {
482            PyErr_Print();
483            PyErr_Clear();
484        }
485    }
486    else if (PyErr_Occurred ())
487    {
488        PyErr_Print();
489        PyErr_Clear ();
490    }
491    return retval;
492}
493
494SWIGEXPORT void*
495LLDBSwigPythonCreateSyntheticProvider
496(
497    const std::string python_class_name,
498    const char *session_dictionary_name,
499    const lldb::ValueObjectSP& valobj_sp
500)
501{
502    PyObject* retval = NULL;
503
504    if (python_class_name.empty() || !session_dictionary_name)
505        Py_RETURN_NONE;
506
507    lldb::ValueObjectSP* valobj_sp_ptr = new lldb::ValueObjectSP(valobj_sp);
508
509    PyObject *ValObj_PyObj = SWIG_NewPointerObj((void *) valobj_sp_ptr, SWIGTYPE_p_lldb__SBValue, SWIG_POINTER_OWN);
510
511    if (ValObj_PyObj == NULL)
512        Py_RETURN_NONE;
513
514    const char* python_function_name = python_class_name.c_str();
515
516    PyObject *pmodule, *main_dict, *session_dict, *pfunc;
517    PyObject *pvalue;
518
519    pmodule = PyImport_AddModule ("__main__");
520    if (pmodule != NULL)
521    {
522        main_dict = PyModule_GetDict (pmodule);
523        if (main_dict != NULL)
524        {
525            PyObject *key, *value;
526            Py_ssize_t pos = 0;
527
528            // Find the current session's dictionary in the main module's dictionary.
529
530            if (PyDict_Check (main_dict))
531            {
532                session_dict = NULL;
533                while (PyDict_Next (main_dict, &pos, &key, &value))
534                {
535                    // We have stolen references to the key and value objects in the dictionary; we need to increment
536                    // them now so that Python's garbage collector doesn't collect them out from under us.
537                    Py_INCREF (key);
538                    Py_INCREF (value);
539                    if (strcmp (PyString_AsString (key), session_dictionary_name) == 0)
540                    {
541                        session_dict = value;
542                        break;
543                    }
544                }
545            }
546
547            if (!session_dict || !PyDict_Check (session_dict))
548                return retval;
549
550            // Find the function we need to call in the current session's dictionary.
551
552            pos = 0;
553            pfunc = NULL;
554            while (PyDict_Next (session_dict, &pos, &key, &value))
555            {
556                if (PyString_Check (key))
557                {
558                    // We have stolen references to the key and value objects in the dictionary; we need to increment
559                    // them now so that Python's garbage collector doesn't collect them out from under us.
560                    Py_INCREF (key);
561                    Py_INCREF (value);
562                    if (strcmp (PyString_AsString (key), python_function_name) == 0)
563                    {
564                        pfunc = value;
565                        break;
566                    }
567                }
568            }
569
570            // Set up the arguments and call the function.
571
572            if (pfunc && PyCallable_Check (pfunc))
573            {
574                PyObject *argList = Py_BuildValue("SS", ValObj_PyObj, session_dict);
575
576                if (PyErr_Occurred ())
577                {
578                    PyErr_Print();
579                    PyErr_Clear();
580                    return retval;
581                }
582
583                if (argList == NULL)
584                {
585                    return retval;
586                }
587
588                Py_INCREF(ValObj_PyObj);
589
590                pvalue = PyObject_CallObject(pfunc, argList);
591
592                Py_DECREF(argList);
593
594                if (pvalue != NULL)
595                {
596                    if (pvalue != Py_None)
597                        retval = pvalue;
598                    else
599                    {
600                        retval = Py_None;
601                        Py_INCREF(retval);
602                    }
603                }
604                else if (PyErr_Occurred ())
605                {
606                    PyErr_Print();
607                    PyErr_Clear();
608                }
609                Py_INCREF (session_dict);
610            }
611            else if (PyErr_Occurred())
612            {
613                PyErr_Print();
614                PyErr_Clear();
615            }
616        }
617        else if (PyErr_Occurred())
618        {
619            PyErr_Print();
620            PyErr_Clear();
621        }
622    }
623    else if (PyErr_Occurred ())
624    {
625        PyErr_Print();
626        PyErr_Clear ();
627    }
628    if (retval)
629        return retval;
630    else
631        Py_RETURN_NONE;
632}
633
634/*
635these four calls below are meant to support
636Python-based synthetic children providers
637they essentially mimic the four pure virtual
638method calls provided by the frontend class
639*/
640
641SWIGEXPORT uint32_t
642LLDBSwigPython_CalculateNumChildren
643(
644    PyObject *implementor
645)
646{
647
648    static char callee_name[] = "num_children";
649
650    if (implementor == NULL || implementor == Py_None)
651        return 0;
652    PyObject* py_return = PyObject_CallMethod(implementor, callee_name, NULL);
653    if (PyErr_Occurred())
654    {
655        PyErr_Print();
656        PyErr_Clear();
657    }
658
659    if (py_return == NULL || py_return == Py_None)
660    {
661        Py_XDECREF(py_return);
662        return UINT32_MAX;
663    }
664    long retval = PyInt_AsLong(py_return);
665    Py_DECREF(py_return);
666    if (retval >= 0)
667        return (uint32_t)retval;
668    if (PyErr_Occurred())
669    {
670        PyErr_Print();
671        PyErr_Clear();
672    }
673    return 0;
674}
675
676SWIGEXPORT PyObject*
677LLDBSwigPython_GetChildAtIndex
678(
679    PyObject *implementor,
680    uint32_t idx
681)
682{
683
684    static char callee_name[] = "get_child_at_index";
685    static char param_format[] = "i";
686
687    if (implementor == NULL || implementor == Py_None)
688        return NULL;
689    PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, idx);
690    if (PyErr_Occurred())
691    {
692        PyErr_Print();
693        PyErr_Clear();
694    }
695
696    if (py_return == NULL || py_return == Py_None)
697    {
698        Py_XDECREF(py_return);
699        return NULL;
700    }
701
702    lldb::SBValue* sbvalue_ptr = NULL;
703
704    if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
705    {
706        Py_DECREF(py_return);
707        return NULL;
708    }
709
710    if (sbvalue_ptr == NULL)
711        return NULL;
712
713    return py_return;
714}
715
716SWIGEXPORT int
717LLDBSwigPython_GetIndexOfChildWithName
718(
719    PyObject *implementor,
720    const char* child_name
721)
722{
723    static char callee_name[] = "get_child_index";
724    static char param_format[] = "s";
725
726    if (implementor == NULL || implementor == Py_None)
727        return 0;
728    PyObject* py_return = PyObject_CallMethod(implementor, callee_name, param_format, child_name);
729    if (PyErr_Occurred())
730    {
731        PyErr_Print();
732        PyErr_Clear();
733    }
734
735    if (py_return == NULL || py_return == Py_None)
736    {
737        Py_XDECREF(py_return);
738        return UINT32_MAX;
739    }
740    long retval = PyInt_AsLong(py_return);
741    Py_DECREF(py_return);
742    if (retval >= 0)
743        return (uint32_t)retval;
744    if (PyErr_Occurred())
745    {
746        PyErr_Print();
747        PyErr_Clear();
748    }
749    return 0;
750}
751
752SWIGEXPORT lldb::SBValue*
753LLDBSWIGPython_CastPyObjectToSBValue
754(
755    PyObject* data
756)
757{
758    lldb::SBValue* sb_ptr = NULL;
759
760    int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0);
761
762    if (valid_cast == -1)
763        return NULL;
764
765    return sb_ptr;
766}
767
768%}
769