================
@@ -464,6 +466,24 @@ llvm::json::Value DebuggerStats::ReportStatistics(
     }
   }
 
+  if (include_plugins) {
+    json::Object plugin_stats;
+    for (const PluginNamespace &plugin_ns :
+         PluginManager::GetPluginNamespaces()) {
+      json::Array namespace_stats;
+
+      for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
+        json::Object plugin_json;
+        plugin_json.try_emplace("name", plugin.name);
+        plugin_json.try_emplace("enabled", plugin.enabled);
+
+        namespace_stats.emplace_back(std::move(plugin_json));
+      }
+      plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
+    }
+    global_stats.try_emplace("plugins", std::move(plugin_stats));
+  }
+
----------------
clayborg wrote:

Move this code into the plug-in manager itself so that others can re-use it 
from "plugin list --json". Might be nice to take a `pattern` to list only some 
plug-ins. 

```
json::Object PluginManager::GetJSON(StringRef pattern);
```

Where if pattern in empty, it will match everything and the JSON will contain 
everything, but if it contains "system-runtime" then it will return JSON for 
only that pattern. Make this easy to plug-in to "plugin list --json"

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

Reply via email to