Skip to content

Commit 8b66ff5

Browse files
committed
Support multiple values in plugin enable
1 parent b31b8a8 commit 8b66ff5

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

lldb/source/Commands/CommandObjectPlugin.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,22 @@ class CommandObjectPluginEnable : public CommandObjectParsed {
274274
protected:
275275
void DoExecute(Args &command, CommandReturnObject &result) override {
276276
size_t argc = command.GetArgumentCount();
277-
if (argc != 1) {
278-
result.AppendError("'plugin enable' requires one argument");
277+
if (argc == 0) {
278+
result.AppendError("'plugin enable' requires one or more arguments");
279279
return;
280280
}
281-
llvm::StringRef pattern = command[0].ref();
282281
result.SetStatus(eReturnStatusSuccessFinishResult);
283282

284-
int num_matching = SetEnableOnMatchingPlugins(pattern, result, true);
283+
for (size_t i = 0; i < argc; ++i)
284+
{
285+
llvm::StringRef pattern = command[i].ref();
286+
int num_matching = SetEnableOnMatchingPlugins(pattern, result, true);
285287

286-
if (num_matching == 0)
287-
result.AppendErrorWithFormat("Found no matching plugins to enable");
288+
if (num_matching == 0) {
289+
result.AppendErrorWithFormat("Found no matching plugins to enable for pattern '%s'",pattern.data());
290+
break;
291+
}
292+
}
288293
}
289294
};
290295

lldb/test/Shell/Commands/command-plugin-enable+disable.test

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,24 @@ plugin disable instrumentation-runtime
5757
# CHECK: instrumentation-runtime
5858
# CHECK: [-] AddressSanitizer
5959

60+
# Test plugin enable with multiple arguments.
61+
plugin enable system-runtime instrumentation-runtime
62+
# CHECK-LABEL: plugin enable system-runtime instrumentation-runtime
63+
CHECK: system-runtime
64+
CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries.
65+
CHECK: instrumentation-runtime
66+
CHECK: [+] AddressSanitizer AddressSanitizer instrumentation runtime plugin.
67+
68+
6069
# Test plugin enable/disable for unknown plugin returns an error.
6170
# RUN: %lldb -o "plugin enable some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
6271
# RUN: %lldb -o "plugin disable some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
72+
# RUN: %lldb -o "plugin enable system-runtime some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
6373
# ERROR_PLUGIN_NOT_FOUND: error: Found no matching plugins
6474

6575
# Test plugin enable/disable requires a plugin name.
6676
# RUN: %lldb -o "plugin enable" 2>&1 | FileCheck %s --check-prefix=ERROR_ARGUMENTS_ENABLE
67-
# RUN: %lldb -o "plugin enable a b c" 2>&1 | FileCheck %s --check-prefix=ERROR_ARGUMENTS_ENABLE
68-
# ERROR_ARGUMENTS_ENABLE: error: 'plugin enable' requires one argument
77+
# ERROR_ARGUMENTS_ENABLE: error: 'plugin enable' requires one or more arguments
6978

7079
# RUN: %lldb -o "plugin disable" 2>&1 | FileCheck %s --check-prefix=ERROR_ARGUMENTS_DISABLE
7180
# RUN: %lldb -o "plugin disable a b c" 2>&1 | FileCheck %s --check-prefix=ERROR_ARGUMENTS_DISABLE

0 commit comments

Comments
 (0)