LLDB mainline
PluginManager.cpp
Go to the documentation of this file.
1//===-- PluginManager.cpp -------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
12#include "lldb/Core/Debugger.h"
14#include "lldb/Host/HostInfo.h"
17#include "lldb/Target/Process.h"
19#include "lldb/Utility/Status.h"
21#include "llvm/ADT/StringRef.h"
22#include "llvm/ADT/Twine.h"
23#include "llvm/Support/DynamicLibrary.h"
24#include "llvm/Support/ErrorExtras.h"
25#include "llvm/Support/FileSystem.h"
26#include "llvm/Support/raw_ostream.h"
27#include <cassert>
28#include <memory>
29#include <mutex>
30#include <string>
31#include <utility>
32#if defined(_WIN32)
34#endif
35
36using namespace lldb;
37using namespace lldb_private;
38
40typedef void (*PluginTermCallback)();
41
42struct PluginInfo {
43 PluginInfo() = default;
44
45 PluginInfo(const PluginInfo &) = delete;
46 PluginInfo &operator=(const PluginInfo &) = delete;
47
49 : library(std::move(other.library)),
51 std::exchange(other.plugin_init_callback, nullptr)),
53 std::exchange(other.plugin_term_callback, nullptr)) {}
54
56 library = std::move(other.library);
57 plugin_init_callback = std::exchange(other.plugin_init_callback, nullptr);
58 plugin_term_callback = std::exchange(other.plugin_term_callback, nullptr);
59 return *this;
60 }
61
63 if (!library.isValid())
64 return;
66 return;
68 }
69
70 static llvm::Expected<PluginInfo> Create(const FileSpec &path);
71
72private:
73 llvm::sys::DynamicLibrary library;
76};
77
78typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap;
79
80namespace {
81enum class PluginLifecycle { Uninitialized, Initialized, Terminated };
82
83struct PluginRegistry {
84 std::recursive_mutex mutex;
86
87 void Initialize() {
88 std::lock_guard<std::recursive_mutex> guard(mutex);
89 lifecycle = PluginLifecycle::Initialized;
90 }
91
92 void Terminate() {
93 std::lock_guard<std::recursive_mutex> guard(mutex);
94 lifecycle = PluginLifecycle::Terminated;
95 map.clear();
96 }
97
98 // Only after Terminate() is a leftover PluginInstances registration a bug;
99 // exiting in any other state (e.g. `import lldb`, which never calls
100 // Terminate()) is supported and leaves plugins registered.
101 bool IsTerminated() const { return lifecycle == PluginLifecycle::Terminated; }
102
103private:
104 PluginLifecycle lifecycle = PluginLifecycle::Uninitialized;
105};
106} // namespace
107
108// Never destroyed: at static-destruction time the PluginInstances containers
109// (separate statics, arbitrary teardown order) still call IsTerminated(), and
110// the map's PluginInfo terminate callbacks must not run when the containers
111// they unregister from may already be gone. Terminate() clears the map
112// explicitly while everything is alive. The static pointer keeps it reachable,
113// so this is not a LeakSanitizer leak.
114static PluginRegistry &GetPluginRegistry() {
115 static PluginRegistry *g_registry = new PluginRegistry();
116 return *g_registry;
117}
118
119static std::recursive_mutex &GetPluginMapMutex() {
120 return GetPluginRegistry().mutex;
121}
122
124
125static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
126 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
127 return GetPluginMap().contains(plugin_file_spec);
128}
129
130static void SetPluginInfo(const FileSpec &plugin_file_spec,
131 PluginInfo plugin_info) {
132 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
133 DynamicPluginMap &plugin_map = GetPluginMap();
134 assert(!plugin_map.contains(plugin_file_spec));
135 plugin_map.try_emplace(plugin_file_spec, std::move(plugin_info));
136}
137
138template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
139 return reinterpret_cast<FPtrTy>(VPtr);
140}
141
142static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin";
143struct PluginDir {
145 /// Try to load anything that looks like a shared library.
147
148 /// Only load shared libraries who's filename start with g_plugin_prefix.
150 };
151
154
155 explicit operator bool() const { return FileSystem::Instance().Exists(path); }
156
157 /// The path to the plugin directory.
159
160 /// Filter when looking for plugins.
162};
163
164llvm::Expected<PluginInfo> PluginInfo::Create(const FileSpec &path) {
165 PluginInfo plugin_info;
166 std::string error;
167 plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
168 path.GetPath().c_str(), &error);
169 if (!plugin_info.library.isValid())
170 return llvm::createStringError(error);
171
172 // Look for files that follow the convention <g_plugin_prefix><name>.<ext>, in
173 // which case we need to call lldb_initialize_<name> and
174 // lldb_terminate_<name>.
175 llvm::StringRef file_name = path.GetFileNameStrippingExtension();
176 if (file_name.starts_with(g_plugin_prefix)) {
177 llvm::StringRef plugin_name = file_name.substr(g_plugin_prefix.size());
178 std::string init_symbol =
179 llvm::Twine("lldb_initialize_" + plugin_name).str();
180
181 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
182 plugin_info.library.getAddressOfSymbol(init_symbol.c_str()))) {
183 if (!init_fn())
184 return llvm::createStringErrorV("initializer '{0}' returned false",
185 init_symbol);
186 const std::string term_symbol =
187 llvm::Twine("lldb_terminate_" + plugin_name).str();
189 plugin_info.library.getAddressOfSymbol(term_symbol.c_str()));
190 }
191 return plugin_info;
192 }
193
194 // Look for the legacy LLDBPluginInitialize/LLDBPluginTerminate symbols.
195 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
196 plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"))) {
197 if (!init_fn())
198 return llvm::createStringError(
199 "initializer 'LLDBPluginInitialize' returned false");
200
201 plugin_info.plugin_init_callback = init_fn;
203 plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
204 return plugin_info;
205 }
206
207 return llvm::createStringError("no initialize symbol found");
208}
209
211LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
212 llvm::StringRef path) {
213 namespace fs = llvm::sys::fs;
214
215 static constexpr std::array<llvm::StringLiteral, 3>
216 g_shared_library_extension = {".dylib", ".so", ".dll"};
217
218 // If we have a regular file, a symbolic link or unknown file type, try and
219 // process the file. We must handle unknown as sometimes the directory
220 // enumeration might be enumerating a file system that doesn't have correct
221 // file type information.
222 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
223 ft == fs::file_type::type_unknown) {
224 FileSpec plugin_file_spec(path);
225 FileSystem::Instance().Resolve(plugin_file_spec);
226
227 // Don't try to load unknown extensions.
228 if (!llvm::is_contained(g_shared_library_extension,
229 plugin_file_spec.GetFileNameExtension()))
231
232 // Don't try to load libraries that don't start with g_plugin_prefix if so
233 // requested.
235 if (*policy == PluginDir::LoadOnlyWithLLDBPrefix &&
236 !plugin_file_spec.GetFilename().starts_with(g_plugin_prefix))
238
239 // Don't try to load an already loaded plugin again.
240 if (PluginIsLoaded(plugin_file_spec))
242
243 llvm::Expected<PluginInfo> plugin_info =
244 PluginInfo::Create(plugin_file_spec);
245 if (plugin_info) {
246 SetPluginInfo(plugin_file_spec, std::move(*plugin_info));
247 } else {
248 // Cache an empty plugin info so we don't try to load it again and again.
249 SetPluginInfo(plugin_file_spec, PluginInfo());
250
251 LLDB_LOG_ERROR(GetLog(LLDBLog::Host), plugin_info.takeError(),
252 "could not load plugin: {0}");
253 }
254
256 }
257
258 if (ft == fs::file_type::directory_file ||
259 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
260 // Try and recurse into anything that a directory or symbolic link. We must
261 // also do this for unknown as sometimes the directory enumeration might be
262 // enumerating a file system that doesn't have correct file type
263 // information.
265 }
266
268}
269
271 GetPluginRegistry().Initialize();
272
273 static const bool find_directories = true;
274 static const bool find_files = true;
275 static const bool find_other = true;
276
277 // Directories to scan for plugins. Unlike the plugin directories, which are
278 // meant exclusively for LLDB, the shared library directory is likely to
279 // contain unrelated shared libraries that we do not want to load. Therefore,
280 // limit the scan to libraries that start with g_plugin_prefix.
281 const std::array<PluginDir, 3> plugin_dirs = {
282 PluginDir(HostInfo::GetShlibDir(), PluginDir::LoadOnlyWithLLDBPrefix),
283 PluginDir(HostInfo::GetSystemPluginDir(), PluginDir::LoadAnyDylib),
284 PluginDir(HostInfo::GetUserPluginDir(), PluginDir::LoadAnyDylib)};
285
286 for (const PluginDir &plugin_dir : plugin_dirs) {
287 if (plugin_dir) {
289 plugin_dir.path.GetPath().c_str(), find_directories, find_files,
290 find_other, LoadPluginCallback, (void *)&plugin_dir.policy);
291 }
292 }
293}
294
296
297llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
298 static PluginNamespace PluginNamespaces[] = {
299
300 {
301 "abi",
304 },
305
306 {
307 "architecture",
310 },
311
312 {
313 "bug-reporter",
316 },
317
318 {
319 "disassembler",
322 },
323
324 {
325 "dynamic-loader",
328 },
329
330 {
331 "emulate-instruction",
334 },
335
336 {
337 "instrumentation-runtime",
340 },
341
342 {
343 "jit-loader",
346 },
347
348 {
349 "language",
352 },
353
354 {
355 "language-runtime",
358 },
359
360 {
361 "memory-history",
364 },
365
366 {
367 "object-container",
370 },
371
372 {
373 "object-file",
376 },
377
378 {
379 "operating-system",
382 },
383
384 {
385 "platform",
388 },
389
390 {
391 "process",
394 },
395
396 {
397 "repl",
400 },
401
402 {
403 "register-type-builder",
406 },
407
408 {
409 "script-interpreter",
412 },
413
414 {
415 "scripted-interface",
418 },
419
420 {
421 "structured-data",
424 },
425
426 {
427 "symbol-file",
430 },
431
432 {
433 "symbol-locator",
436 },
437
438 {
439 "symbol-vendor",
442 },
443
444 {
445 "system-runtime",
448 },
449
450 {
451 "trace",
454 },
455
456 {
457 "trace-exporter",
460 },
461
462 {
463 "type-system",
466 },
467
468 {
469 "unwind-assembly",
472 },
473 };
474
475 return PluginNamespaces;
476}
477
478llvm::json::Object PluginManager::GetJSON(llvm::StringRef pattern) {
479 llvm::json::Object plugin_stats;
480
481 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
482 llvm::json::Array namespace_stats;
483
484 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
485 if (MatchPluginName(pattern, plugin_ns, plugin)) {
486 llvm::json::Object plugin_json;
487 plugin_json.try_emplace("name", plugin.name);
488 plugin_json.try_emplace("enabled", plugin.enabled);
489 namespace_stats.emplace_back(std::move(plugin_json));
490 }
491 }
492 if (!namespace_stats.empty())
493 plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
494 }
495
496 return plugin_stats;
497}
498
499bool PluginManager::MatchPluginName(llvm::StringRef pattern,
500 const PluginNamespace &plugin_ns,
501 const RegisteredPluginInfo &plugin_info) {
502 // The empty pattern matches all plugins.
503 if (pattern.empty())
504 return true;
505
506 // Check if the pattern matches the namespace.
507 if (pattern == plugin_ns.name)
508 return true;
509
510 // Check if the pattern matches the qualified name.
511 std::string qualified_name = (plugin_ns.name + "." + plugin_info.name).str();
512 return pattern == qualified_name;
513}
514
515template <typename Callback> struct PluginInstance {
516 typedef Callback CallbackType;
517
518 PluginInstance() = default;
525
526 llvm::StringRef name;
527 llvm::StringRef description;
531};
532
533template <typename Instance> class PluginInstances {
534public:
536 // Only meaningful after a real teardown; see PluginRegistry::IsTerminated.
537 if (!GetPluginRegistry().IsTerminated())
538 return;
539#ifndef NDEBUG
540 for (const auto &instance : m_instances)
541 llvm::errs() << llvm::formatv("Use `image lookup -va {0:x}` to find out "
542 "which callback was not removed\n",
543 instance.create_callback);
544#endif
545 assert(m_instances.empty() && "forgot to unregister plugin?");
546 }
547
548 template <typename... Args>
549 bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
550 typename Instance::CallbackType callback,
551 Args &&...args) {
552 if (!callback)
553 return false;
554 assert(!name.empty());
555
556 std::lock_guard<std::mutex> guard(m_mutex);
557 m_instances.emplace_back(name, description, callback,
558 std::forward<Args>(args)...);
559 return true;
560 }
561
562 bool UnregisterPlugin(typename Instance::CallbackType callback) {
563 if (!callback)
564 return false;
565
566 std::lock_guard<std::mutex> guard(m_mutex);
567 auto pos = m_instances.begin();
568 auto end = m_instances.end();
569 for (; pos != end; ++pos) {
570 if (pos->create_callback == callback) {
571 m_instances.erase(pos);
572 return true;
573 }
574 }
575 return false;
576 }
577
578 llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
579 if (auto instance = GetInstanceAtIndex(idx))
580 return instance->description;
581 return "";
582 }
583
584 llvm::StringRef GetNameAtIndex(uint32_t idx) {
585 if (auto instance = GetInstanceAtIndex(idx))
586 return instance->name;
587 return "";
588 }
589
590 typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
591 if (auto instance = GetInstanceForName(name))
592 return instance->create_callback;
593 return nullptr;
594 }
595
596 llvm::SmallVector<typename Instance::CallbackType> GetCreateCallbacks() {
597 llvm::SmallVector<Instance> snapshot = GetSnapshot();
598 llvm::SmallVector<typename Instance::CallbackType> result;
599 result.reserve(snapshot.size());
600 for (const auto &instance : snapshot)
601 result.push_back(instance.create_callback);
602 return result;
603 }
604
606 for (const auto &instance : GetSnapshot()) {
607 if (instance.debugger_init_callback)
608 instance.debugger_init_callback(debugger);
609 }
610 }
611
612 // Return a copy of all the enabled instances.
613 // Note that this is a copy of the internal state so modifications
614 // to the returned instances will not be reflected back to instances
615 // stored by the PluginInstances object.
616 llvm::SmallVector<Instance> GetSnapshot(bool enabled_only = true) const {
617 std::lock_guard<std::mutex> guard(m_mutex);
618
619 llvm::SmallVector<Instance> enabled_instances;
620 enabled_instances.reserve(m_instances.size());
621 for (const auto &instance : m_instances) {
622 if (!enabled_only || instance.enabled)
623 enabled_instances.push_back(instance);
624 }
625 return enabled_instances;
626 }
627
628 std::optional<Instance> GetInstanceAtIndex(uint32_t idx) {
629 uint32_t count = 0;
630
631 return FindEnabledInstance(
632 [&](const Instance &instance) { return count++ == idx; });
633 }
634
635 std::optional<Instance> GetInstanceForName(llvm::StringRef name,
636 bool enabled_only = true) {
637 if (name.empty())
638 return std::nullopt;
639
640 auto predicate = [&](const Instance &instance) {
641 return instance.name == name;
642 };
643 if (enabled_only)
644 return FindEnabledInstance(predicate);
645
646 return FindInstance(predicate);
647 }
648
649 std::optional<Instance>
650 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
651 for (const auto &instance : GetSnapshot()) {
652 if (predicate(instance))
653 return instance;
654 }
655 return std::nullopt;
656 }
657
658 std::optional<Instance>
659 FindInstance(std::function<bool(const Instance &)> predicate) const {
660 std::lock_guard<std::mutex> guard(m_mutex);
661 for (const auto &instance : m_instances) {
662 if (predicate(instance))
663 return instance;
664 }
665 return std::nullopt;
666 }
667
668 // Return a list of all the registered plugin instances. This includes both
669 // enabled and disabled instances. The instances are listed in the order they
670 // were registered which is the order they would be queried if they were all
671 // enabled.
672 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
673 std::lock_guard<std::mutex> guard(m_mutex);
674
675 // Lookup the plugin info for each instance in the sorted order.
676 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
677 plugin_infos.reserve(m_instances.size());
678
679 for (const Instance &instance : m_instances)
680 plugin_infos.push_back(
681 {instance.name, instance.description, instance.enabled});
682
683 return plugin_infos;
684 }
685
686 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
687 std::lock_guard<std::mutex> guard(m_mutex);
688 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
689 return instance.name == name;
690 });
691
692 if (it == m_instances.end())
693 return false;
694
695 it->enabled = enable;
696 return true;
697 }
698
699private:
700 mutable std::mutex m_mutex;
701 llvm::SmallVector<Instance> m_instances;
702};
703
704#pragma mark ABI
705
708
710 static ABIInstances g_instances;
711 return g_instances;
712}
713
714bool PluginManager::RegisterPlugin(llvm::StringRef name,
715 llvm::StringRef description,
716 ABICreateInstance create_callback) {
717 return GetABIInstances().RegisterPlugin(name, description, create_callback);
718}
719
721 return GetABIInstances().UnregisterPlugin(create_callback);
722}
723
724llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
726}
727
728#pragma mark Architecture
729
732
734 static ArchitectureInstances g_instances;
735 return g_instances;
736}
737
738void PluginManager::RegisterPlugin(llvm::StringRef name,
739 llvm::StringRef description,
740 ArchitectureCreateInstance create_callback) {
741 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
742}
743
745 ArchitectureCreateInstance create_callback) {
746 auto &instances = GetArchitectureInstances();
747 instances.UnregisterPlugin(create_callback);
748}
749
750std::unique_ptr<Architecture>
752 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
753 if (auto plugin_up = instances.create_callback(arch))
754 return plugin_up;
755 }
756 return nullptr;
757}
758
759#pragma mark BugReporter
760
763
765 static BugReporterInstances g_instances;
766 return g_instances;
767}
768
769void PluginManager::RegisterPlugin(llvm::StringRef name,
770 llvm::StringRef description,
771 BugReporterCreateInstance create_callback) {
772 GetBugReporterInstances().RegisterPlugin(name, description, create_callback);
773}
774
779
780std::unique_ptr<BugReporter>
782 if (!name.empty()) {
783 if (auto create_callback =
784 GetBugReporterInstances().GetCallbackForName(name))
785 return create_callback();
786 return nullptr;
787 }
788 for (const auto &instance : GetBugReporterInstances().GetSnapshot()) {
789 if (auto plugin_up = instance.create_callback())
790 return plugin_up;
791 }
792 return nullptr;
793}
794
795#pragma mark Disassembler
796
799
801 static DisassemblerInstances g_instances;
802 return g_instances;
803}
804
805bool PluginManager::RegisterPlugin(llvm::StringRef name,
806 llvm::StringRef description,
807 DisassemblerCreateInstance create_callback) {
808 return GetDisassemblerInstances().RegisterPlugin(name, description,
809 create_callback);
810}
811
813 DisassemblerCreateInstance create_callback) {
814 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
815}
816
817llvm::SmallVector<DisassemblerCreateInstance>
821
827
828#pragma mark DynamicLoader
829
832
834 static DynamicLoaderInstances g_instances;
835 return g_instances;
836}
837
839 llvm::StringRef name, llvm::StringRef description,
840 DynamicLoaderCreateInstance create_callback,
841 DebuggerInitializeCallback debugger_init_callback) {
843 name, description, create_callback, debugger_init_callback);
844}
845
847 DynamicLoaderCreateInstance create_callback) {
848 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
849}
850
851llvm::SmallVector<DynamicLoaderCreateInstance>
855
861
862#pragma mark JITLoader
863
866
868 static JITLoaderInstances g_instances;
869 return g_instances;
870}
871
873 llvm::StringRef name, llvm::StringRef description,
874 JITLoaderCreateInstance create_callback,
875 DebuggerInitializeCallback debugger_init_callback) {
877 name, description, create_callback, debugger_init_callback);
878}
879
881 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
882}
883
884llvm::SmallVector<JITLoaderCreateInstance>
888
889#pragma mark EmulateInstruction
890
894
896 static EmulateInstructionInstances g_instances;
897 return g_instances;
898}
899
901 llvm::StringRef name, llvm::StringRef description,
902 EmulateInstructionCreateInstance create_callback) {
903 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
904 create_callback);
905}
906
911
912llvm::SmallVector<EmulateInstructionCreateInstance>
916
922
923#pragma mark OperatingSystem
924
927
929 static OperatingSystemInstances g_instances;
930 return g_instances;
931}
932
934 llvm::StringRef name, llvm::StringRef description,
935 OperatingSystemCreateInstance create_callback,
936 DebuggerInitializeCallback debugger_init_callback) {
938 name, description, create_callback, debugger_init_callback);
939}
940
945
946llvm::SmallVector<OperatingSystemCreateInstance>
950
956
957#pragma mark Language
958
961
963 static LanguageInstances g_instances;
964 return g_instances;
965}
966
968 llvm::StringRef name, llvm::StringRef description,
969 LanguageCreateInstance create_callback,
970 DebuggerInitializeCallback debugger_init_callback) {
972 name, description, create_callback, debugger_init_callback);
973}
974
976 return GetLanguageInstances().UnregisterPlugin(create_callback);
977}
978
979llvm::SmallVector<LanguageCreateInstance>
983
984#pragma mark LanguageRuntime
985
1002
1004
1006 static LanguageRuntimeInstances g_instances;
1007 return g_instances;
1008}
1009
1011 llvm::StringRef name, llvm::StringRef description,
1012 LanguageRuntimeCreateInstance create_callback,
1013 LanguageRuntimeGetCommandObject command_callback,
1014 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
1016 name, description, create_callback, nullptr, command_callback,
1017 precondition_callback);
1018}
1019
1021 LanguageRuntimeCreateInstance create_callback) {
1022 return GetLanguageRuntimeInstances().UnregisterPlugin(create_callback);
1023}
1024
1025llvm::SmallVector<LanguageRuntimeCallbacks>
1027 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
1028 llvm::SmallVector<LanguageRuntimeCallbacks> result;
1029 result.reserve(instances.size());
1030 for (auto &instance : instances)
1031 result.push_back({instance.create_callback, instance.command_callback,
1032 instance.precondition_callback});
1033 return result;
1034}
1035
1036#pragma mark SystemRuntime
1037
1040
1042 static SystemRuntimeInstances g_instances;
1043 return g_instances;
1044}
1045
1047 llvm::StringRef name, llvm::StringRef description,
1048 SystemRuntimeCreateInstance create_callback) {
1049 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
1050 create_callback);
1051}
1052
1054 SystemRuntimeCreateInstance create_callback) {
1055 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
1056}
1057
1058llvm::SmallVector<SystemRuntimeCreateInstance>
1062
1063#pragma mark ObjectFile
1064
1084
1086 static ObjectFileInstances g_instances;
1087 return g_instances;
1088}
1089
1091 if (name.empty())
1092 return false;
1093
1094 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1095}
1096
1098 llvm::StringRef name, llvm::StringRef description,
1099 ObjectFileCreateInstance create_callback,
1100 ObjectFileCreateMemoryInstance create_memory_callback,
1101 ObjectFileGetModuleSpecifications get_module_specifications,
1102 ObjectFileSaveCore save_core,
1103 DebuggerInitializeCallback debugger_init_callback) {
1105 name, description, create_callback, create_memory_callback,
1106 get_module_specifications, save_core, debugger_init_callback);
1107}
1108
1110 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1111}
1112
1113llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1114 auto instances = GetObjectFileInstances().GetSnapshot();
1115 llvm::SmallVector<ObjectFileCallbacks> result;
1116 result.reserve(instances.size());
1117 for (auto &instance : instances)
1118 result.push_back({instance.create_callback, instance.create_memory_callback,
1119 instance.get_module_specifications, instance.save_core});
1120 return result;
1121}
1122
1125 llvm::StringRef name) {
1126 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1127 return instance->create_memory_callback;
1128 return nullptr;
1129}
1130
1132 Status error;
1133 if (!options.GetOutputFile()) {
1134 error = Status::FromErrorString("No output file specified");
1135 return error;
1136 }
1137
1138 if (!options.GetProcess()) {
1139 error = Status::FromErrorString("Invalid process");
1140 return error;
1141 }
1142
1143 error = options.EnsureValidConfiguration();
1144 if (error.Fail())
1145 return error;
1146
1147 if (!options.GetPluginName().has_value()) {
1148 // Try saving core directly from the process plugin first.
1149 llvm::Expected<bool> ret =
1150 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1151 if (!ret)
1152 return Status::FromError(ret.takeError());
1153 if (ret.get())
1154 return Status();
1155 }
1156
1157 // Fall back to object plugins.
1158 const auto &plugin_name = options.GetPluginName().value_or("");
1159 auto instances = GetObjectFileInstances().GetSnapshot();
1160 for (auto &instance : instances) {
1161 if (plugin_name.empty() || instance.name == plugin_name) {
1162 // TODO: Refactor the instance.save_core() to not require a process and
1163 // get it from options instead.
1164 if (instance.save_core &&
1165 instance.save_core(options.GetProcess(), options, error))
1166 return error;
1167 }
1168 }
1169
1170 // Check to see if any of the object file plugins tried and failed to save.
1171 // if any failure, return the error message.
1172 if (error.Fail())
1173 return error;
1174
1175 // Report only for the plugin that was specified.
1176 if (!plugin_name.empty())
1178 "The \"{}\" plugin is not able to save a core for this process.",
1179 plugin_name);
1180
1182 "no ObjectFile plugins were able to save a core for this process");
1183}
1184
1185llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1186 llvm::SmallVector<llvm::StringRef> plugin_names;
1187 auto instances = GetObjectFileInstances().GetSnapshot();
1188 for (auto &instance : instances) {
1189 if (instance.save_core)
1190 plugin_names.emplace_back(instance.name);
1191 }
1192 return plugin_names;
1193}
1194
1195#pragma mark ObjectContainer
1196
1213
1215 static ObjectContainerInstances g_instances;
1216 return g_instances;
1217}
1218
1220 llvm::StringRef name, llvm::StringRef description,
1221 ObjectContainerCreateInstance create_callback,
1222 ObjectFileGetModuleSpecifications get_module_specifications,
1223 ObjectContainerCreateMemoryInstance create_memory_callback) {
1225 name, description, create_callback, create_memory_callback,
1226 get_module_specifications);
1227}
1228
1230 ObjectContainerCreateInstance create_callback) {
1231 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1232}
1233
1234llvm::SmallVector<ObjectContainerCallbacks>
1236 auto instances = GetObjectContainerInstances().GetSnapshot();
1237 llvm::SmallVector<ObjectContainerCallbacks> result;
1238 result.reserve(instances.size());
1239 for (auto &instance : instances)
1240 result.push_back({instance.create_callback, instance.create_memory_callback,
1241 instance.get_module_specifications});
1242 return result;
1243}
1244
1245#pragma mark Platform
1246
1249
1251 static PlatformInstances g_platform_instances;
1252 return g_platform_instances;
1253}
1254
1256 llvm::StringRef name, llvm::StringRef description,
1257 PlatformCreateInstance create_callback,
1258 DebuggerInitializeCallback debugger_init_callback) {
1260 name, description, create_callback, debugger_init_callback);
1261}
1262
1264 return GetPlatformInstances().UnregisterPlugin(create_callback);
1265}
1266
1267llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1269}
1270
1271llvm::StringRef
1275
1280
1281llvm::SmallVector<PlatformCreateInstance>
1285
1287 CompletionRequest &request) {
1288 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1289 if (instance.name.starts_with(name))
1290 request.AddCompletion(instance.name);
1291 }
1292}
1293
1294#pragma mark Process
1295
1298
1300 static ProcessInstances g_instances;
1301 return g_instances;
1302}
1303
1305 llvm::StringRef name, llvm::StringRef description,
1306 ProcessCreateInstance create_callback,
1307 DebuggerInitializeCallback debugger_init_callback) {
1309 name, description, create_callback, debugger_init_callback);
1310}
1311
1313 return GetProcessInstances().UnregisterPlugin(create_callback);
1314}
1315
1316llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1317 return GetProcessInstances().GetNameAtIndex(idx);
1318}
1319
1320llvm::StringRef
1324
1329
1330llvm::SmallVector<ProcessCreateInstance>
1334
1336 CompletionRequest &request) {
1337 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1338 if (instance.name.starts_with(name))
1339 request.AddCompletion(instance.name, instance.description);
1340 }
1341}
1342
1343#pragma mark ProtocolServer
1344
1347
1349 static ProtocolServerInstances g_instances;
1350 return g_instances;
1351}
1352
1354 llvm::StringRef name, llvm::StringRef description,
1355 ProtocolServerCreateInstance create_callback) {
1356 return GetProtocolServerInstances().RegisterPlugin(name, description,
1357 create_callback);
1358}
1359
1361 ProtocolServerCreateInstance create_callback) {
1362 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1363}
1364
1365llvm::StringRef
1369
1374
1375#pragma mark RegisterTypeBuilder
1376
1378 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1383};
1384
1385typedef PluginInstances<RegisterTypeBuilderInstance>
1387
1389 static RegisterTypeBuilderInstances g_instances;
1390 return g_instances;
1391}
1392
1394 llvm::StringRef name, llvm::StringRef description,
1395 RegisterTypeBuilderCreateInstance create_callback) {
1396 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1397 create_callback);
1398}
1399
1404
1407 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1408 // type and is always present.
1410 assert(instance);
1411 return instance->create_callback(target);
1412}
1413
1414#pragma mark ScriptInterpreter
1415
1429
1431
1433 static ScriptInterpreterInstances g_instances;
1434 return g_instances;
1435}
1436
1438 llvm::StringRef name, llvm::StringRef description,
1439 lldb::ScriptLanguage script_language,
1440 ScriptInterpreterCreateInstance create_callback,
1441 ScriptInterpreterGetPath get_path_callback) {
1443 name, description, create_callback, script_language, get_path_callback);
1444}
1445
1450
1451llvm::SmallVector<ScriptInterpreterCreateInstance>
1455
1458 Debugger &debugger) {
1459 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1460 ScriptInterpreterCreateInstance none_instance = nullptr;
1461 for (const auto &instance : instances) {
1462 if (instance.language == lldb::eScriptLanguageNone)
1463 none_instance = instance.create_callback;
1464
1465 if (script_lang == instance.language)
1466 return instance.create_callback(debugger);
1467 }
1468
1469 // If we didn't find one, return the ScriptInterpreter for the null language.
1470 assert(none_instance != nullptr);
1471 return none_instance(debugger);
1472}
1473
1475 lldb::ScriptLanguage script_lang) {
1476 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1477 for (const auto &instance : instances) {
1478 if (instance.language == script_lang && instance.get_path_callback)
1479 return instance.get_path_callback();
1480 }
1481 return FileSpec();
1482}
1483
1484#pragma mark SyntheticFrameProvider
1485
1494
1496 static SyntheticFrameProviderInstances g_instances;
1497 return g_instances;
1498}
1499
1501 static ScriptedFrameProviderInstances g_instances;
1502 return g_instances;
1503}
1504
1506 llvm::StringRef name, llvm::StringRef description,
1507 SyntheticFrameProviderCreateInstance create_native_callback,
1508 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1509 if (create_native_callback)
1511 name, description, create_native_callback);
1512 else if (create_scripted_callback)
1514 name, description, create_scripted_callback);
1515 return false;
1516}
1517
1522
1527
1533
1534llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1538
1539#pragma mark StructuredDataPlugin
1540
1554
1557
1559 static StructuredDataPluginInstances g_instances;
1560 return g_instances;
1561}
1562
1564 llvm::StringRef name, llvm::StringRef description,
1565 StructuredDataPluginCreateInstance create_callback,
1566 DebuggerInitializeCallback debugger_init_callback,
1567 StructuredDataFilterLaunchInfo filter_callback) {
1569 name, description, create_callback, debugger_init_callback,
1570 filter_callback);
1571}
1572
1577
1578llvm::SmallVector<StructuredDataPluginCallbacks>
1580 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1581 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1582 result.reserve(instances.size());
1583 for (auto &instance : instances)
1584 result.push_back({instance.create_callback, instance.filter_callback});
1585 return result;
1586}
1587
1588#pragma mark SymbolFile
1589
1592
1594 static SymbolFileInstances g_instances;
1595 return g_instances;
1596}
1597
1599 llvm::StringRef name, llvm::StringRef description,
1600 SymbolFileCreateInstance create_callback,
1601 DebuggerInitializeCallback debugger_init_callback) {
1603 name, description, create_callback, debugger_init_callback);
1604}
1605
1607 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1608}
1609
1610llvm::SmallVector<SymbolFileCreateInstance>
1614
1615#pragma mark SymbolVendor
1616
1619
1621 static SymbolVendorInstances g_instances;
1622 return g_instances;
1623}
1624
1625bool PluginManager::RegisterPlugin(llvm::StringRef name,
1626 llvm::StringRef description,
1627 SymbolVendorCreateInstance create_callback) {
1628 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1629 create_callback);
1630}
1631
1633 SymbolVendorCreateInstance create_callback) {
1634 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1635}
1636
1637llvm::SmallVector<SymbolVendorCreateInstance>
1641
1642#pragma mark SymbolLocator
1643
1667
1669 static SymbolLocatorInstances g_instances;
1670 return g_instances;
1671}
1672
1674 llvm::StringRef name, llvm::StringRef description,
1675 SymbolLocatorCreateInstance create_callback,
1676 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1677 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1678 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1679 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1680 DebuggerInitializeCallback debugger_init_callback) {
1682 name, description, create_callback, locate_executable_object_file,
1683 locate_executable_symbol_file, download_object_symbol_file,
1684 find_symbol_file_in_bundle, debugger_init_callback);
1685}
1686
1688 SymbolLocatorCreateInstance create_callback) {
1689 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1690}
1691
1692llvm::SmallVector<SymbolLocatorCreateInstance>
1696
1699 StatisticsMap &map) {
1700 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1701 for (auto &instance : instances) {
1702 if (instance.locate_executable_object_file) {
1703 StatsDuration time;
1704 std::optional<ModuleSpec> result;
1705 {
1706 ElapsedTime elapsed(time);
1707 result = instance.locate_executable_object_file(module_spec);
1708 }
1709 map.add(instance.name, time.get().count());
1710 if (result)
1711 return *result;
1712 }
1713 }
1714 return {};
1715}
1716
1718 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1719 StatisticsMap &map) {
1720 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1721 for (auto &instance : instances) {
1722 if (instance.locate_executable_symbol_file) {
1723 StatsDuration time;
1724 std::optional<FileSpec> result;
1725 {
1726 ElapsedTime elapsed(time);
1727 result = instance.locate_executable_symbol_file(module_spec,
1728 default_search_paths);
1729 }
1730 map.add(instance.name, time.get().count());
1731 if (result)
1732 return *result;
1733 }
1734 }
1735 return {};
1736}
1737
1739 Status &error,
1740 bool force_lookup,
1741 bool copy_executable) {
1742 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1743 for (auto &instance : instances) {
1744 if (instance.download_object_symbol_file) {
1745 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1746 copy_executable))
1747 return true;
1748 }
1749 }
1750 return false;
1751}
1752
1754 const UUID *uuid,
1755 const ArchSpec *arch) {
1756 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1757 for (auto &instance : instances) {
1758 if (instance.find_symbol_file_in_bundle) {
1759 std::optional<FileSpec> result =
1760 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1761 if (result)
1762 return *result;
1763 }
1764 }
1765 return {};
1766}
1767
1768#pragma mark Trace
1769
1785
1787
1789 static TraceInstances g_instances;
1790 return g_instances;
1791}
1792
1794 llvm::StringRef name, llvm::StringRef description,
1795 TraceCreateInstanceFromBundle create_callback_from_bundle,
1796 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1797 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1799 name, description, create_callback_from_bundle,
1800 create_callback_for_live_process, schema, debugger_init_callback);
1801}
1802
1804 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1806 create_callback_from_bundle);
1807}
1808
1810PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1811 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1812}
1813
1816 llvm::StringRef plugin_name) {
1817 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1818 return instance->create_callback_for_live_process;
1819
1820 return nullptr;
1821}
1822
1823llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1824 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1825 return instance->schema;
1826 return llvm::StringRef();
1827}
1828
1829llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1830 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1831 return instance->schema;
1832 return llvm::StringRef();
1833}
1834
1835#pragma mark TraceExporter
1836
1850
1852
1854 static TraceExporterInstances g_instances;
1855 return g_instances;
1856}
1857
1859 llvm::StringRef name, llvm::StringRef description,
1860 TraceExporterCreateInstance create_callback,
1861 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1863 name, description, create_callback, create_thread_trace_export_command);
1864}
1865
1868 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1869}
1870
1872 TraceExporterCreateInstance create_callback) {
1873 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1874}
1875
1876llvm::SmallVector<TraceExporterCallbacks>
1878 auto instances = GetTraceExporterInstances().GetSnapshot();
1879 llvm::SmallVector<TraceExporterCallbacks> result;
1880 result.reserve(instances.size());
1881 for (auto &instance : instances)
1882 result.push_back({instance.name, instance.create_callback,
1883 instance.create_thread_trace_export_command});
1884 return result;
1885}
1886
1887#pragma mark UnwindAssembly
1888
1891
1893 static UnwindAssemblyInstances g_instances;
1894 return g_instances;
1895}
1896
1898 llvm::StringRef name, llvm::StringRef description,
1899 UnwindAssemblyCreateInstance create_callback) {
1900 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1901 create_callback);
1902}
1903
1905 UnwindAssemblyCreateInstance create_callback) {
1906 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1907}
1908
1909llvm::SmallVector<UnwindAssemblyCreateInstance>
1913
1914#pragma mark MemoryHistory
1915
1918
1920 static MemoryHistoryInstances g_instances;
1921 return g_instances;
1922}
1923
1925 llvm::StringRef name, llvm::StringRef description,
1926 MemoryHistoryCreateInstance create_callback) {
1927 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1928 create_callback);
1929}
1930
1932 MemoryHistoryCreateInstance create_callback) {
1933 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1934}
1935
1936llvm::SmallVector<MemoryHistoryCreateInstance>
1940
1941#pragma mark InstrumentationRuntime
1942
1955
1957 : public PluginInstances<InstrumentationRuntimeInstance> {
1958
1960 bool enabled_only) {
1961 if (auto instance = GetInstanceForName(name, enabled_only))
1962 return instance->get_type_callback;
1963 return nullptr;
1964 }
1965};
1966
1968 static InstrumentationRuntimeInstances g_instances;
1969 return g_instances;
1970}
1971
1973 llvm::StringRef name, llvm::StringRef description,
1975 InstrumentationRuntimeGetType get_type_callback) {
1977 name, description, create_callback, get_type_callback);
1978}
1979
1984
1985llvm::SmallVector<InstrumentationRuntimeCallbacks>
1987 auto instances =
1989 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1990 result.reserve(instances.size());
1991 for (auto &instance : instances)
1992 result.push_back({instance.create_callback, instance.get_type_callback});
1993 return result;
1994}
1995
1996#pragma mark TypeSystem
1997
2012
2014
2016 static TypeSystemInstances g_instances;
2017 return g_instances;
2018}
2019
2021 llvm::StringRef name, llvm::StringRef description,
2022 TypeSystemCreateInstance create_callback,
2023 LanguageSet supported_languages_for_types,
2024 LanguageSet supported_languages_for_expressions) {
2026 name, description, create_callback, supported_languages_for_types,
2027 supported_languages_for_expressions);
2028}
2029
2031 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
2032}
2033
2034llvm::SmallVector<TypeSystemCreateInstance>
2038
2040 const auto instances = GetTypeSystemInstances().GetSnapshot();
2041 LanguageSet all;
2042 for (unsigned i = 0; i < instances.size(); ++i)
2043 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
2044 return all;
2045}
2046
2048 const auto instances = GetTypeSystemInstances().GetSnapshot();
2049 LanguageSet all;
2050 for (unsigned i = 0; i < instances.size(); ++i)
2051 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
2052 return all;
2053}
2054
2055#pragma mark ScriptedInterfaces
2056
2070
2072
2074 static ScriptedInterfaceInstances g_instances;
2075 return g_instances;
2076}
2077
2079 llvm::StringRef name, llvm::StringRef description,
2080 ScriptedInterfaceCreateInstance create_callback,
2083 name, description, create_callback, language, usages);
2084}
2085
2090
2094
2095llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2097}
2098
2099llvm::StringRef
2103
2106 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2107 return instance->language;
2109}
2110
2113 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2114 return instance->usages;
2115 return {};
2116}
2117
2118#pragma mark REPL
2119
2128
2130
2132 static REPLInstances g_instances;
2133 return g_instances;
2134}
2135
2136bool PluginManager::RegisterPlugin(llvm::StringRef name,
2137 llvm::StringRef description,
2138 REPLCreateInstance create_callback,
2139 LanguageSet supported_languages) {
2140 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2141 supported_languages);
2142}
2143
2145 return GetREPLInstances().UnregisterPlugin(create_callback);
2146}
2147
2148llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2149 auto instances = GetREPLInstances().GetSnapshot();
2150 llvm::SmallVector<REPLCallbacks> result;
2151 result.reserve(instances.size());
2152 for (auto &instance : instances)
2153 result.push_back({instance.create_callback, instance.supported_languages});
2154 return result;
2155}
2156
2158 const auto instances = GetREPLInstances().GetSnapshot();
2159 LanguageSet all;
2160 for (unsigned i = 0; i < instances.size(); ++i)
2161 all.bitvector |= instances[i].supported_languages.bitvector;
2162 return all;
2163}
2164
2165#pragma mark Highlighter
2166
2167struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2172};
2173
2175
2177 static HighlighterInstances g_instances;
2178 return g_instances;
2179}
2180
2181bool PluginManager::RegisterPlugin(llvm::StringRef name,
2182 llvm::StringRef description,
2183 HighlighterCreateInstance create_callback) {
2184 return GetHighlighterInstances().RegisterPlugin(name, description,
2185 create_callback);
2186}
2187
2189 HighlighterCreateInstance create_callback) {
2190 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2191}
2192
2193llvm::SmallVector<HighlighterCreateInstance>
2197
2198#pragma mark PluginManager
2199
2214
2215// This is the preferred new way to register plugin specific settings. e.g.
2216// This will put a plugin's settings under e.g.
2217// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2219 Debugger &debugger, llvm::StringRef plugin_type_name,
2220 llvm::StringRef plugin_type_desc, bool can_create) {
2221 lldb::OptionValuePropertiesSP parent_properties_sp(
2222 debugger.GetValueProperties());
2223 if (parent_properties_sp) {
2224 static constexpr llvm::StringLiteral g_property_name("plugin");
2225
2226 OptionValuePropertiesSP plugin_properties_sp =
2227 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2228 if (!plugin_properties_sp && can_create) {
2229 plugin_properties_sp =
2230 std::make_shared<OptionValueProperties>(g_property_name);
2231 plugin_properties_sp->SetExpectedPath("plugin");
2232 parent_properties_sp->AppendProperty(g_property_name,
2233 "Settings specify to plugins.", true,
2234 plugin_properties_sp);
2235 }
2236
2237 if (plugin_properties_sp) {
2238 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2239 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2240 if (!plugin_type_properties_sp && can_create) {
2241 plugin_type_properties_sp =
2242 std::make_shared<OptionValueProperties>(plugin_type_name);
2243 plugin_type_properties_sp->SetExpectedPath(
2244 ("plugin." + plugin_type_name).str());
2245 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2246 true, plugin_type_properties_sp);
2247 }
2248 return plugin_type_properties_sp;
2249 }
2250 }
2252}
2253
2254// This is deprecated way to register plugin specific settings. e.g.
2255// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2256// generic settings would be under "platform.SETTINGNAME".
2258 Debugger &debugger, llvm::StringRef plugin_type_name,
2259 llvm::StringRef plugin_type_desc, bool can_create) {
2260 static constexpr llvm::StringLiteral g_property_name("plugin");
2261 lldb::OptionValuePropertiesSP parent_properties_sp(
2262 debugger.GetValueProperties());
2263 if (parent_properties_sp) {
2264 OptionValuePropertiesSP plugin_properties_sp =
2265 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2266 if (!plugin_properties_sp && can_create) {
2267 plugin_properties_sp =
2268 std::make_shared<OptionValueProperties>(plugin_type_name);
2269 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2270 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2271 true, plugin_properties_sp);
2272 }
2273
2274 if (plugin_properties_sp) {
2275 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2276 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2277 if (!plugin_type_properties_sp && can_create) {
2278 plugin_type_properties_sp =
2279 std::make_shared<OptionValueProperties>(g_property_name);
2280 plugin_type_properties_sp->SetExpectedPath(
2281 (plugin_type_name + ".plugin").str());
2282 plugin_properties_sp->AppendProperty(g_property_name,
2283 "Settings specific to plugins",
2284 true, plugin_type_properties_sp);
2285 }
2286 return plugin_type_properties_sp;
2287 }
2288 }
2290}
2291
2292namespace {
2293
2295GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2296 bool can_create);
2297}
2298
2300GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2301 llvm::StringRef plugin_type_name,
2302 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2304 lldb::OptionValuePropertiesSP properties_sp;
2305 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2306 debugger, plugin_type_name,
2307 "", // not creating to so we don't need the description
2308 false));
2309 if (plugin_type_properties_sp)
2310 properties_sp =
2311 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2312 return properties_sp;
2313}
2314
2315static bool
2316CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2317 llvm::StringRef plugin_type_desc,
2318 const lldb::OptionValuePropertiesSP &properties_sp,
2319 llvm::StringRef description, bool is_global_property,
2320 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2322 if (properties_sp) {
2323 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2324 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2325 true));
2326 if (plugin_type_properties_sp) {
2327 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2328 description, is_global_property,
2329 properties_sp);
2330 return true;
2331 }
2332 }
2333 return false;
2334}
2335
2336static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2337static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2338static constexpr llvm::StringLiteral kProcessPluginName("process");
2339static constexpr llvm::StringLiteral kTracePluginName("trace");
2340static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2341static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2342static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2343static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2344static constexpr llvm::StringLiteral
2345 kStructuredDataPluginName("structured-data");
2346static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2347
2350 llvm::StringRef setting_name) {
2351 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2352}
2353
2355 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2356 llvm::StringRef description, bool is_global_property) {
2358 "Settings for dynamic loader plug-ins",
2359 properties_sp, description, is_global_property);
2360}
2361
2364 llvm::StringRef setting_name) {
2365 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2367}
2368
2370 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2371 llvm::StringRef description, bool is_global_property) {
2373 "Settings for platform plug-ins", properties_sp,
2374 description, is_global_property,
2376}
2377
2380 llvm::StringRef setting_name) {
2381 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2382}
2383
2385 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2386 llvm::StringRef description, bool is_global_property) {
2388 "Settings for process plug-ins", properties_sp,
2389 description, is_global_property);
2390}
2391
2394 llvm::StringRef setting_name) {
2395 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2396}
2397
2399 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2400 llvm::StringRef description, bool is_global_property) {
2402 "Settings for symbol locator plug-ins",
2403 properties_sp, description, is_global_property);
2404}
2405
2407 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2408 llvm::StringRef description, bool is_global_property) {
2410 "Settings for trace plug-ins", properties_sp,
2411 description, is_global_property);
2412}
2413
2416 llvm::StringRef setting_name) {
2417 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2418}
2419
2421 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2422 llvm::StringRef description, bool is_global_property) {
2424 "Settings for object file plug-ins",
2425 properties_sp, description, is_global_property);
2426}
2427
2430 llvm::StringRef setting_name) {
2431 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2432}
2433
2435 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2436 llvm::StringRef description, bool is_global_property) {
2438 "Settings for symbol file plug-ins",
2439 properties_sp, description, is_global_property);
2440}
2441
2444 llvm::StringRef setting_name) {
2445 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2446}
2447
2449 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2450 llvm::StringRef description, bool is_global_property) {
2452 "Settings for JIT loader plug-ins",
2453 properties_sp, description, is_global_property);
2454}
2455
2456static const char *kOperatingSystemPluginName("os");
2457
2459 Debugger &debugger, llvm::StringRef setting_name) {
2460 lldb::OptionValuePropertiesSP properties_sp;
2461 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2464 "", // not creating to so we don't need the description
2465 false));
2466 if (plugin_type_properties_sp)
2467 properties_sp =
2468 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2469 return properties_sp;
2470}
2471
2473 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2474 llvm::StringRef description, bool is_global_property) {
2475 if (properties_sp) {
2476 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2478 "Settings for operating system plug-ins",
2479 true));
2480 if (plugin_type_properties_sp) {
2481 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2482 description, is_global_property,
2483 properties_sp);
2484 return true;
2485 }
2486 }
2487 return false;
2488}
2489
2492 llvm::StringRef setting_name) {
2493 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2494}
2495
2497 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2498 llvm::StringRef description, bool is_global_property) {
2500 "Settings for structured data plug-ins",
2501 properties_sp, description, is_global_property);
2502}
2503
2506 Debugger &debugger, llvm::StringRef setting_name) {
2507 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2508}
2509
2511 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2512 llvm::StringRef description, bool is_global_property) {
2514 "Settings for CPlusPlus language plug-ins",
2515 properties_sp, description, is_global_property);
2516}
2517
2518//
2519// Plugin Info+Enable Implementations
2520//
2521llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2523}
2524bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2525 return GetABIInstances().SetInstanceEnabled(name, enable);
2526}
2527
2528llvm::SmallVector<RegisteredPluginInfo>
2533 bool enable) {
2534 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2535}
2536
2537llvm::SmallVector<RegisteredPluginInfo>
2542 bool enable) {
2543 return GetBugReporterInstances().SetInstanceEnabled(name, enable);
2544}
2545
2546llvm::SmallVector<RegisteredPluginInfo>
2551 bool enable) {
2552 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2553}
2554
2555llvm::SmallVector<RegisteredPluginInfo>
2560 bool enable) {
2561 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2562}
2563
2564llvm::SmallVector<RegisteredPluginInfo>
2569 bool enable) {
2571}
2572
2573llvm::SmallVector<RegisteredPluginInfo>
2577
2579 switch (kind) {
2581 return "global";
2583 return "debugger";
2585 return "target";
2586 }
2587 llvm_unreachable("unhandled PluginDomainKind");
2588}
2589
2591 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2592 PluginDomainKind domain) {
2593 if (domain != lldb::ePluginDomainKindGlobal)
2594 return llvm::createStringErrorV("{} domain is not supported",
2595 PluginDomainKindToStr(domain));
2596 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2597 return llvm::createStringError("plugin could not be found");
2598
2599 return llvm::Error::success();
2600}
2601
2602llvm::SmallVector<RegisteredPluginInfo>
2607 bool enable) {
2608 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2609}
2610
2611llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2613}
2615 bool enable) {
2616 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2617}
2618
2619llvm::SmallVector<RegisteredPluginInfo>
2624 bool enable) {
2625 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2626}
2627
2628llvm::SmallVector<RegisteredPluginInfo>
2633 bool enable) {
2634 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2635}
2636
2637llvm::SmallVector<RegisteredPluginInfo>
2642 bool enable) {
2643 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2644}
2645
2646llvm::SmallVector<RegisteredPluginInfo>
2651 bool enable) {
2652 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2653}
2654
2655llvm::SmallVector<RegisteredPluginInfo>
2660 bool enable) {
2661 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2662}
2663
2664llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2666}
2668 bool enable) {
2669 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2670}
2671
2672llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2674}
2675bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2676 return GetProcessInstances().SetInstanceEnabled(name, enable);
2677}
2678
2679llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2681}
2682bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2683 return GetREPLInstances().SetInstanceEnabled(name, enable);
2684}
2685
2686llvm::SmallVector<RegisteredPluginInfo>
2691 bool enable) {
2693}
2694
2695llvm::SmallVector<RegisteredPluginInfo>
2700 bool enable) {
2702}
2703
2704llvm::SmallVector<RegisteredPluginInfo>
2709 bool enable) {
2711}
2712
2713llvm::SmallVector<RegisteredPluginInfo>
2718 bool enable) {
2720}
2721
2722llvm::SmallVector<RegisteredPluginInfo>
2727 bool enable) {
2728 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2729}
2730
2731llvm::SmallVector<RegisteredPluginInfo>
2736 bool enable) {
2737 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2738}
2739
2740llvm::SmallVector<RegisteredPluginInfo>
2745 bool enable) {
2746 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2747}
2748
2749llvm::SmallVector<RegisteredPluginInfo>
2754 bool enable) {
2755 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2756}
2757
2758llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2760}
2761bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2762 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2763}
2764
2765llvm::SmallVector<RegisteredPluginInfo>
2770 bool enable) {
2771 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2772}
2773
2774llvm::SmallVector<RegisteredPluginInfo>
2779 bool enable) {
2780 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2781}
2782
2783llvm::SmallVector<RegisteredPluginInfo>
2788 bool enable) {
2789 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2790}
2791
2793 CompletionRequest &request) {
2794 // Split the name into the namespace and the plugin name.
2795 // If there is no dot then the ns_name will be equal to name and
2796 // plugin_prefix will be empty.
2797 llvm::StringRef ns_name, plugin_prefix;
2798 std::tie(ns_name, plugin_prefix) = name.split('.');
2799
2800 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2801 // If the plugin namespace matches exactly then
2802 // add all the plugins in this namespace as completions if the
2803 // plugin names starts with the plugin_prefix. If the plugin_prefix
2804 // is empty then it will match all the plugins (empty string is a
2805 // prefix of everything).
2806 if (plugin_ns.name == ns_name) {
2807 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2808 llvm::SmallString<128> buf;
2809 if (plugin.name.starts_with(plugin_prefix))
2810 request.AddCompletion(
2811 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2812 }
2813 } else if (plugin_ns.name.starts_with(name) &&
2814 !plugin_ns.get_info().empty()) {
2815 // Otherwise check if the namespace is a prefix of the full name.
2816 // Use a partial completion here so that we can either operate on the full
2817 // namespace or tab-complete to the next level.
2818 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2819 }
2820 }
2821}
static llvm::raw_ostream & error(Stream &strm)
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
Definition Debugger.cpp:870
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:406
static BugReporterInstances & GetBugReporterInstances()
static DisassemblerInstances & GetDisassemblerInstances()
PluginInstances< ProtocolServerInstance > ProtocolServerInstances
static TraceInstances & GetTracePluginInstances()
static ObjectContainerInstances & GetObjectContainerInstances()
PluginInstances< JITLoaderInstance > JITLoaderInstances
static MemoryHistoryInstances & GetMemoryHistoryInstances()
PluginInstance< PlatformCreateInstance > PlatformInstance
PluginInstances< HighlighterInstance > HighlighterInstances
static DynamicLoaderInstances & GetDynamicLoaderInstances()
PluginInstances< SymbolFileInstance > SymbolFileInstances
PluginInstances< TypeSystemInstance > TypeSystemInstances
PluginInstance< ABICreateInstance > ABIInstance
static SystemRuntimeInstances & GetSystemRuntimeInstances()
PluginInstances< TraceExporterInstance > TraceExporterInstances
static constexpr llvm::StringLiteral kPlatformPluginName("platform")
static constexpr llvm::StringLiteral g_plugin_prefix
PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
static ABIInstances & GetABIInstances()
static constexpr llvm::StringLiteral kProcessPluginName("process")
PluginInstances< SymbolVendorInstance > SymbolVendorInstances
static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader")
static lldb::OptionValuePropertiesSP GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name, llvm::StringRef plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static ScriptInterpreterInstances & GetScriptInterpreterInstances()
PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
PluginInstances< PlatformInstance > PlatformInstances
PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus")
PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
static TraceExporterInstances & GetTraceExporterInstances()
PluginInstance< LanguageCreateInstance > LanguageInstance
PluginInstances< BugReporterInstance > BugReporterInstances
PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator")
PluginInstances< ObjectFileInstance > ObjectFileInstances
void(* PluginTermCallback)()
static StructuredDataPluginInstances & GetStructuredDataPluginInstances()
static constexpr llvm::StringLiteral kObjectFilePluginName("object-file")
PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
PluginInstances< LanguageInstance > LanguageInstances
PluginInstances< TraceInstance > TraceInstances
PluginInstances< ArchitectureInstance > ArchitectureInstances
PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
static constexpr llvm::StringLiteral kStructuredDataPluginName("structured-data")
PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
static const char * kOperatingSystemPluginName("os")
static SymbolLocatorInstances & GetSymbolLocatorInstances()
PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
static ObjectFileInstances & GetObjectFileInstances()
static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file")
PluginInstances< SymbolLocatorInstance > SymbolLocatorInstances
PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
static EmulateInstructionInstances & GetEmulateInstructionInstances()
PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
static LanguageInstances & GetLanguageInstances()
static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader")
static ScriptedFrameProviderInstances & GetScriptedFrameProviderInstances()
PluginInstances< OperatingSystemInstance > OperatingSystemInstances
static LanguageRuntimeInstances & GetLanguageRuntimeInstances()
PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances()
PluginInstances< ProcessInstance > ProcessInstances
PluginInstances< SyntheticFrameProviderInstance > SyntheticFrameProviderInstances
PluginInstances< REPLInstance > REPLInstances
static ArchitectureInstances & GetArchitectureInstances()
static DynamicPluginMap & GetPluginMap()
PluginInstances< ScriptedFrameProviderInstance > ScriptedFrameProviderInstances
PluginInstance< BugReporterCreateInstance > BugReporterInstance
static PluginRegistry & GetPluginRegistry()
static RegisterTypeBuilderInstances & GetRegisterTypeBuilderInstances()
static std::recursive_mutex & GetPluginMapMutex()
llvm::SmallDenseMap< FileSpec, PluginInfo > DynamicPluginMap
static HighlighterInstances & GetHighlighterInstances()
static TypeSystemInstances & GetTypeSystemInstances()
static PlatformInstances & GetPlatformInstances()
static ScriptedInterfaceInstances & GetScriptedInterfaceInstances()
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
PluginInstances< EmulateInstructionInstance > EmulateInstructionInstances
PluginInstance< SyntheticFrameProviderCreateInstance > SyntheticFrameProviderInstance
static JITLoaderInstances & GetJITLoaderInstances()
PluginInstances< DisassemblerInstance > DisassemblerInstances
PluginInstance< ProcessCreateInstance > ProcessInstance
static UnwindAssemblyInstances & GetUnwindAssemblyInstances()
static void SetPluginInfo(const FileSpec &plugin_file_spec, PluginInfo plugin_info)
PluginInstances< ScriptedInterfaceInstance > ScriptedInterfaceInstances
PluginInstances< UnwindAssemblyInstance > UnwindAssemblyInstances
static SymbolFileInstances & GetSymbolFileInstances()
static bool CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
PluginInstances< ABIInstance > ABIInstances
static FPtrTy CastToFPtr(void *VPtr)
static ProcessInstances & GetProcessInstances()
static bool PluginIsLoaded(const FileSpec &plugin_file_spec)
static OperatingSystemInstances & GetOperatingSystemInstances()
static constexpr llvm::StringLiteral kTracePluginName("trace")
PluginInstance< ScriptedFrameProviderCreateInstance > ScriptedFrameProviderInstance
PluginInstances< ScriptInterpreterInstance > ScriptInterpreterInstances
static SyntheticFrameProviderInstances & GetSyntheticFrameProviderInstances()
bool(* PluginInitCallback)()
PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
static SymbolVendorInstances & GetSymbolVendorInstances()
PluginInstances< ObjectContainerInstance > ObjectContainerInstances
static ProtocolServerInstances & GetProtocolServerInstances()
PluginInstances< RegisterTypeBuilderInstance > RegisterTypeBuilderInstances
static REPLInstances & GetREPLInstances()
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
bool UnregisterPlugin(typename Instance::CallbackType callback)
std::optional< ABIInstance > FindInstance(std::function< bool(const ABIInstance &)> predicate) const
llvm::StringRef GetNameAtIndex(uint32_t idx)
llvm::SmallVector< ABIInstance > m_instances
llvm::StringRef GetDescriptionAtIndex(uint32_t idx)
llvm::SmallVector< typename Instance::CallbackType > GetCreateCallbacks()
std::optional< ABIInstance > GetInstanceAtIndex(uint32_t idx)
llvm::SmallVector< RegisteredPluginInfo > GetPluginInfoForAllInstances()
Instance::CallbackType GetCallbackForName(llvm::StringRef name)
llvm::SmallVector< ABIInstance > GetSnapshot(bool enabled_only=true) const
bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, typename Instance::CallbackType callback, Args &&...args)
void PerformDebuggerCallback(Debugger &debugger)
std::optional< ABIInstance > FindEnabledInstance(std::function< bool(const ABIInstance &)> predicate) const
std::optional< ABIInstance > GetInstanceForName(llvm::StringRef name, bool enabled_only=true)
bool SetInstanceEnabled(llvm::StringRef name, bool enable)
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
A class to manage flag bits.
Definition Debugger.h:100
A class that measures elapsed time in an exception safe way.
Definition Statistics.h:76
A file collection class.
A file utility class.
Definition FileSpec.h:57
llvm::StringRef GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:412
llvm::StringRef GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:249
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:376
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp:408
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultEnter
Recurse into the current entry if it is a directory or symlink, or next if not.
Definition FileSystem.h:185
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
Definition FileSystem.h:182
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool SetArchitecturePluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static bool SetPlatformPluginEnabled(llvm::StringRef name, bool enable)
static bool SetScriptInterpreterPluginEnabled(llvm::StringRef name, bool enable)
static bool MatchPluginName(llvm::StringRef pattern, const PluginNamespace &plugin_ns, const RegisteredPluginInfo &plugin)
static lldb::OptionValuePropertiesSP GetSettingForStructuredDataPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetMemoryHistoryPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetSystemRuntimePluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetTypeSystemPluginInfo()
static bool CreateSettingForJITLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetRegisterTypeBuilderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef PluginDomainKindToStr(lldb::PluginDomainKind kind)
static bool SetTraceExporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetArchitecturePluginInfo()
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< UnwindAssemblyCreateInstance > GetUnwindAssemblyCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForObjectFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetEmulateInstructionPluginInfo()
static void AutoCompletePlatformName(llvm::StringRef partial_name, CompletionRequest &request)
static TraceExporterCreateInstance GetTraceExporterCreateCallback(llvm::StringRef plugin_name)
static bool SetDynamicLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::json::Object GetJSON(llvm::StringRef pattern="")
static bool CreateSettingForObjectFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetScriptedInterfacePluginEnabled(llvm::StringRef name, bool enable)
static bool SetOperatingSystemPluginEnabled(llvm::StringRef name, bool enable)
static lldb::ScriptInterpreterSP GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, Debugger &debugger)
static llvm::SmallVector< ABICreateInstance > GetABICreateCallbacks()
static llvm::SmallVector< InstrumentationRuntimeCallbacks > GetInstrumentationRuntimeCallbacks(bool enabled_only=true)
static void AutoCompleteProcessName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptInterpreterPluginInfo()
static bool SetBugReporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetABIPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguagePluginInfo()
static LanguageSet GetREPLAllTypeSystemSupportedLanguages()
static llvm::SmallVector< OperatingSystemCreateInstance > GetOperatingSystemCreateCallbacks()
static bool CreateSettingForTracePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetDynamicLoaderPluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::Error SetInstrumentationRuntimePluginEnabled(llvm::StringRef name, bool enable, Debugger &requesting_debugger, lldb::PluginDomainKind domain)
static llvm::SmallVector< ProcessCreateInstance > GetProcessCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetObjectContainerPluginInfo()
static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Status &error, bool force_lookup=true, bool copy_executable=true)
static llvm::SmallVector< RegisteredPluginInfo > GetDisassemblerPluginInfo()
static llvm::SmallVector< LanguageRuntimeCallbacks > GetLanguageRuntimeCallbacks()
static llvm::SmallVector< SymbolFileCreateInstance > GetSymbolFileCreateCallbacks()
static bool SetLanguageRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetObjectFilePluginInfo()
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolLocatorPluginInfo()
static llvm::StringRef GetTraceSchema(llvm::StringRef plugin_name)
Get the JSON schema for a trace bundle description file corresponding to the given plugin.
static llvm::SmallVector< SymbolVendorCreateInstance > GetSymbolVendorCreateCallbacks()
static bool SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForCPlusPlusLanguagePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetDisassemblerPluginEnabled(llvm::StringRef name, bool enable)
static bool SetSystemRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetTracePluginInfo()
static llvm::SmallVector< JITLoaderCreateInstance > GetJITLoaderCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetProcessPluginInfo()
static TraceCreateInstanceForLiveProcess GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name)
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static llvm::SmallVector< DisassemblerCreateInstance > GetDisassemblerCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForSymbolLocatorPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetStructuredDataPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ObjectFileCallbacks > GetObjectFileCallbacks()
static uint32_t GetNumScriptedInterfaces()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguageRuntimePluginInfo()
static bool SetObjectContainerPluginEnabled(llvm::StringRef name, bool enable)
static bool CreateSettingForProcessPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetPlatformPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetMemoryHistoryPluginInfo()
static llvm::SmallVector< TypeSystemCreateInstance > GetTypeSystemCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolFilePluginInfo()
static SyntheticFrameProviderCreateInstance GetSyntheticFrameProviderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< SymbolLocatorCreateInstance > GetSymbolLocatorCreateCallbacks()
static llvm::ArrayRef< PluginNamespace > GetPluginNamespaces()
static bool SetTypeSystemPluginEnabled(llvm::StringRef name, bool enable)
static bool SetTracePluginEnabled(llvm::StringRef name, bool enable)
static Status SaveCore(lldb_private::SaveCoreOptions &core_options)
static llvm::SmallVector< RegisteredPluginInfo > GetTraceExporterPluginInfo()
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths, StatisticsMap &map)
static bool SetEmulateInstructionPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForJITLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static DisassemblerCreateInstance GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name)
static bool SetJITLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetInstrumentationRuntimePluginInfo()
static llvm::SmallVector< REPLCallbacks > GetREPLCallbacks()
static bool CreateSettingForSymbolFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static OperatingSystemCreateInstance GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name)
static bool SetSymbolFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ScriptInterpreterCreateInstance > GetScriptInterpreterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetRegisterTypeBuilderPluginInfo()
static EmulateInstructionCreateInstance GetEmulateInstructionCreateCallbackForPluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForStructuredDataPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForCPlusPlusLanguagePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< TraceExporterCallbacks > GetTraceExporterCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolVendorPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetBugReporterPluginInfo()
static DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
static PlatformCreateInstance GetPlatformCreateCallbackForPluginName(llvm::StringRef name)
static bool SetProcessPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< llvm::StringRef > GetSaveCorePluginNames()
static llvm::SmallVector< RegisteredPluginInfo > GetOperatingSystemPluginInfo()
static llvm::SmallVector< ScriptedFrameProviderCreateInstance > GetScriptedFrameProviderCreateCallbacks()
static bool SetABIPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptedInterfacePluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name)
static ProcessCreateInstance GetProcessCreateCallbackForPluginName(llvm::StringRef name)
static void AutoCompletePluginName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProtocolServerPluginNameAtIndex(uint32_t idx)
static bool IsRegisteredObjectFilePluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetLanguagePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetREPLPluginInfo()
static bool SetREPLPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< HighlighterCreateInstance > GetHighlighterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetUnwindAssemblyPluginInfo()
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static bool SetSymbolVendorPluginEnabled(llvm::StringRef name, bool enable)
static TraceCreateInstanceFromBundle GetTraceCreateCallback(llvm::StringRef plugin_name)
static void DebuggerInitialize(Debugger &debugger)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static llvm::SmallVector< ObjectContainerCallbacks > GetObjectContainerCallbacks()
static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
static llvm::SmallVector< StructuredDataPluginCallbacks > GetStructuredDataPluginCallbacks()
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
static llvm::SmallVector< SystemRuntimeCreateInstance > GetSystemRuntimeCreateCallbacks()
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
static llvm::SmallVector< RegisteredPluginInfo > GetStructuredDataPluginInfo()
static bool SetSymbolLocatorPluginEnabled(llvm::StringRef name, bool enable)
static ProtocolServerCreateInstance GetProtocolCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< LanguageCreateInstance > GetLanguageCreateCallbacks()
static std::unique_ptr< BugReporter > CreateBugReporterInstance(llvm::StringRef name={})
static llvm::SmallVector< DynamicLoaderCreateInstance > GetDynamicLoaderCreateCallbacks()
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
static llvm::SmallVector< MemoryHistoryCreateInstance > GetMemoryHistoryCreateCallbacks()
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name)
static bool CreateSettingForSymbolLocatorPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetJITLoaderPluginInfo()
static bool SetObjectFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< PlatformCreateInstance > GetPlatformCreateCallbacks()
lldb::OptionValuePropertiesSP GetValueProperties() const
const std::optional< lldb_private::FileSpec > GetOutputFile() const
std::optional< std::string > GetPluginName() const
lldb::ProcessSP GetProcess() const
A class to count time for plugins.
Definition Statistics.h:94
void add(llvm::StringRef key, double value)
Definition Statistics.h:96
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
Represents UUID's of various sizes.
Definition UUID.h:27
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:339
SymbolVendor *(* SymbolVendorCreateInstance)(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
bool(* ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, lldb_private::SaveCoreOptions &options, Status &error)
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceForLiveProcess)(Process &process)
FileSpec(* ScriptInterpreterGetPath)()
lldb::RegisterTypeBuilderSP(* RegisterTypeBuilderCreateInstance)(Target &target)
lldb::ProtocolServerUP(* ProtocolServerCreateInstance)()
LanguageRuntime *(* LanguageRuntimeCreateInstance)(Process *process, lldb::LanguageType language)
lldb::InstrumentationRuntimeType(* InstrumentationRuntimeGetType)()
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceFromBundle)(const llvm::json::Value &trace_bundle_description, llvm::StringRef session_file_dir, lldb_private::Debugger &debugger)
Trace.
lldb::DisassemblerSP(* DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor, const char *cpu, const char *features)
std::optional< FileSpec >(* SymbolLocatorLocateExecutableSymbolFile)(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
EmulateInstruction *(* EmulateInstructionCreateInstance)(const ArchSpec &arch, InstructionType inst_type)
ObjectContainer *(* ObjectContainerCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
void(* DebuggerInitializeCallback)(Debugger &debugger)
std::unique_ptr< Architecture >(* ArchitectureCreateInstance)(const ArchSpec &arch)
lldb::ScriptInterpreterSP(* ScriptInterpreterCreateInstance)(Debugger &debugger)
lldb::PlatformSP(* PlatformCreateInstance)(bool force, const ArchSpec *arch)
bool(* ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
SystemRuntime *(* SystemRuntimeCreateInstance)(Process *process)
lldb::ProcessSP(* ProcessCreateInstance)(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
UnwindAssembly *(* UnwindAssemblyCreateInstance)(const ArchSpec &arch)
lldb::TypeSystemSP(* TypeSystemCreateInstance)(lldb::LanguageType language, Module *module, Target *target)
lldb::BreakpointPreconditionSP(* LanguageRuntimeGetExceptionPrecondition)(lldb::LanguageType language, bool throw_bp)
ObjectContainer *(* ObjectContainerCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
lldb::MemoryHistorySP(* MemoryHistoryCreateInstance)(const lldb::ProcessSP &process_sp)
ObjectFile *(* ObjectFileCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
SymbolLocator *(* SymbolLocatorCreateInstance)()
std::unique_ptr< BugReporter >(* BugReporterCreateInstance)()
std::optional< ModuleSpec >(* SymbolLocatorLocateExecutableObjectFile)(const ModuleSpec &module_spec)
@ Partial
The current token has been partially completed.
lldb::CommandObjectSP(* LanguageRuntimeGetCommandObject)(CommandInterpreter &interpreter)
DynamicLoader *(* DynamicLoaderCreateInstance)(Process *process, bool force)
lldb::StructuredDataPluginSP(* StructuredDataPluginCreateInstance)(Process &process)
lldb::JITLoaderSP(* JITLoaderCreateInstance)(Process *process, bool force)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* SyntheticFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const std::vector< lldb_private::ThreadSpec > &thread_specs)
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
lldb::REPLSP(* REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
SymbolFile *(* SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp)
llvm::Expected< lldb::TraceExporterUP >(* TraceExporterCreateInstance)()
Highlighter *(* HighlighterCreateInstance)(lldb::LanguageType language)
std::optional< FileSpec >(* SymbolLocatorFindSymbolFileInBundle)(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
bool(* SymbolLocatorDownloadObjectAndSymbolFile)(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
Status(* StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, Target *target)
ObjectFile *(* ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
ModuleSpecList(* ObjectFileGetModuleSpecifications)(const FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t file_offset, lldb::offset_t length)
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* ScriptedFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const lldb_private::ScriptedFrameProviderDescriptor &descriptor)
lldb::CommandObjectSP(* ThreadTraceExportCommandCreator)(CommandInterpreter &interpreter)
lldb::InstrumentationRuntimeSP(* InstrumentationRuntimeCreateInstance)(const lldb::ProcessSP &process_sp)
ScriptLanguage
Script interpreter types.
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
@ ePluginDomainKindTarget
@ ePluginDomainKindGlobal
@ ePluginDomainKindDebugger
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
HighlighterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
InstrumentationRuntimeGetType get_type_callback
InstrumentationRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, InstrumentationRuntimeGetType get_type_callback)
InstrumentationRuntimeGetType GetTypeCallbackForName(llvm::StringRef name, bool enabled_only)
LanguageRuntimeGetExceptionPrecondition precondition_callback
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
LanguageRuntimeGetCommandObject command_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
ObjectContainerCreateMemoryInstance create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
ObjectFileSaveCore save_core
PluginDir(FileSpec path, LoadPolicy policy)
const LoadPolicy policy
Filter when looking for plugins.
const FileSpec path
The path to the plugin directory.
@ LoadOnlyWithLLDBPrefix
Only load shared libraries who's filename start with g_plugin_prefix.
@ LoadAnyDylib
Try to load anything that looks like a shared library.
PluginTermCallback plugin_term_callback
PluginInfo()=default
llvm::sys::DynamicLibrary library
PluginInfo & operator=(PluginInfo &&other)
PluginInitCallback plugin_init_callback
PluginInfo(const PluginInfo &)=delete
PluginInfo(PluginInfo &&other)
static llvm::Expected< PluginInfo > Create(const FileSpec &path)
PluginInfo & operator=(const PluginInfo &)=delete
DebuggerInitializeCallback debugger_init_callback
PluginInstance()=default
PluginInstance(llvm::StringRef name, llvm::StringRef description, Callback create_callback, DebuggerInitializeCallback debugger_init_callback=nullptr)
LanguageSet supported_languages
REPLInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages)
RegisterTypeBuilderInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, lldb::ScriptLanguage language, ScriptInterpreterGetPath get_path_callback)
lldb::ScriptLanguage language
ScriptInterpreterGetPath get_path_callback
ScriptedInterfaceUsages usages
lldb::ScriptLanguage language
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description, ScriptedInterfaceCreateInstance create_callback, lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
StructuredDataFilterLaunchInfo filter_callback
SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle
SymbolLocatorInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, SymbolLocatorLocateExecutableObjectFile locate_executable_object_file, SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file, SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file, SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle, DebuggerInitializeCallback debugger_init_callback)
SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file
SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file
SymbolLocatorLocateExecutableObjectFile locate_executable_object_file
ThreadTraceExportCommandCreator create_thread_trace_export_command
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
llvm::StringRef schema
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback)
TraceCreateInstanceForLiveProcess create_callback_for_live_process
LanguageSet supported_languages_for_expressions
LanguageSet supported_languages_for_types
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39