[Lldb-commits] [lldb] Add SBDebugger::AddCreateCallback API (PR #111206)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 8 02:16:41 PDT 2024
labath wrote:
Hello all,
I'm parachuting in here because we also have a use case that might benefit from something like this. In our case, we want to run some actions (set up data formatters, source paths, etc.) if we find that we're working with a certain kind of binary (which contains information on how to find these). We're currently using a combination of "module loaded" events and stop hooks for this, but neither of them is ideal because the events are asynchronous (so lldb doesn't wait for our processing to finish), and stop hooks happen slightly too late. Ideally, we'd like our hook to run (synchronously) after target creation (or after its executable has been set).
I don't really have much to say about the implementation except a note that a one-callback-to-rule-them all might not be ideal for the case where one wants to hook only a certain kind of events. Sure, you can do filtering in the callback, but it means you still get called, which may matter if some of the events occur frequently. This probably doesn't matter for target creation, but it may not be ideal to get called e.g. after every process stop if all you wanted to hook was debugger creation.
https://github.com/llvm/llvm-project/pull/111206
More information about the lldb-commits
mailing list