diff options
author | Enrico Granata <egranata@apple.com> | 2014-10-28 21:07:00 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-10-28 21:07:00 +0000 |
commit | 88282c69f3cb26aa9c2b805768866bda575cac84 (patch) | |
tree | 73d86994071daecf5c3717b888d3a265a89e58e2 /lldb/scripts/Python/python-wrapper.swig | |
parent | e17428acfa5a14fa016bf9c9783dee64caf6f1e9 (diff) | |
download | bcm5719-llvm-88282c69f3cb26aa9c2b805768866bda575cac84.tar.gz bcm5719-llvm-88282c69f3cb26aa9c2b805768866bda575cac84.zip |
Add a feature where a string data formatter can now be partially composed of Python summary functions
This works similarly to the {thread/frame/process/target.script:...} feature - you write a summary string, part of which is
${var.script:someFuncName}
someFuncName is expected to be declared as
def someFuncName(SBValue,otherArgument) - essentially the same as a summary function
Since . -> [] are the only allowed separators, and % is used for custom formatting, .script: would not be a legitimate symbol anyway, which makes this non-ambiguous
llvm-svn: 220821
Diffstat (limited to 'lldb/scripts/Python/python-wrapper.swig')
-rw-r--r-- | lldb/scripts/Python/python-wrapper.swig | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig index 35145c2341d..1eaa52ba246 100644 --- a/lldb/scripts/Python/python-wrapper.swig +++ b/lldb/scripts/Python/python-wrapper.swig @@ -1060,6 +1060,44 @@ std::string& output) } SWIGEXPORT bool +LLDBSWIGPythonRunScriptKeywordValue +(const char* python_function_name, +const char* session_dictionary_name, +lldb::ValueObjectSP& value, +std::string& output) + +{ + bool retval = false; + + if (python_function_name == NULL || python_function_name[0] == '\0' || !session_dictionary_name) + return retval; + + lldb::SBValue value_sb(value); + + { + PyErr_Cleaner py_err_cleaner(true); + + PyCallable pfunc = PyCallable::FindWithFunctionName(python_function_name,session_dictionary_name); + + if (!pfunc) + return retval; + + PyObject* session_dict = NULL; + PyObject* pvalue = NULL; + pvalue = pfunc(value_sb, session_dict = FindSessionDictionary(session_dictionary_name)); + + Py_XINCREF (session_dict); + + if (PyObjectToString(pvalue,output)) + retval = true; + + Py_XDECREF(pvalue); + } + + return retval; +} + +SWIGEXPORT bool LLDBSwigPythonCallModuleInit ( const char *python_module_name, |