================
@@ -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
----------------
clayborg wrote:

Do we really need a "lldb::destroy_callback_token_t" type here? I would prefer 
if this returns "void" and then modify `RemoveDestroyCallback(...)` to take the 
destroy callback to remove and include the baton so we know we are removing the 
right one:
```
bool RemoveDestroyCallback(lldb::SBDebuggerDestroyCallback destroy_callback, 
void *baton);
```

This would allow someone to install two callback using the same callback, but 
with different baton values for each, and then still remove the right one when 
calling `RemoveDestroyCallback(...)`

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

Reply via email to