[Lldb-commits] [lldb] r266103 - Initialize the Python script interpreter lazily (i.e. not at debugger startup)
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 12 11:23:18 PDT 2016
Author: enrico
Date: Tue Apr 12 13:23:18 2016
New Revision: 266103
URL: http://llvm.org/viewvc/llvm-project?rev=266103&view=rev
Log:
Initialize the Python script interpreter lazily (i.e. not at debugger startup)
This time it should also pass the gtests
Modified:
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=266103&r1=266102&r2=266103&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Tue Apr 12 13:23:18 2016
@@ -274,7 +274,7 @@ ScriptInterpreterPython::ScriptInterpret
m_lock_count(0),
m_command_thread_state(nullptr)
{
- assert(g_initialized && "ScriptInterpreterPython created but InitializePrivate has not been called!");
+ InitializePrivate();
m_dictionary_name.append("_dict");
StreamString run_string;
@@ -330,8 +330,6 @@ ScriptInterpreterPython::Initialize()
std::call_once(g_once_flag, []()
{
- InitializePrivate();
-
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(),
lldb::eScriptLanguagePython,
@@ -3097,7 +3095,9 @@ ScriptInterpreterPython::InitializeInter
void
ScriptInterpreterPython::InitializePrivate ()
{
- assert(!g_initialized && "ScriptInterpreterPython::InitializePrivate() called more than once!");
+ if (g_initialized)
+ return;
+
g_initialized = true;
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp?rev=266103&r1=266102&r2=266103&view=diff
==============================================================================
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp Tue Apr 12 13:23:18 2016
@@ -24,6 +24,7 @@ PythonTestSuite::SetUp()
// ScriptInterpreterPython::Initialize() depends on HostInfo being
// initializedso it can compute the python directory etc.
ScriptInterpreterPython::Initialize();
+ ScriptInterpreterPython::InitializePrivate();
// Although we don't care about concurrency for the purposes of running
// this test suite, Python requires the GIL to be locked even for
More information about the lldb-commits
mailing list