[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:52 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;
----------------
labath wrote:

```suggestion
    auto original_callback_func =
        reinterpret_cast<lldb::SBNotificationCallback>(original_callback);
```

(use c++ cast, and avoid repeating the type)

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


More information about the lldb-commits mailing list