mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
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
This commit is contained in:
1 parent
e17428acfa
commit
88282c69f3
11 files changed
+203
No files matched your search
@@ -1059,6 +1059,44 @@ std::string& output)
|
||||
return retval;
|
||||
}
|
||||
|
||||
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
|
||||
(
|
||||
|
||||
Reference in new issue
Block a user