[Lldb-commits] [lldb] r222593 - Enable Python summaries to use custom SBTypeSummaryOptions if the user is so inclined. Updates to the webdoc will follow
Enrico Granata
egranata at apple.com
Fri Nov 21 16:02:48 PST 2014
Author: enrico
Date: Fri Nov 21 18:02:47 2014
New Revision: 222593
URL: http://llvm.org/viewvc/llvm-project?rev=222593&view=rev
Log:
Enable Python summaries to use custom SBTypeSummaryOptions if the user is so inclined. Updates to the webdoc will follow
Modified:
lldb/trunk/include/lldb/API/SBTypeSummary.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/scripts/Python/python-swigsafecast.swig
lldb/trunk/scripts/Python/python-wrapper.swig
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/DataFormatters/TypeSummary.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeSummary.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSummary.h Fri Nov 21 18:02:47 2014
@@ -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);
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Nov 21 18:02:47 2014
@@ -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;
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Fri Nov 21 18:02:47 2014
@@ -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
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Fri Nov 21 18:02:47 2014
@@ -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;
Modified: lldb/trunk/scripts/Python/python-swigsafecast.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-swigsafecast.swig (original)
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig Fri Nov 21 18:02:47 2014
@@ -133,3 +133,10 @@ SBTypeToSWIGWrapper (lldb::SBExecutionCo
{
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);
+}
Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Fri Nov 21 18:02:47 2014
@@ -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);
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Fri Nov 21 18:02:47 2014
@@ -594,6 +594,7 @@ LLDBSwigPythonCallTypeScript (const char
void *session_dictionary,
const lldb::ValueObjectSP& valobj_sp,
void** pyfunct_wrapper,
+ const lldb::TypeSummaryOptionsSP& options_sp,
std::string& retval);
extern "C" void*
Modified: lldb/trunk/source/DataFormatters/TypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSummary.cpp?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSummary.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSummary.cpp Fri Nov 21 18:02:47 2014
@@ -237,6 +237,7 @@ ScriptSummaryFormat::FormatObject (Value
return script_interpreter->GetScriptedSummary(m_function_name.c_str(),
valobj->GetSP(),
m_script_function_sp,
+ options,
retval);
}
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=222593&r1=222592&r2=222593&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri Nov 21 18:02:47 2014
@@ -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::GetScriptedSumm
{
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);
}
}
More information about the lldb-commits
mailing list