Strip trailing whitespace from python-wrapper.swig

(To test the dependency added in r232256.)

llvm-svn: 232257
This commit is contained in:
Ed Maste 2015-03-14 08:06:56 +00:00
parent c3948b4af1
commit 1cd6c667eb
1 changed files with 158 additions and 158 deletions

View File

@ -11,7 +11,7 @@ public:
m_print(print) m_print(print)
{ {
} }
~PyErr_Cleaner() ~PyErr_Cleaner()
{ {
if (PyErr_Occurred()) if (PyErr_Occurred())
@ -21,7 +21,7 @@ public:
PyErr_Clear(); PyErr_Clear();
} }
} }
private: private:
bool m_print; bool m_print;
}; };
@ -67,10 +67,10 @@ ResolvePythonName(const char* name,
if (!dot_pos) if (!dot_pos)
{ {
dest_object = NULL; dest_object = NULL;
while (PyDict_Next (main_dict, &pos, &key, &value)) while (PyDict_Next (main_dict, &pos, &key, &value))
{ {
// We have stolen references to the key and value objects in the dictionary; we need to increment // We have stolen references to the key and value objects in the dictionary; we need to increment
// them now so that Python's garbage collector doesn't collect them out from under us. // them now so that Python's garbage collector doesn't collect them out from under us.
Py_INCREF (key); Py_INCREF (key);
Py_INCREF (value); Py_INCREF (value);
@ -79,7 +79,7 @@ ResolvePythonName(const char* name,
dest_object = value; dest_object = value;
break; break;
} }
} }
if (!dest_object || dest_object == Py_None) if (!dest_object || dest_object == Py_None)
return NULL; return NULL;
return dest_object; return dest_object;
@ -135,14 +135,14 @@ public:
{ {
return m_callable != NULL; return m_callable != NULL;
} }
template<typename ...Args> template<typename ...Args>
PyObject* PyObject*
operator () (Args... args) operator () (Args... args)
{ {
return (*this)({SBTypeToSWIGWrapper(args)...}); return (*this)({SBTypeToSWIGWrapper(args)...});
} }
PyObject* PyObject*
operator () (std::initializer_list<PyObject*> args) operator () (std::initializer_list<PyObject*> args)
{ {
@ -167,13 +167,13 @@ public:
Py_XDECREF (pargs); Py_XDECREF (pargs);
return retval; return retval;
} }
static PyCallable static PyCallable
FindWithPythonObject (PyObject* pfunc) FindWithPythonObject (PyObject* pfunc)
{ {
return PyCallable(pfunc); return PyCallable(pfunc);
} }
static PyCallable static PyCallable
FindWithFunctionName (const char *python_function_name, FindWithFunctionName (const char *python_function_name,
const char *session_dictionary_name) const char *session_dictionary_name)
@ -184,7 +184,7 @@ public:
return PyCallable(); return PyCallable();
return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name)); return FindWithFunctionName(python_function_name,FindSessionDictionary (session_dictionary_name));
} }
static PyCallable static PyCallable
FindWithFunctionName (const char *python_function_name, FindWithFunctionName (const char *python_function_name,
PyObject *session_dict) PyObject *session_dict)
@ -195,7 +195,7 @@ public:
return PyCallable(); return PyCallable();
return PyCallable(ResolvePythonName (python_function_name, session_dict)); return PyCallable(ResolvePythonName (python_function_name, session_dict));
} }
static PyCallable static PyCallable
FindWithMemberFunction (PyObject *self, FindWithMemberFunction (PyObject *self,
const char *python_function_name) const char *python_function_name)
@ -206,10 +206,10 @@ public:
return PyCallable(); return PyCallable();
return PyCallable(PyObject_GetAttrString(self, python_function_name)); return PyCallable(PyObject_GetAttrString(self, python_function_name));
} }
private: private:
PyObject* m_callable; PyObject* m_callable;
PyCallable (PyObject *callable = NULL) : PyCallable (PyObject *callable = NULL) :
m_callable(callable) m_callable(callable)
{ {
@ -232,39 +232,39 @@ private:
// and is used when a script command is attached to a breakpoint for execution. // and is used when a script command is attached to a breakpoint for execution.
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonBreakpointCallbackFunction LLDBSwigPythonBreakpointCallbackFunction
( (
const char *python_function_name, const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::StackFrameSP& frame_sp, const lldb::StackFrameSP& frame_sp,
const lldb::BreakpointLocationSP& bp_loc_sp const lldb::BreakpointLocationSP& bp_loc_sp
) )
{ {
lldb::SBFrame sb_frame (frame_sp); lldb::SBFrame sb_frame (frame_sp);
lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp); lldb::SBBreakpointLocation sb_bp_loc(bp_loc_sp);
bool stop_at_breakpoint = true; bool stop_at_breakpoint = true;
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return stop_at_breakpoint; return stop_at_breakpoint;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(sb_frame, sb_bp_loc, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (pvalue == Py_False) if (pvalue == Py_False)
stop_at_breakpoint = false; stop_at_breakpoint = false;
Py_XDECREF (pvalue); Py_XDECREF (pvalue);
} }
return stop_at_breakpoint; return stop_at_breakpoint;
} }
@ -272,11 +272,11 @@ LLDBSwigPythonBreakpointCallbackFunction
// and is used when a script command is attached to a watchpoint for execution. // and is used when a script command is attached to a watchpoint for execution.
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonWatchpointCallbackFunction LLDBSwigPythonWatchpointCallbackFunction
( (
const char *python_function_name, const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
const lldb::StackFrameSP& frame_sp, const lldb::StackFrameSP& frame_sp,
const lldb::WatchpointSP& wp_sp const lldb::WatchpointSP& wp_sp
) )
{ {
@ -284,27 +284,27 @@ LLDBSwigPythonWatchpointCallbackFunction
lldb::SBWatchpoint sb_wp(wp_sp); lldb::SBWatchpoint sb_wp(wp_sp);
bool stop_at_watchpoint = true; bool stop_at_watchpoint = true;
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return stop_at_watchpoint; return stop_at_watchpoint;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(sb_frame, sb_wp, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (pvalue == Py_False) if (pvalue == Py_False)
stop_at_watchpoint = false; stop_at_watchpoint = false;
Py_XDECREF (pvalue); Py_XDECREF (pvalue);
} }
return stop_at_watchpoint; return stop_at_watchpoint;
} }
@ -336,7 +336,7 @@ PyObjectToString (PyObject* object,
} }
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonCallTypeScript LLDBSwigPythonCallTypeScript
( (
const char *python_function_name, const char *python_function_name,
const void *session_dictionary, const void *session_dictionary,
@ -355,7 +355,7 @@ LLDBSwigPythonCallTypeScript
return false; return false;
PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL; PyObject *session_dict = (PyObject*)session_dictionary, *pfunc_impl = NULL, *pvalue = NULL;
if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper)) if (pyfunct_wrapper && *pyfunct_wrapper && PyFunction_Check (*pyfunct_wrapper))
{ {
pfunc_impl = (PyObject*)(*pyfunct_wrapper); pfunc_impl = (PyObject*)(*pyfunct_wrapper);
@ -369,7 +369,7 @@ LLDBSwigPythonCallTypeScript
if (PyDict_Check(session_dict)) if (PyDict_Check(session_dict))
{ {
PyErr_Cleaner pyerr_cleanup(true); // show Python errors PyErr_Cleaner pyerr_cleanup(true); // show Python errors
if (!pfunc_impl) if (!pfunc_impl)
{ {
pfunc_impl = ResolvePythonName (python_function_name, session_dict); pfunc_impl = ResolvePythonName (python_function_name, session_dict);
@ -383,7 +383,7 @@ LLDBSwigPythonCallTypeScript
} }
PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl); PyCallable pfunc = PyCallable::FindWithPythonObject(pfunc_impl);
if (!pfunc) if (!pfunc)
return false; return false;
@ -397,16 +397,16 @@ LLDBSwigPythonCallTypeScript
pvalue = pfunc(sb_value,session_dict); pvalue = pfunc(sb_value,session_dict);
Py_INCREF (session_dict); Py_INCREF (session_dict);
PyObjectToString(pvalue,retval); PyObjectToString(pvalue,retval);
Py_XDECREF (pvalue); Py_XDECREF (pvalue);
} }
return true; return true;
} }
SWIGEXPORT void* SWIGEXPORT void*
LLDBSwigPythonCreateSyntheticProvider LLDBSwigPythonCreateSyntheticProvider
( (
const char *python_class_name, const char *python_class_name,
const char *session_dictionary_name, const char *session_dictionary_name,
@ -426,26 +426,26 @@ LLDBSwigPythonCreateSyntheticProvider
if (ValObj_PyObj == NULL) if (ValObj_PyObj == NULL)
Py_RETURN_NONE; Py_RETURN_NONE;
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
Py_INCREF(ValObj_PyObj); Py_INCREF(ValObj_PyObj);
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
session_dict = FindSessionDictionary(session_dictionary_name); session_dict = FindSessionDictionary(session_dictionary_name);
retval = pfunc(sb_value, session_dict); retval = pfunc(sb_value, session_dict);
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
Py_XINCREF(retval); Py_XINCREF(retval);
} }
if (retval) if (retval)
return retval; return retval;
else else
@ -469,21 +469,21 @@ LLDBSwigPythonCreateCommandObject
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
session_dict = FindSessionDictionary(session_dictionary_name); session_dict = FindSessionDictionary(session_dictionary_name);
retval = pfunc(debugger_sb, session_dict); retval = pfunc(debugger_sb, session_dict);
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
Py_XINCREF(retval); Py_XINCREF(retval);
} }
if (retval) if (retval)
return retval; return retval;
else else
@ -511,26 +511,26 @@ LLDBSwigPythonCreateScriptedThreadPlan
if (ThreadPlan_PyObj == NULL) if (ThreadPlan_PyObj == NULL)
Py_RETURN_NONE; Py_RETURN_NONE;
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name, session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name, session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
Py_INCREF(ThreadPlan_PyObj); Py_INCREF(ThreadPlan_PyObj);
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
session_dict = FindSessionDictionary(session_dictionary_name); session_dict = FindSessionDictionary(session_dictionary_name);
retval = pfunc(tp_value, session_dict); retval = pfunc(tp_value, session_dict);
// FIXME: At this point we should check that the class we found supports all the methods // FIXME: At this point we should check that the class we found supports all the methods
// that we need. // that we need.
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
Py_XINCREF(retval); Py_XINCREF(retval);
} }
@ -554,9 +554,9 @@ LLDBSWIGPythonCallThreadPlan
PyErr_Cleaner py_err_cleaner(false); PyErr_Cleaner py_err_cleaner(false);
PyCallable pfunc = PyCallable::FindWithMemberFunction((PyObject *) implementor, method_name); PyCallable pfunc = PyCallable::FindWithMemberFunction((PyObject *) implementor, method_name);
if (!pfunc) if (!pfunc)
{ {
return ret_val; return ret_val;
@ -596,7 +596,7 @@ LLDBSWIGPythonCallThreadPlan
printf ("Wrong return value type for call to %s.\n", method_name); printf ("Wrong return value type for call to %s.\n", method_name);
} }
} }
Py_XDECREF(py_return); Py_XDECREF(py_return);
return ret_val; return ret_val;
@ -613,9 +613,9 @@ LLDBSwigPython_CallOptionalMember
) )
{ {
PyErr_Cleaner py_err_cleaner(false); PyErr_Cleaner py_err_cleaner(false);
PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name); PyCallable pfunc = PyCallable::FindWithMemberFunction(self,callee_name);
if (!pfunc) if (!pfunc)
{ {
if (was_found) if (was_found)
@ -623,10 +623,10 @@ LLDBSwigPython_CallOptionalMember
Py_XINCREF(ret_if_not_found); Py_XINCREF(ret_if_not_found);
return ret_if_not_found; return ret_if_not_found;
} }
if (was_found) if (was_found)
*was_found = true; *was_found = true;
PyObject* py_return = pfunc(); PyObject* py_return = pfunc();
return py_return; return py_return;
} }
@ -650,13 +650,13 @@ LLDBSwigPython_CalculateNumChildren
ret_val = PyInt_AsLong(py_return); ret_val = PyInt_AsLong(py_return);
Py_XDECREF(py_return); Py_XDECREF(py_return);
if (PyErr_Occurred()) if (PyErr_Occurred())
{ {
PyErr_Print(); PyErr_Print();
PyErr_Clear(); PyErr_Clear();
} }
return ret_val; return ret_val;
} }
@ -668,33 +668,33 @@ LLDBSwigPython_GetChildAtIndex
) )
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index"); PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_at_index");
if (!pfunc) if (!pfunc)
return NULL; return NULL;
PyObject *py_return = NULL; PyObject *py_return = NULL;
py_return = pfunc(idx); py_return = pfunc(idx);
if (py_return == NULL || py_return == Py_None) if (py_return == NULL || py_return == Py_None)
{ {
Py_XDECREF(py_return); Py_XDECREF(py_return);
return NULL; return NULL;
} }
lldb::SBValue* sbvalue_ptr = NULL; lldb::SBValue* sbvalue_ptr = NULL;
if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1) if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
{ {
Py_XDECREF(py_return); Py_XDECREF(py_return);
return NULL; return NULL;
} }
if (sbvalue_ptr == NULL) if (sbvalue_ptr == NULL)
return NULL; return NULL;
return py_return; return py_return;
} }
SWIGEXPORT int SWIGEXPORT int
@ -705,27 +705,27 @@ LLDBSwigPython_GetIndexOfChildWithName
) )
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index"); PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"get_child_index");
if (!pfunc) if (!pfunc)
return UINT32_MAX; return UINT32_MAX;
PyObject *py_return = NULL; PyObject *py_return = NULL;
py_return = pfunc(child_name); py_return = pfunc(child_name);
if (py_return == NULL || py_return == Py_None) if (py_return == NULL || py_return == Py_None)
{ {
Py_XDECREF(py_return); Py_XDECREF(py_return);
return UINT32_MAX; return UINT32_MAX;
} }
long retval = PyInt_AsLong(py_return); long retval = PyInt_AsLong(py_return);
Py_XDECREF(py_return); Py_XDECREF(py_return);
if (retval >= 0) if (retval >= 0)
return (uint32_t)retval; return (uint32_t)retval;
return UINT32_MAX; return UINT32_MAX;
} }
@ -745,7 +745,7 @@ LLDBSwigPython_UpdateSynthProviderInstance
ret_val = true; ret_val = true;
Py_XDECREF(py_return); Py_XDECREF(py_return);
return ret_val; return ret_val;
} }
@ -765,7 +765,7 @@ LLDBSwigPython_MightHaveChildrenSynthProviderInstance
ret_val = true; ret_val = true;
Py_XDECREF(py_return); Py_XDECREF(py_return);
return ret_val; return ret_val;
} }
@ -785,7 +785,7 @@ LLDBSwigPython_GetValueSynthProviderInstance
ret_val = nullptr; ret_val = nullptr;
lldb::SBValue* sbvalue_ptr = NULL; lldb::SBValue* sbvalue_ptr = NULL;
if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1) if (SWIG_ConvertPtr(py_return, (void**)&sbvalue_ptr, SWIGTYPE_p_lldb__SBValue, 0) == -1)
ret_val = nullptr; ret_val = nullptr;
else if (sbvalue_ptr == NULL) else if (sbvalue_ptr == NULL)
@ -804,7 +804,7 @@ LLDBSWIGPython_CastPyObjectToSBValue
) )
{ {
lldb::SBValue* sb_ptr = NULL; lldb::SBValue* sb_ptr = NULL;
int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0); int valid_cast = SWIG_ConvertPtr(data, (void**)&sb_ptr, SWIGTYPE_p_lldb__SBValue, 0);
if (valid_cast == -1) if (valid_cast == -1)
@ -838,7 +838,7 @@ private:
}; };
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonCallCommand LLDBSwigPythonCallCommand
( (
const char *python_function_name, const char *python_function_name,
const char *session_dictionary_name, const char *session_dictionary_name,
@ -859,7 +859,7 @@ LLDBSwigPythonCallCommand
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
@ -873,13 +873,13 @@ LLDBSwigPythonCallCommand
pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));
else else
pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(debugger_sb, args, &cmd_retobj_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
Py_XDECREF (pvalue); Py_XDECREF (pvalue);
retval = true; retval = true;
} }
return retval; return retval;
} }
@ -905,7 +905,7 @@ LLDBSwigPythonCallCommandObject
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"__call__"); PyCallable pfunc = PyCallable::FindWithMemberFunction(implementor,"__call__");
if (!pfunc) if (!pfunc)
return NULL; return NULL;
@ -916,10 +916,10 @@ LLDBSwigPythonCallCommandObject
pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb); pvalue = pfunc(debugger_sb, args, exe_ctx_sb, &cmd_retobj_sb);
Py_XDECREF (pvalue); Py_XDECREF (pvalue);
retval = true; retval = true;
} }
return retval; return retval;
} }
@ -947,23 +947,23 @@ LLDBSWIGPythonCreateOSPlugin
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_class_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
Py_INCREF(SBProc_PyObj); Py_INCREF(SBProc_PyObj);
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
session_dict = session_dict = FindSessionDictionary(session_dictionary_name); session_dict = session_dict = FindSessionDictionary(session_dictionary_name);
retval = pfunc(SBProc_PyObj); retval = pfunc(SBProc_PyObj);
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
Py_XINCREF(retval); Py_XINCREF(retval);
} }
if (retval) if (retval)
return retval; return retval;
else else
@ -978,19 +978,19 @@ LLDBSWIGPython_GetDynamicSetting (void* module, const char* setting, const lldb:
Py_RETURN_NONE; Py_RETURN_NONE;
lldb::SBTarget target_sb(target_sp); lldb::SBTarget target_sb(target_sp);
PyObject *pvalue = NULL; PyObject *pvalue = NULL;
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName("get_dynamic_setting",(PyObject *)module); PyCallable pfunc = PyCallable::FindWithFunctionName("get_dynamic_setting",(PyObject *)module);
if (!pfunc) if (!pfunc)
Py_RETURN_NONE; Py_RETURN_NONE;
pvalue = pfunc(target_sb, setting); pvalue = pfunc(target_sb, setting);
} }
return pvalue; return pvalue;
} }
@ -1011,24 +1011,24 @@ std::string& output)
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(process_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (PyObjectToString(pvalue,output)) if (PyObjectToString(pvalue,output))
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
@ -1046,27 +1046,27 @@ std::string& output)
return retval; return retval;
lldb::SBThread thread_sb(thread); lldb::SBThread thread_sb(thread);
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(thread_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (PyObjectToString(pvalue,output)) if (PyObjectToString(pvalue,output))
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
@ -1084,27 +1084,27 @@ std::string& output)
return retval; return retval;
lldb::SBTarget target_sb(target); lldb::SBTarget target_sb(target);
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(target_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (PyObjectToString(pvalue,output)) if (PyObjectToString(pvalue,output))
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
@ -1122,27 +1122,27 @@ std::string& output)
return retval; return retval;
lldb::SBFrame frame_sb(frame); lldb::SBFrame frame_sb(frame);
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(frame_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (PyObjectToString(pvalue,output)) if (PyObjectToString(pvalue,output))
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
@ -1160,32 +1160,32 @@ std::string& output)
return retval; return retval;
lldb::SBValue value_sb(value); lldb::SBValue value_sb(value);
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return retval; return retval;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(value_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(value_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
if (PyObjectToString(pvalue,output)) if (PyObjectToString(pvalue,output))
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
SWIGEXPORT bool SWIGEXPORT bool
LLDBSwigPythonCallModuleInit LLDBSwigPythonCallModuleInit
( (
const char *python_module_name, const char *python_module_name,
const char *session_dictionary_name, const char *session_dictionary_name,
@ -1199,26 +1199,26 @@ LLDBSwigPythonCallModuleInit
std::string python_function_name_string = python_module_name; std::string python_function_name_string = python_module_name;
python_function_name_string += ".__lldb_init_module"; python_function_name_string += ".__lldb_init_module";
const char* python_function_name = python_function_name_string.c_str(); const char* python_function_name = python_function_name_string.c_str();
{ {
PyErr_Cleaner py_err_cleaner(true); PyErr_Cleaner py_err_cleaner(true);
PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name);
if (!pfunc) if (!pfunc)
return true; return true;
PyObject* session_dict = NULL; PyObject* session_dict = NULL;
PyObject* pvalue = NULL; PyObject* pvalue = NULL;
pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name)); pvalue = pfunc(debugger_sb, session_dict = FindSessionDictionary(session_dictionary_name));
Py_XINCREF (session_dict); Py_XINCREF (session_dict);
retval = true; retval = true;
Py_XDECREF(pvalue); Py_XDECREF(pvalue);
} }
return retval; return retval;
} }
%} %}
@ -1228,7 +1228,7 @@ LLDBSwigPythonCallModuleInit
// Forward declaration to be inserted at the start of LLDBWrapPython.h // Forward declaration to be inserted at the start of LLDBWrapPython.h
#include "lldb/API/SBDebugger.h" #include "lldb/API/SBDebugger.h"
#include "lldb/API/SBValue.h" #include "lldb/API/SBValue.h"
SWIGEXPORT lldb::ValueObjectSP SWIGEXPORT lldb::ValueObjectSP
LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data) LLDBSWIGPython_GetValueObjectSPFromSBValue (void* data)
{ {