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.

llvm-svn: 372222
This commit is contained in:
Pavel Labath 2019-09-18 12:58:52 +00:00
parent 98c0dc39de
commit fc1fd6bf9f
3 changed files with 7 additions and 7 deletions

View File

@ -1,2 +1,2 @@
import lldb
print("frame:py: {}".format(lldb.frame))
print("frame.py: {}".format(lldb.frame))

View File

@ -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

View File

@ -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
%}