[Lldb-commits] [lldb] [lldb][NFC] Defer python init until ScriptInterpreter is created (PR #105757)

Daniel Xu via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 23 13:06:19 PDT 2024


danobi wrote:

 Hi @JDevlieghere , thanks for taking a look at this.

I'm not very familiar with lldb in general so I can't comment much on alternatives. Lazy loading does some fairly reasonable to me but I don't know what kind of code changes that'd require.

The motivation behind this change starts with https://github.com/bpftrace/bpftrace/issues/3329. Basically we got a bug report from a user saying they're getting python errors when running bpftrace. bpftrace does not use python at runtime anywhere, so it was quite surprising. It turns out that lldb was running python standard library code. And the environment bpftrace was running in (appimage) does not have any python support, so no standard library available.

For context, bpftrace uses liblldb to parse DWARF. We used to directly use libdw but it was kinda hard to work with. liblldb has very nice high level API that we found useful for velocity. We never have (and probably never will) use python bindings to lldb.
The reason we can't just compile out python bindings is b/c we need to build with whatever distros give us. And my understanding is that distros are more or less forced to build with bindings on so that lldb (the cli tool) will function.

You're right that this patch only addresses a subset of the real goal - the real goal being we want to disable all plugins at runtime. It'd probably help with performance for other liblldb users as well.

Hopefully this essay makes the goal more clear. Please lemme know how we should proceed. I'd be happy to help out if it's not too complicated.


https://github.com/llvm/llvm-project/pull/105757


More information about the lldb-commits mailing list