================
@@ -739,16 +745,29 @@ DebuggerSP 
Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
     g_debugger_list_ptr->push_back(debugger_sp);
   }
   debugger_sp->InstanceInitialize();
+
+  InvokeNotificationCallbacks(debugger_sp, lldb::eDebuggerWillBeCreated);
   return debugger_sp;
 }
 
+void Debugger::InvokeNotificationCallbacks(DebuggerSP debugger_sp,
+                                           lldb::NotificationType notify_type) 
{
+  std::lock_guard<std::mutex> guard(s_notification_callback_mutex);
+  for (const auto &callback_info : s_notification_callbacks) {
+    if ((callback_info.type & notify_type) == notify_type)
+      callback_info.callback(notify_type, debugger_sp, nullptr,
----------------
labath wrote:

Note this will deadlock if any of the callbacks try to register _another_ 
callback.

You may want to consider making a copy of the list and iterating over *that* 
(without holding the mutex).

https://github.com/llvm/llvm-project/pull/111206
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to