[Lldb-commits] [lldb] [LLDB][Part 1] Support enabling/disabling InstrumentationRuntime plugins in an debug session (PR #193328)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 29 15:52:43 PDT 2026
================
@@ -83,22 +85,67 @@ static int ActOnMatchingPlugins(
// Used to share the majority of the code between the enable
// and disable commands.
int SetEnableOnMatchingPlugins(const llvm::StringRef &pattern,
- CommandReturnObject &result, bool enabled) {
+ CommandReturnObject &result, bool enabled,
+ Debugger &requesting_debugger,
+ PluginDomainKind domain) {
return ActOnMatchingPlugins(
pattern, [&](const PluginNamespace &plugin_namespace,
const std::vector<RegisteredPluginInfo> &plugins) {
+ auto PrintEnablement = [enabled,
+ &result](const RegisteredPluginInfo plugin) {
+ result.AppendMessageWithFormatv(" {0} {1, -30} {2}",
+ enabled ? "[+]" : "[-]", plugin.name,
+ plugin.description);
+ };
+
result.AppendMessage(plugin_namespace.name);
for (const auto &plugin : plugins) {
- if (!plugin_namespace.set_enabled(plugin.name, enabled)) {
- result.AppendErrorWithFormat("failed to enable plugin %s.%s",
- plugin_namespace.name.data(),
- plugin.name.data());
+ if (plugin_namespace.SupportsOnlyDomain(
+ PluginDomainKind::ePluginDomainKindGlobal)) {
+ bool success = true;
+ if (domain != ePluginDomainKindGlobal) {
+ result.AppendErrorWithFormatv(
+ "failed to {} plugin {}.{}: {} domain is not supported",
+ enabled ? "enable" : "disable", plugin_namespace.name,
+ plugin.name, PluginManager::PluginDomainKindToStr(domain));
+ continue;
+ }
+ success = (*plugin_namespace.GetSetEnabledGlobalFn())(plugin.name,
+ enabled);
+
+ if (!success) {
+ result.AppendErrorWithFormatv("failed to {} plugin {}.{}",
+ enabled ? "enable" : "disable",
+ plugin_namespace.name, plugin.name);
+ continue;
+ }
+ PrintEnablement(plugin);
continue;
}
- result.AppendMessageWithFormatv(" {0} {1, -30} {2}",
- enabled ? "[+]" : "[-]", plugin.name,
- plugin.description);
+ // Handle plugin namespace that supports more than just the global
+ // domain. Currently this is just the instrumentation-runtime
+ // namespace.
+ if (!plugin_namespace.SupportsDomain(domain)) {
+ result.AppendErrorWithFormatv(
+ "failed to {0} plugin {1}.{2}: because the {1} namespace "
----------------
JDevlieghere wrote:
```suggestion
"failed to {0} plugin {1}.{2}: the {1} namespace "
```
https://github.com/llvm/llvm-project/pull/193328
More information about the lldb-commits
mailing list