diff options
author | Enrico Granata <egranata@apple.com> | 2012-10-23 19:54:09 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2012-10-23 19:54:09 +0000 |
commit | adaf282c763ecdb07850fc9e534bd9d3d99e71f8 (patch) | |
tree | 5b436b44f1d266e1e3de036b505e0119ba81f1cf /lldb/source/Interpreter/ScriptInterpreterPython.cpp | |
parent | bdcebd323ad7ddf60fb9234f9deb8e720f69e893 (diff) | |
download | bcm5719-llvm-adaf282c763ecdb07850fc9e534bd9d3d99e71f8.tar.gz bcm5719-llvm-adaf282c763ecdb07850fc9e534bd9d3d99e71f8.zip |
<rdar://problem/12523238> Commit 1 of 3
This commit enables the new HasChildren() feature for synthetic children providers
Namely, it hooks up the required bits and pieces so that individual synthetic children providers can implement a new (optional) has_children call
Default implementations have been provided where necessary so that any existing providers continue to work and behave correctly
Next steps are:
2) writing smart implementations of has_children for our providers whenever possible
3) make a test case
llvm-svn: 166495
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 7261e5d8733..fdd406a764a 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -53,6 +53,7 @@ static ScriptInterpreter::SWIGPythonGetChildAtIndex g_swig_get_child_index = NUL static ScriptInterpreter::SWIGPythonGetIndexOfChildWithName g_swig_get_index_child = NULL; static ScriptInterpreter::SWIGPythonCastPyObjectToSBValue g_swig_cast_to_sbvalue = NULL; static ScriptInterpreter::SWIGPythonUpdateSynthProviderInstance g_swig_update_provider = NULL; +static ScriptInterpreter::SWIGPythonMightHaveChildrenSynthProviderInstance g_swig_mighthavechildren_provider = NULL; static ScriptInterpreter::SWIGPythonCallCommand g_swig_call_command = NULL; static ScriptInterpreter::SWIGPythonCallModuleInit g_swig_call_module_init = NULL; static ScriptInterpreter::SWIGPythonCreateOSPlugin g_swig_create_os_plugin = NULL; @@ -99,11 +100,12 @@ LLDBSwigPythonCreateSyntheticProvider ); -extern "C" uint32_t LLDBSwigPython_CalculateNumChildren (void *implementor); -extern "C" void* LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); -extern "C" int LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name); -extern "C" void* LLDBSWIGPython_CastPyObjectToSBValue (void* data); -extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance (void* implementor); +extern "C" uint32_t LLDBSwigPython_CalculateNumChildren (void *implementor); +extern "C" void* LLDBSwigPython_GetChildAtIndex (void *implementor, uint32_t idx); +extern "C" int LLDBSwigPython_GetIndexOfChildWithName (void *implementor, const char* child_name); +extern "C" void* LLDBSWIGPython_CastPyObjectToSBValue (void* data); +extern "C" bool LLDBSwigPython_UpdateSynthProviderInstance (void* implementor); +extern "C" bool LLDBSwigPython_MightHaveChildrenSynthProviderInstance (void* implementor); extern "C" bool LLDBSwigPythonCallCommand ( @@ -2348,6 +2350,30 @@ ScriptInterpreterPython::UpdateSynthProviderInstance (const lldb::ScriptInterpre } bool +ScriptInterpreterPython::MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor_sp) +{ + bool ret_val = false; + + if (!implementor_sp) + return ret_val; + + void* implementor = implementor_sp->GetObject(); + + if (!implementor) + return ret_val; + + if (!g_swig_mighthavechildren_provider) + return ret_val; + + { + Locker py_lock(this); + ret_val = g_swig_mighthavechildren_provider (implementor); + } + + return ret_val; +} + +bool ScriptInterpreterPython::LoadScriptingModule (const char* pathname, bool can_reload, bool init_lldb_globals, @@ -2566,6 +2592,7 @@ ScriptInterpreterPython::InitializeInterpreter (SWIGInitCallback python_swig_ini g_swig_get_index_child = LLDBSwigPython_GetIndexOfChildWithName; g_swig_cast_to_sbvalue = LLDBSWIGPython_CastPyObjectToSBValue; g_swig_update_provider = LLDBSwigPython_UpdateSynthProviderInstance; + g_swig_mighthavechildren_provider = LLDBSwigPython_MightHaveChildrenSynthProviderInstance; g_swig_call_command = LLDBSwigPythonCallCommand; g_swig_call_module_init = LLDBSwigPythonCallModuleInit; g_swig_create_os_plugin = LLDBSWIGPythonCreateOSPlugin; |