From c0f8ca0e74f85241aafa8291f207ceb7e5dfe22b Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Mon, 14 Oct 2013 21:39:38 +0000 Subject: Add the capability for LLDB to query an arbitrary Python module (passed in as a file path) for target-specific settings This is implemented by means of a get_dynamic_setting(target, setting_name) function vended by the Python module, which can respond to arbitrary string names with dynamically constructed settings objects (most likely, some of those that PythonDataObjects supports) for LLDB to parse This needs to be hooked up to the debugger via some setting to allow users to specify which module will vend the information they want to supply llvm-svn: 192628 --- lldb/scripts/Python/python-wrapper.swig | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lldb/scripts/Python') diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index cd133cf..4ab27a9 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -713,6 +713,30 @@ LLDBSWIGPythonCreateOSPlugin Py_RETURN_NONE; } +SWIGEXPORT void* +LLDBSWIGPython_GDBPluginGetDynamicSetting (void* module, const char* setting, const lldb::TargetSP& target_sp) +{ + + if (!module || !setting) + Py_RETURN_NONE; + + lldb::SBTarget target_sb(target_sp); + + PyObject *pvalue = NULL; + + { + PyErr_Cleaner py_err_cleaner(true); + PyCallable pfunc = PyCallable::FindWithFunctionName("get_dynamic_setting",(PyObject *)module); + + if (!pfunc) + Py_RETURN_NONE; + + pvalue = pfunc(target_sb, setting); + } + + return pvalue; +} + SWIGEXPORT bool LLDBSWIGPythonRunScriptKeywordProcess (const char* python_function_name, -- cgit v1.1