[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


================
@@ -6266,6 +6266,45 @@ Process::GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type) {
     return (*pos).second;
 }
 
+bool Process::SetInstrumentationRuntimeEnabled(InstrumentationRuntimeType irt,
+                                               bool enabled) {
+  assert(IsAlive());
+
+  if (auto instrumentation_runtime = GetInstrumentationRuntime(irt)) {
+    // This process already has an instance of this plugin so just
+    // enable/disable it
+    if (enabled)
+      return instrumentation_runtime->Enable();
+    return instrumentation_runtime->Disable();
+  }
+
+  // There's no instance of this plugin for this process.
+
+  if (!enabled)
+    return true; // nothing to do
+
+  // We need to make an instance of this plugin for this process.
+  // This could happen because `plugin disable instrumentation-runtime.*`
+  // was in `.lldbinit` and so the plugin was never created until the user asked
+  // to enable it now.
----------------
JDevlieghere wrote:

This comment doesn't explain why you need an instance, which is what I'd really like to know.

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


More information about the lldb-commits mailing list