Jim pointed out that the LLDB global variables should only be available
in interactive mode. When used from a command for example, their values
might be stale or not at all what the user expects. Therefore we want to
explicitly make these variables unavailable.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This looks right.
EnterSession always initializes lldb.debugger, even when it isn't going to set the other globals. That's because one debugger owns one ScriptInterpreter and lldb.debugger always has a unique, valid value. So it isn't strictly necessary to None out lldb.debugger. But since EnterSession always sets it, I don't think it matters one way or the other.
Unfortunately, there was a bug here which caused the test to fail on linux and windows. r372222 ought to fix that. From the patch description:
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 am pretty sure this will fix the issue on linux, but I am not sure about windows, because it may fail later due to the use of nested quotes, which mostly doesn't work there. Overall, it's usually better to avoid nested quotes in lit tests.