[PATCH] D67644: [ScriptInterpreter] Initialize globals when loading a scripting module.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 20:54:30 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL372060: [ScriptInterpreter] Initialize globals when loading a scripting module. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67644?vs=220415&id=220430#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67644/new/

https://reviews.llvm.org/D67644

Files:
  lldb/trunk/lit/Commands/Inputs/frame.py
  lldb/trunk/lit/Commands/command-script-import.test
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2699,12 +2699,12 @@
     StreamString command_stream;
 
     // Before executing Python code, lock the GIL.
-    Locker py_lock(this,
-                   Locker::AcquireLock |
-                       (init_session ? Locker::InitSession : 0) |
-                       Locker::NoSTDIN,
-                   Locker::FreeAcquiredLock |
-                       (init_session ? Locker::TearDownSession : 0));
+    Locker py_lock(
+        this,
+        Locker::AcquireLock | (init_session ? Locker::InitSession : 0) |
+            (init_session ? Locker::InitGlobals : 0) | Locker::NoSTDIN,
+        Locker::FreeAcquiredLock |
+            (init_session ? Locker::TearDownSession : 0));
     namespace fs = llvm::sys::fs;
     fs::file_status st;
     std::error_code ec = status(target_file.GetPath(), st);
Index: lldb/trunk/lit/Commands/command-script-import.test
===================================================================
--- lldb/trunk/lit/Commands/command-script-import.test
+++ lldb/trunk/lit/Commands/command-script-import.test
@@ -0,0 +1,8 @@
+# RUN: echo 'b main' > %t.in
+# RUN: echo 'run' >> %t.in
+# RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in
+
+# RUN: %clang -g -O0 %S/../Settings/Inputs/main.c -o %t.out
+# RUN: %lldb -b -s %t.in %t.out | FileCheck %s
+
+# CHECK: frame #0
Index: lldb/trunk/lit/Commands/Inputs/frame.py
===================================================================
--- lldb/trunk/lit/Commands/Inputs/frame.py
+++ lldb/trunk/lit/Commands/Inputs/frame.py
@@ -0,0 +1,2 @@
+import lldb
+print(lldb.frame)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67644.220430.patch
Type: text/x-patch
Size: 1884 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190917/cede274b/attachment.bin>


More information about the llvm-commits mailing list