File tree Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Expand file tree Collapse file tree 4 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,12 @@ class PluginManager {
544544 static InstrumentationRuntimeCreateInstance
545545 GetInstrumentationRuntimeCreateCallbackAtIndex (uint32_t idx);
546546
547+ static std::vector<RegisteredPluginInfo>
548+ GetInstrumentationRuntimePluginInfo ();
549+
550+ static bool SetInstrumentationRuntimePluginEnabled (llvm::StringRef name,
551+ bool enabled);
552+
547553 // TypeSystem
548554 static bool RegisterPlugin (llvm::StringRef name, llvm::StringRef description,
549555 TypeSystemCreateInstance create_callback,
Original file line number Diff line number Diff line change @@ -186,7 +186,10 @@ llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
186186 // over time.
187187 static PluginNamespace PluginNamespaces[] = {
188188 {" system-runtime" , PluginManager::GetSystemRuntimePluginInfo,
189- PluginManager::SetSystemRuntimePluginEnabled}};
189+ PluginManager::SetSystemRuntimePluginEnabled},
190+ {" instrumentation-runtime" ,
191+ PluginManager::GetInstrumentationRuntimePluginInfo,
192+ PluginManager::SetInstrumentationRuntimePluginEnabled}};
190193
191194 return PluginNamespaces;
192195}
@@ -1546,6 +1549,16 @@ PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx) {
15461549 return GetInstrumentationRuntimeInstances ().GetCallbackAtIndex (idx);
15471550}
15481551
1552+ std::vector<RegisteredPluginInfo>
1553+ PluginManager::GetInstrumentationRuntimePluginInfo () {
1554+ return GetInstrumentationRuntimeInstances ().GetPluginInfoForAllInstances ();
1555+ }
1556+
1557+ bool PluginManager::SetInstrumentationRuntimePluginEnabled (llvm::StringRef name,
1558+ bool enable) {
1559+ return GetInstrumentationRuntimeInstances ().SetInstanceEnabled (name, enable);
1560+ }
1561+
15491562#pragma mark TypeSystem
15501563
15511564struct TypeSystemInstance : public PluginInstance <TypeSystemCreateInstance> {
Original file line number Diff line number Diff line change @@ -47,6 +47,16 @@ plugin enable system-runtime
4747# CHECK: system-runtime
4848# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
4949
50+ # Test plugin enable/disable for instrumentation plugin works.
51+ plugin enable instrumentation-runtime
52+ # CHECK-LABEL: plugin enable instrumentation-runtime
53+ # CHECK: instrumentation-runtime
54+ # CHECK: [+] AddressSanitizer
55+ plugin disable instrumentation-runtime
56+ # CHECK-LABEL: plugin disable instrumentation-runtime
57+ # CHECK: instrumentation-runtime
58+ # CHECK: [-] AddressSanitizer
59+
5060# Test plugin enable/disable for unknown plugin returns an error.
5161# RUN: %lldb -o "plugin enable some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
5262# RUN: %lldb -o "plugin disable some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ plugin list
1212# CHECK-LABEL: plugin list
1313# CHECK: system-runtime
1414# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
15+ # CHECK: instrumentation-runtime
16+ # CHECK: [+] AddressSanitizer AddressSanitizer instrumentation runtime plugin.
1517
1618# Test plugin list works with fully qualified name.
1719plugin list system-runtime.systemruntime-macosx
@@ -29,14 +31,23 @@ plugin list system-runtime
2931plugin list --json
3032# CHECK-LABEL plugin list --json
3133# CHECK: {
34+ # CHECK-DAG: "system-runtime":
35+ # CHECK-DAG: "instrumentation-runtime":
36+ # CHECK: }
37+
38+ # Test json output for plugin list with a namespace
39+ plugin list system-runtime --json
40+ # CHECK-LABEL plugin list --json
41+ # CHECK: {
3242# CHECK: "system-runtime": [
3343# CHECK: {
34- # CHECK-DAG: "enabled": true,
44+ # CHECK-DAG: "enabled": true
3545# CHECK-DAG: "name": "systemruntime-macosx"
3646# CHECK: }
3747# CHECK: ]
3848# CHECK: }
3949
50+
4051# Test plugin list does not match a plugin name by substring.
4152# RUN: %lldb -o "plugin list macosx" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
4253
You can’t perform that action at this time.
0 commit comments