[Lldb-commits] [lldb] [LLDB] Support enabling/disabling InstrumentationRuntime plugins during a debug session (PR #190083)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 6 14:39:30 PDT 2026


================
@@ -2464,7 +2489,36 @@ PluginManager::GetInstrumentationRuntimePluginInfo() {
 }
 bool PluginManager::SetInstrumentationRuntimePluginEnabled(llvm::StringRef name,
                                                            bool enable) {
-  return GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable);
+  if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
+    return false;
+
+  // Find the `InstrumentationRuntimeType` from the plugin name
+  auto type_cb = GetInstrumentationRuntimeInstances().GetTypeCallbackForName(
+      name, /*enabled_only=*/false);
+  if (!type_cb)
+    return false;
+  auto instrumentation_ty = type_cb();
+
+  // Notify all alive processes to enable/disable the plugin
+  bool success = true;
+  for (size_t di = 0; di < Debugger::GetNumDebuggers(); ++di) {
+    DebuggerSP debugger_sp = Debugger::GetDebuggerAtIndex(di);
+    if (!debugger_sp)
----------------
JDevlieghere wrote:

This isn't taking the debugger mutex and shouldn't really be used outside of the debugger class. I'd go as far as saying that `GetDebuggerAtIndex` should be made private, but that's outside the scope of this PR (and there are other (ab)uses). 

This isn't so much a problem for the target list because there you can use the `Targets()` which returns a locking iterator adapter. 

To summarize, I think we should have a `static Debugger::ForEachDebugger(llvm::function_ref<bool(Debugger& debugger)> callback)` or something.

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


More information about the lldb-commits mailing list