[Lldb-commits] [lldb] [lldb] Setup session when calling Python interfaces (PR #197966)
via lldb-commits
lldb-commits at lists.llvm.org
Sat May 16 04:11:41 PDT 2026
Nerixyz wrote:
> If people found it handy to have around, I think it would be fine to always set the debugger on entry - even though it is emphatically not fine to do so for target, process, thread and frame...
>From a [search on GitHub for `lldb.debugger`](https://github.com/search?q=%2Flldb%5C.debugger%2F%20lang%3APython&type=code), it looks like this is used - not just in commands, also in synthetic children providers.
> I think we'll need to split that off then. The `lldb.*` convenience variables should only be set when in the interactive interpreter: [lldb.llvm.org/use/tutorials/python-embedded-interpreter.html](https://lldb.llvm.org/use/tutorials/python-embedded-interpreter.html)
To clarify, the Python interfaces affected by this PR never set `lldb.debugger` nor `lldb.{target, thread, etc.}`. The first one is set when `InitSession` is specified (synthetic children, summaries) and the second one is specified in the interactive interpreter [here](https://github.com/llvm/llvm-project/blob/f5f49343053f9f27d24a9da3424bd30387c72a48/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp#L642-L662).
Given that synthetic children/summaries have `lldb.debugger` set, it might seem counterintuitive that it's not set in the interfaces.
---
I updated the PR to have two commits. In the first, `lldb.debugger` is set, and in the second one, only the stdio handles are set. Synthetic children/summaries are unaffected.
If we decide to set `lldb.debugger` here, I can remove the commit.
https://github.com/llvm/llvm-project/pull/197966
More information about the lldb-commits
mailing list