[Lldb-commits] [lldb] r266033 - Restore the lazy initialization of ScriptInterpreterPython, which was lost as part of the SystemLifetimeManager work

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 11 18:41:40 PDT 2016


> On Apr 11, 2016, at 6:28 PM, Zachary Turner <zturner at google.com> wrote:
> 
> I have a feeling this breaks something, but I'm not sure what. I remember specifically needing this for some reason.
> 

If you manage to repro the breakage, let’s work on getting it fixed
I’d like to not have to initialize Python eagerly - most users will probably not touch anything Python during debugging, and I have seen a few spin dumps connected to the eager initialization during debugging startup

> Did you verify that the gtest suite

No - but I believe the bots run it, so I will probably get yelled at soon if I broke something

> as well as the dotest suite

Yes

> and the interactive interpreter all still pass / work?

Yes

> On Mon, Apr 11, 2016 at 6:14 PM Enrico Granata via lldb-commits <lldb-commits at lists.llvm.org <mailto:lldb-commits at lists.llvm.org>> wrote:
> Author: enrico
> Date: Mon Apr 11 20:08:35 2016
> New Revision: 266033
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=266033&view=rev <http://llvm.org/viewvc/llvm-project?rev=266033&view=rev>
> Log:
> Restore the lazy initialization of ScriptInterpreterPython, which was lost as part of the SystemLifetimeManager work
> 
> 
> Modified:
>     lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
>     lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
> 
> 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=266033&r1=266032&r2=266033&view=diff <http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=266033&r1=266032&r2=266033&view=diff>
> ==============================================================================
> --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
> +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Mon Apr 11 20:08:35 2016
> @@ -274,8 +274,8 @@ 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;
>      run_string.Printf ("%s = dict()", m_dictionary_name.c_str());
> @@ -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/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h?rev=266033&r1=266032&r2=266033&view=diff <http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h?rev=266033&r1=266032&r2=266033&view=diff>
> ==============================================================================
> --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h (original)
> +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Mon Apr 11 20:08:35 2016
> @@ -372,9 +372,6 @@ public:
>      void ResetOutputFileHandle(FILE *new_fh) override;
> 
>      static void
> -    InitializePrivate ();
> -
> -    static void
>      InitializeInterpreter (SWIGInitCallback python_swig_init_callback,
>                             SWIGBreakpointCallbackFunction swig_breakpoint_callback,
>                             SWIGWatchpointCallbackFunction swig_watchpoint_callback,
> @@ -507,6 +504,9 @@ public:
>      };
> 
>  protected:
> +    static void
> +    InitializePrivate ();
> +
>      class SynchronicityHandler
>      {
>      private:
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org <mailto:lldb-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits>


Thanks,
- Enrico
📩 egranata@.com ☎️ 27683

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160411/9fb4b075/attachment.html>


More information about the lldb-commits mailing list