[Lldb-commits] [lldb] Add SBDebugger:: AddNotificationCallback API (PR #111206)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 10 04:05:51 PDT 2024


================
@@ -1703,6 +1703,30 @@ void SBDebugger::SetDestroyCallback(
   }
 }
 
+lldb::callback_token_t SBDebugger::AddNotificationCallback(
+    lldb::NotificationType type,
+    lldb::SBNotificationCallback notification_callback, void *baton) {
+  LLDB_INSTRUMENT_VA(type, notification_callback, baton);
+
+  NotificationCallback callback = [](lldb::NotificationType type,
+                                     lldb::DebuggerSP debugger,
+                                     lldb::ExecutionContextRefSP exe_ctx,
+                                     void *baton, void *original_callback) {
+    SBDebugger sb_debugger(debugger);
+    lldb::SBNotificationCallback original_callback_func =
+        (lldb::SBNotificationCallback)original_callback;
+    SBExecutionContext sb_exe_ctx(exe_ctx);
+    original_callback_func(type, sb_debugger, sb_exe_ctx, baton);
+  };
+  return Debugger::AddNotificationCallback(type, callback, baton,
+                                           (void *)notification_callback);
----------------
labath wrote:

same here

https://github.com/llvm/llvm-project/pull/111206


More information about the lldb-commits mailing list