Enable Python summaries to use custom SBTypeSummaryOptions if the user is so inclined. Updates to the webdoc will follow

llvm-svn: 222593
This commit is contained in:
Enrico Granata 2014-11-22 00:02:47 +00:00
parent 4104b908cc
commit 7e4df56aae
9 changed files with 29 additions and 3 deletions

View File

@ -22,6 +22,8 @@ namespace lldb {
SBTypeSummaryOptions (const lldb::SBTypeSummaryOptions &rhs);
SBTypeSummaryOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
~SBTypeSummaryOptions ();
bool
@ -57,8 +59,6 @@ namespace lldb {
const lldb_private::TypeSummaryOptions &
ref() const;
SBTypeSummaryOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);
void
SetOptions (const lldb_private::TypeSummaryOptions *lldb_object_ptr);

View File

@ -98,6 +98,7 @@ public:
void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP& options,
std::string& retval);
typedef void* (*SWIGPythonCreateSyntheticProvider) (const char *python_class_name,
@ -462,6 +463,7 @@ public:
GetScriptedSummary (const char *function_name,
lldb::ValueObjectSP valobj,
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
const TypeSummaryOptions& options,
std::string& retval)
{
return false;

View File

@ -190,6 +190,7 @@ public:
GetScriptedSummary (const char *function_name,
lldb::ValueObjectSP valobj,
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
const TypeSummaryOptions& options,
std::string& retval);
virtual void

View File

@ -402,6 +402,7 @@ namespace lldb {
typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;
typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP;
typedef std::shared_ptr<lldb_private::TypeSummaryOptions> TypeSummaryOptionsSP;
typedef std::shared_ptr<lldb_private::TypeValidatorImpl> TypeValidatorImplSP;
#ifndef LLDB_DISABLE_PYTHON
typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren> ScriptedSyntheticChildrenSP;

View File

@ -133,3 +133,10 @@ SBTypeToSWIGWrapper (lldb::SBExecutionContext* ctx_sb)
{
return SWIG_NewPointerObj((void *) ctx_sb, SWIGTYPE_p_lldb__SBExecutionContext, 0);
}
template <>
PyObject*
SBTypeToSWIGWrapper (lldb::SBTypeSummaryOptions* summary_options_sb)
{
return SWIG_NewPointerObj((void *) summary_options_sb, SWIGTYPE_p_lldb__SBTypeSummaryOptions, 0);
}

View File

@ -342,10 +342,12 @@ LLDBSwigPythonCallTypeScript
const void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP& options_sp,
std::string& retval
)
{
lldb::SBValue sb_value (valobj_sp);
lldb::SBTypeSummaryOptions sb_options(options_sp.get());
retval.clear();
@ -384,7 +386,14 @@ LLDBSwigPythonCallTypeScript
if (!pfunc)
return false;
// if the third argument is supported, or varargs are allowed
PyCallable::argc argc = pfunc.GetNumArguments();
if (argc.num_args == 3 || argc.varargs == true)
pvalue = pfunc(sb_value,session_dict,sb_options);
else
pvalue = pfunc(sb_value,session_dict);
pvalue = pfunc(sb_value,session_dict);
Py_INCREF (session_dict);

View File

@ -594,6 +594,7 @@ LLDBSwigPythonCallTypeScript (const char *python_function_name,
void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
const lldb::TypeSummaryOptionsSP& options_sp,
std::string& retval);
extern "C" void*

View File

@ -237,6 +237,7 @@ ScriptSummaryFormat::FormatObject (ValueObject *valobj,
return script_interpreter->GetScriptedSummary(m_function_name.c_str(),
valobj->GetSP(),
m_script_function_sp,
options,
retval);
}

View File

@ -1860,6 +1860,7 @@ bool
ScriptInterpreterPython::GetScriptedSummary (const char *python_function_name,
lldb::ValueObjectSP valobj,
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
const TypeSummaryOptions& options,
std::string& retval)
{
@ -1881,11 +1882,14 @@ ScriptInterpreterPython::GetScriptedSummary (const char *python_function_name,
{
Locker py_lock(this, Locker::AcquireLock | Locker::InitSession | Locker::NoSTDIN);
{
TypeSummaryOptionsSP options_sp(new TypeSummaryOptions(options));
Timer scoped_timer ("g_swig_typescript_callback","g_swig_typescript_callback");
ret_val = g_swig_typescript_callback (python_function_name,
GetSessionDictionary().get(),
valobj,
&new_callee,
options_sp,
retval);
}
}