jimingham wrote: > Do we want to just do the "command script import" _after_ the target is > created to avoid this? > > Or it would be great to have a way for a python script to add a callback > function to be run after a target is created. So this diff could just do > something like: > > ``` > def target_created_callback(target): > pass # Do something with the target > > def __lldb_init_module(debugger, internal_dict): > debugger.AddTargetCreatedCallback(target_created_callback); > ``` > > Many scripts would love to be able to add functionality during the lifetime > of a debug session like: > > * right before a target is destroyed > * first stop in a process > * each stop of a process > * process exited
Adding callbacks for "life-cycle events" of a target to lldb is a long-standing but considerably larger piece of work. We would want there to be a command line way to do this, and register & deregister actions, etc. Basically a general extension to what we do with stop-hooks. I don't have time to add that feature as the solution to this fairly narrow problem right now. Just deferring the command script import doesn't seem like a very robust solution, because you still aren't telling the code in the dSYM module what Target it's getting loaded into. The only way that the `__lldb_init_module` code can find it is if it happens to still be the currently selected target when it gets to run. We don't currently have a way to ensure that - another target could hit a breakpoint and get to be the selected target between those two steps. https://github.com/llvm/llvm-project/pull/133290 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits