================
@@ -1427,8 +1440,30 @@ void
Debugger::SetLoggingCallback(lldb::LogOutputCallback log_callback,
void Debugger::SetDestroyCallback(
lldb_private::DebuggerDestroyCallback destroy_callback, void *baton) {
- m_destroy_callback = destroy_callback;
- m_destroy_callback_baton = baton;
+ std::lock_guard<std::mutex> guard(m_destroy_callback_mutex);
+ m_destroy_callbacks.clear();
+ const lldb::destroy_callback_token_t token = m_destroy_callback_next_token++;
+ m_destroy_callbacks.emplace_back(token, destroy_callback, baton);
+}
+
+lldb::destroy_callback_token_t Debugger::AddDestroyCallback(
+ lldb_private::DebuggerDestroyCallback destroy_callback, void *baton) {
+ std::lock_guard<std::mutex> guard(m_destroy_callback_mutex);
+ const lldb::destroy_callback_token_t token = m_destroy_callback_next_token++;
+ m_destroy_callbacks.emplace_back(token, destroy_callback, baton);
+ return token;
+}
+
+bool Debugger::RemoveDestroyCallback(lldb::destroy_callback_token_t token) {
+ std::lock_guard<std::mutex> guard(m_destroy_callback_mutex);
+ for (auto it = m_destroy_callbacks.begin(); it != m_destroy_callbacks.end();
+ ++it) {
+ if (std::get<0>(*it) == token) {
----------------
clayborg wrote:
Convert to use the new `DestroyCallbackInfo` struct members.
https://github.com/llvm/llvm-project/pull/89868
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits