================ @@ -321,9 +321,26 @@ class LLDB_API SBDebugger { void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); + /// DEPRECATED: We used to only support one Destroy callback. Now that we + /// support Add and Remove, you should only remove Destroy callbacks that + /// you Add-ed. Use Add and Remove instead. + /// + /// Clear all previously added callbacks and only add the given one. + LLDB_DEPRECATED_FIXME("Use AddDestroyCallback and RemoveDestroyCallback", + "AddDestroyCallback") void SetDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, void *baton); + /// Add a callback for when the debugger is destroyed. Return a token, which + /// can be used to remove said callback. Multiple callbacks can be added by + /// calling this function multiple times. + lldb::destroy_callback_token_t ---------------- jimingham wrote:
I don't see the difference. You call: auto token1 = my_debugger.AddDestroyCallback(my_only_callback, baton1); auto token2 = my_debugger.AddDestroyCallback(my_only_callback, baton2); Then when you go to delete the first one, you use `token1`, and the second, `token2`. I don't see the problem deleting the right one. The difference is just: do you want to have to keep around the callback/baton pair in order to potentially disable it; or do you want to hold onto the token you got back. I think the latter is more convenient. https://github.com/llvm/llvm-project/pull/89868 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits