[Lldb-commits] [PATCH] D93926: [lldb] Don't remove the lldb.debugger var after exiting the interpreter

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 5 08:55:07 PST 2021

JDevlieghere added a comment.

Your argument is correct because the interactive script interpreter always belongs to a single debugger. That being said, I don't like this for a few reasons:

- LLDB supports multiple debuggers and the relationship between the script interpreter and the debugger are an implementation detail. This shouldn't be something the user has to think or know about.
- The convenience variables were introduced with a very specific goad and empirically only a small subset of the users actually understands their purpose and limitations. It's already relatively complex and adding an exception for the debugger only makes things harder to explain and understand.
- There's always a way to get the debugger in a non-interactive context (e.g. `__lldb_init_module` or from the current `frame`).

FWIW this has always been LLDB's behavior. You're probably seeing it now because the convenience variables are initialized to `None` (instead of default constructed) which results in a Python exception when you try to call a method on them. We got some reports of this internally and in most cases the convenience variables were misused and potential bug got fixed. There were a few innocent uses, such as in the `crashlog.py` script which I've since fixed.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list