[Lldb-commits] [lldb] r372222 - Fix command-script-import.test on linux

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 18 05:58:52 PDT 2019


Author: labath
Date: Wed Sep 18 05:58:52 2019
New Revision: 372222

URL: http://llvm.org/viewvc/llvm-project?rev=372222&view=rev
Log:
Fix command-script-import.test on linux

The test was expecting the value of "lldb.frame" to be None, because it
is cleared after each python interpreter session. However, this is not
true in the very first session, because lldb.py sets these values to
invalid objects (lldb.SBFrame(), etc.).

I have not investigated why is it that this test passes on darwin, but
my guess is that this is because we do extra work on darwin (loading the
objc runtime, etc), which causes us to enter the python interpreter
sooner.

This patch changes lldb.py to also initialize these values to None, as
that seems to make more sense. I also fixed some typos in the test while
I was in there.

Modified:
    lldb/trunk/lit/Commands/Inputs/frame.py
    lldb/trunk/lit/Commands/command-script-import.test
    lldb/trunk/scripts/lldb.swig

Modified: lldb/trunk/lit/Commands/Inputs/frame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/Inputs/frame.py?rev=372222&r1=372221&r2=372222&view=diff
==============================================================================
--- lldb/trunk/lit/Commands/Inputs/frame.py (original)
+++ lldb/trunk/lit/Commands/Inputs/frame.py Wed Sep 18 05:58:52 2019
@@ -1,2 +1,2 @@
 import lldb
-print("frame:py: {}".format(lldb.frame))
+print("frame.py: {}".format(lldb.frame))

Modified: lldb/trunk/lit/Commands/command-script-import.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/command-script-import.test?rev=372222&r1=372221&r2=372222&view=diff
==============================================================================
--- lldb/trunk/lit/Commands/command-script-import.test (original)
+++ lldb/trunk/lit/Commands/command-script-import.test Wed Sep 18 05:58:52 2019
@@ -3,10 +3,10 @@
 # RUN: echo 'command script import %S/Inputs/frame.py' >> %t.in
 
 # RUN: %clang -g -O0 %S/Inputs/main.c -o %t.out
-# RUN: %lldb -b -s %t.in -o 'script print("script: {}").format(lldb.frame)' %t.out | FileCheck %s
+# RUN: %lldb -b -s %t.in -o 'script print("script: {}".format(lldb.frame))' %t.out | FileCheck %s
 
 # Make sure that we don't have access to lldb.frame from the Python script.
-# CHECK: frame:py: No value
+# CHECK: frame.py: None
 
 # Make sure that we do have access to lldb.frame from the script command.
 # CHECK: script: frame #0

Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=372222&r1=372221&r2=372222&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Wed Sep 18 05:58:52 2019
@@ -265,8 +265,8 @@ def lldb_iter(obj, getsize, getelem):
 debugger_unique_id = 0
 SBDebugger.Initialize()
 debugger = None
-target = SBTarget()
-process = SBProcess()
-thread = SBThread()
-frame = SBFrame()
+target = None
+process = None
+thread = None
+frame = None
 %}




More information about the lldb-commits mailing list