[Lldb-commits] [lldb] [LLDB] Add module hook implementation (PR #185465)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 30 16:52:58 PDT 2026
jimingham wrote:
I'm still not sure how the commands (or the --one-line option for `target hook add` are supposed to work. You still accumulate all the commands into one command list, so do you just run all the commands entered for every trigger that the hook signs up for? I was sort of expecting something like:
target hook add --on-stop -o "first stop command" -o "second stop command" --on-load -o "first load command"
but that's both awkward and introduces an order dependency we don't usually have in the lldb command line.
But TTTT, the uses of the Scripted Class based and these command-line based hooks are pretty different. The big advantage of the class based method is that all the hook reaction functions are methods of the same object. So you can use them to orchestrate behavior at a higher level than the individual hooks. But there's no way to do that with the command-lines, since that's just a list of commands, it has no state.
And it would be weird to mix and match class and command based hooks.
Moreover, you don't really need to have a hook class tell you explicitly which hooks it supports. It does that by implementing the hook callbacks.
So it might be fine to have the two flows in `target hook add` - the one that takes a Python class and filters, and the one that takes a common list of commands and a set triggers options.
https://github.com/llvm/llvm-project/pull/185465
More information about the lldb-commits
mailing list