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"
18#include "lldb/Target/Process.h"
20#include "lldb/Utility/Status.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/ADT/StringSet.h"
24#include "llvm/ADT/Twine.h"
25#include "llvm/Support/DynamicLibrary.h"
26#include "llvm/Support/ErrorExtras.h"
27#include "llvm/Support/FileSystem.h"
28#include "llvm/Support/raw_ostream.h"
29#include <cassert>
30#include <memory>
31#include <mutex>
32#include <string>
33#include <utility>
34#if defined(_WIN32)
36#endif
37
38using namespace lldb;
39using namespace lldb_private;
40
42typedef void (*PluginTermCallback)();
43
44struct PluginInfo {
45 PluginInfo() = default;
46
47 PluginInfo(const PluginInfo &) = delete;
48 PluginInfo &operator=(const PluginInfo &) = delete;
49
51 : library(std::move(other.library)),
53 std::exchange(other.plugin_init_callback, nullptr)),
55 std::exchange(other.plugin_term_callback, nullptr)) {}
56
58 library = std::move(other.library);
59 plugin_init_callback = std::exchange(other.plugin_init_callback, nullptr);
60 plugin_term_callback = std::exchange(other.plugin_term_callback, nullptr);
61 return *this;
62 }
63
65 if (!library.isValid())
66 return;
68 return;
70 }
71
72 static llvm::Expected<PluginInfo> Create(const FileSpec &path);
73
74private:
75 llvm::sys::DynamicLibrary library;
78};
79
80typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap;
81
82namespace {
83enum class PluginLifecycle { Uninitialized, Initialized, Terminated };
84
85struct PluginRegistry {
86 std::recursive_mutex mutex;
88
89 void Initialize() {
90 std::lock_guard<std::recursive_mutex> guard(mutex);
91 lifecycle = PluginLifecycle::Initialized;
92 }
93
94 void Terminate() {
95 std::lock_guard<std::recursive_mutex> guard(mutex);
96 lifecycle = PluginLifecycle::Terminated;
97 map.clear();
98 }
99
100 // Only after Terminate() is a leftover PluginInstances registration a bug;
101 // exiting in any other state (e.g. `import lldb`, which never calls
102 // Terminate()) is supported and leaves plugins registered.
103 bool IsTerminated() const { return lifecycle == PluginLifecycle::Terminated; }
104
105private:
106 PluginLifecycle lifecycle = PluginLifecycle::Uninitialized;
107};
108} // namespace
109
110// Never destroyed: at static-destruction time the PluginInstances containers
111// (separate statics, arbitrary teardown order) still call IsTerminated(), and
112// the map's PluginInfo terminate callbacks must not run when the containers
113// they unregister from may already be gone. Terminate() clears the map
114// explicitly while everything is alive. The static pointer keeps it reachable,
115// so this is not a LeakSanitizer leak.
116static PluginRegistry &GetPluginRegistry() {
117 static PluginRegistry *g_registry = new PluginRegistry();
118 return *g_registry;
119}
120
121static std::recursive_mutex &GetPluginMapMutex() {
122 return GetPluginRegistry().mutex;
123}
124
126
127static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
128 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
129 return GetPluginMap().contains(plugin_file_spec);
130}
131
132static void SetPluginInfo(const FileSpec &plugin_file_spec,
133 PluginInfo plugin_info) {
134 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
135 DynamicPluginMap &plugin_map = GetPluginMap();
136 assert(!plugin_map.contains(plugin_file_spec));
137 plugin_map.try_emplace(plugin_file_spec, std::move(plugin_info));
138}
139
140template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
141 return reinterpret_cast<FPtrTy>(VPtr);
142}
143
144static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin";
145struct PluginDir {
147 /// Try to load anything that looks like a shared library.
149
150 /// Only load shared libraries who's filename start with g_plugin_prefix.
152 };
153
156
157 explicit operator bool() const { return FileSystem::Instance().Exists(path); }
158
159 /// The path to the plugin directory.
161
162 /// Filter when looking for plugins.
164};
165
166llvm::Expected<PluginInfo> PluginInfo::Create(const FileSpec &path) {
167 PluginInfo plugin_info;
168 std::string error;
169 plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
170 path.GetPath().c_str(), &error);
171 if (!plugin_info.library.isValid())
172 return llvm::createStringError(error);
173
174 // Look for files that follow the convention <g_plugin_prefix><name>.<ext>, in
175 // which case we need to call lldb_initialize_<name> and
176 // lldb_terminate_<name>.
177 llvm::StringRef file_name = path.GetFileNameStrippingExtension();
178 if (file_name.starts_with(g_plugin_prefix)) {
179 llvm::StringRef plugin_name = file_name.substr(g_plugin_prefix.size());
180 std::string init_symbol =
181 llvm::Twine("lldb_initialize_" + plugin_name).str();
182
183 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
184 plugin_info.library.getAddressOfSymbol(init_symbol.c_str()))) {
185 if (!init_fn())
186 return llvm::createStringErrorV("initializer '{0}' returned false",
187 init_symbol);
188 const std::string term_symbol =
189 llvm::Twine("lldb_terminate_" + plugin_name).str();
191 plugin_info.library.getAddressOfSymbol(term_symbol.c_str()));
192 }
193 return plugin_info;
194 }
195
196 // Look for the legacy LLDBPluginInitialize/LLDBPluginTerminate symbols.
197 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
198 plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"))) {
199 if (!init_fn())
200 return llvm::createStringError(
201 "initializer 'LLDBPluginInitialize' returned false");
202
203 plugin_info.plugin_init_callback = init_fn;
205 plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
206 return plugin_info;
207 }
208
209 return llvm::createStringError("no initialize symbol found");
210}
211
213LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
214 llvm::StringRef path) {
215 namespace fs = llvm::sys::fs;
216
217 static constexpr std::array<llvm::StringLiteral, 3>
218 g_shared_library_extension = {".dylib", ".so", ".dll"};
219
220 // If we have a regular file, a symbolic link or unknown file type, try and
221 // process the file. We must handle unknown as sometimes the directory
222 // enumeration might be enumerating a file system that doesn't have correct
223 // file type information.
224 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
225 ft == fs::file_type::type_unknown) {
226 FileSpec plugin_file_spec(path);
227 FileSystem::Instance().Resolve(plugin_file_spec);
228
229 // Don't try to load unknown extensions.
230 if (!llvm::is_contained(g_shared_library_extension,
231 plugin_file_spec.GetFileNameExtension()))
233
234 // Don't try to load libraries that don't start with g_plugin_prefix if so
235 // requested.
237 if (*policy == PluginDir::LoadOnlyWithLLDBPrefix &&
238 !plugin_file_spec.GetFilename().starts_with(g_plugin_prefix))
240
241 // Don't try to load an already loaded plugin again.
242 if (PluginIsLoaded(plugin_file_spec))
244
245 llvm::Expected<PluginInfo> plugin_info =
246 PluginInfo::Create(plugin_file_spec);
247 if (plugin_info) {
248 SetPluginInfo(plugin_file_spec, std::move(*plugin_info));
249 } else {
250 // Cache an empty plugin info so we don't try to load it again and again.
251 SetPluginInfo(plugin_file_spec, PluginInfo());
252
253 LLDB_LOG_ERROR(GetLog(LLDBLog::Host), plugin_info.takeError(),
254 "could not load plugin: {0}");
255 }
256
258 }
259
260 if (ft == fs::file_type::directory_file ||
261 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
262 // Try and recurse into anything that a directory or symbolic link. We must
263 // also do this for unknown as sometimes the directory enumeration might be
264 // enumerating a file system that doesn't have correct file type
265 // information.
267 }
268
270}
271
273 GetPluginRegistry().Initialize();
274
275 static const bool find_directories = true;
276 static const bool find_files = true;
277 static const bool find_other = true;
278
279 // Directories to scan for plugins. Unlike the plugin directories, which are
280 // meant exclusively for LLDB, the shared library directory is likely to
281 // contain unrelated shared libraries that we do not want to load. Therefore,
282 // limit the scan to libraries that start with g_plugin_prefix.
283 const std::array<PluginDir, 3> plugin_dirs = {
284 PluginDir(HostInfo::GetShlibDir(), PluginDir::LoadOnlyWithLLDBPrefix),
285 PluginDir(HostInfo::GetSystemPluginDir(), PluginDir::LoadAnyDylib),
286 PluginDir(HostInfo::GetUserPluginDir(), PluginDir::LoadAnyDylib)};
287
288 for (const PluginDir &plugin_dir : plugin_dirs) {
289 if (plugin_dir) {
291 plugin_dir.path.GetPath().c_str(), find_directories, find_files,
292 find_other, LoadPluginCallback, (void *)&plugin_dir.policy);
293 }
294 }
295}
296
298
299llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
300 static PluginNamespace PluginNamespaces[] = {
301
302 {
303 "abi",
306 },
307
308 {
309 "architecture",
312 },
313
314 {
315 "bug-reporter",
318 },
319
320 {
321 "disassembler",
324 },
325
326 {
327 "dynamic-loader",
330 },
331
332 {
333 "emulate-instruction",
336 },
337
338 {
339 "instrumentation-runtime",
342 },
343
344 {
345 "jit-loader",
348 },
349
350 {
351 "language",
354 },
355
356 {
357 "language-runtime",
360 },
361
362 {
363 "memory-history",
366 },
367
368 {
369 "object-container",
372 },
373
374 {
375 "object-file",
378 },
379
380 {
381 "operating-system",
384 },
385
386 {
387 "platform",
390 },
391
392 {
393 "process",
396 },
397
398 {
399 "repl",
402 },
403
404 {
405 "register-type-builder",
408 },
409
410 {
411 "script-interpreter",
414 },
415
416 {
417 "scripted-interface",
420 },
421
422 {
423 "structured-data",
426 },
427
428 {
429 "symbol-file",
432 },
433
434 {
435 "symbol-locator",
438 },
439
440 {
441 "symbol-vendor",
444 },
445
446 {
447 "system-runtime",
450 },
451
452 {
453 "trace",
456 },
457
458 {
459 "trace-exporter",
462 },
463
464 {
465 "type-system",
468 },
469
470 {
471 "unwind-assembly",
474 },
475 };
476
477 return PluginNamespaces;
478}
479
480llvm::json::Object PluginManager::GetJSON(llvm::StringRef pattern) {
481 llvm::json::Object plugin_stats;
482
483 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
484 llvm::json::Array namespace_stats;
485
486 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
487 if (MatchPluginName(pattern, plugin_ns, plugin)) {
488 llvm::json::Object plugin_json;
489 plugin_json.try_emplace("name", plugin.name);
490 plugin_json.try_emplace("enabled", plugin.enabled);
491 namespace_stats.emplace_back(std::move(plugin_json));
492 }
493 }
494 if (!namespace_stats.empty())
495 plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
496 }
497
498 return plugin_stats;
499}
500
501bool PluginManager::MatchPluginName(llvm::StringRef pattern,
502 const PluginNamespace &plugin_ns,
503 const RegisteredPluginInfo &plugin_info) {
504 // The empty pattern matches all plugins.
505 if (pattern.empty())
506 return true;
507
508 // Check if the pattern matches the namespace.
509 if (pattern == plugin_ns.name)
510 return true;
511
512 // Check if the pattern matches the qualified name.
513 std::string qualified_name = (plugin_ns.name + "." + plugin_info.name).str();
514 return pattern == qualified_name;
515}
516
517template <typename Callback> struct PluginInstance {
518 typedef Callback CallbackType;
519
520 PluginInstance() = default;
527
528 llvm::StringRef name;
529 llvm::StringRef description;
533};
534
535template <typename Instance> class PluginInstances {
536public:
538 // Only meaningful after a real teardown; see PluginRegistry::IsTerminated.
539 if (!GetPluginRegistry().IsTerminated())
540 return;
541#ifndef NDEBUG
542 for (const auto &instance : m_instances)
543 llvm::errs() << llvm::formatv("Use `image lookup -va {0:x}` to find out "
544 "which callback was not removed\n",
545 instance.create_callback);
546#endif
547 assert(m_instances.empty() && "forgot to unregister plugin?");
548 }
549
550 template <typename... Args>
551 bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
552 typename Instance::CallbackType callback,
553 Args &&...args) {
554 if (!callback)
555 return false;
556 assert(!name.empty());
557
558 std::lock_guard<std::mutex> guard(m_mutex);
559 m_instances.emplace_back(name, description, callback,
560 std::forward<Args>(args)...);
561 return true;
562 }
563
564 bool UnregisterPlugin(typename Instance::CallbackType callback) {
565 if (!callback)
566 return false;
567
568 std::lock_guard<std::mutex> guard(m_mutex);
569 auto pos = m_instances.begin();
570 auto end = m_instances.end();
571 for (; pos != end; ++pos) {
572 if (pos->create_callback == callback) {
573 m_instances.erase(pos);
574 return true;
575 }
576 }
577 return false;
578 }
579
580 llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
581 if (auto instance = GetInstanceAtIndex(idx))
582 return instance->description;
583 return "";
584 }
585
586 llvm::StringRef GetNameAtIndex(uint32_t idx) {
587 if (auto instance = GetInstanceAtIndex(idx))
588 return instance->name;
589 return "";
590 }
591
592 typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
593 if (auto instance = GetInstanceForName(name))
594 return instance->create_callback;
595 return nullptr;
596 }
597
598 llvm::SmallVector<typename Instance::CallbackType> GetCreateCallbacks() {
599 llvm::SmallVector<Instance> snapshot = GetSnapshot();
600 llvm::SmallVector<typename Instance::CallbackType> result;
601 result.reserve(snapshot.size());
602 for (const auto &instance : snapshot)
603 result.push_back(instance.create_callback);
604 return result;
605 }
606
608 for (const auto &instance : GetSnapshot()) {
609 if (instance.debugger_init_callback)
610 instance.debugger_init_callback(debugger);
611 }
612 }
613
614 // Return a copy of all the enabled instances.
615 // Note that this is a copy of the internal state so modifications
616 // to the returned instances will not be reflected back to instances
617 // stored by the PluginInstances object.
618 llvm::SmallVector<Instance> GetSnapshot(bool enabled_only = true) const {
619 std::lock_guard<std::mutex> guard(m_mutex);
620
621 llvm::SmallVector<Instance> enabled_instances;
622 enabled_instances.reserve(m_instances.size());
623 for (const auto &instance : m_instances) {
624 if (!enabled_only || instance.enabled)
625 enabled_instances.push_back(instance);
626 }
627 return enabled_instances;
628 }
629
630 std::optional<Instance> GetInstanceAtIndex(uint32_t idx) {
631 uint32_t count = 0;
632
633 return FindEnabledInstance(
634 [&](const Instance &instance) { return count++ == idx; });
635 }
636
637 std::optional<Instance> GetInstanceForName(llvm::StringRef name,
638 bool enabled_only = true) {
639 if (name.empty())
640 return std::nullopt;
641
642 auto predicate = [&](const Instance &instance) {
643 return instance.name == name;
644 };
645 if (enabled_only)
646 return FindEnabledInstance(predicate);
647
648 return FindInstance(predicate);
649 }
650
651 std::optional<Instance>
652 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
653 for (const auto &instance : GetSnapshot()) {
654 if (predicate(instance))
655 return instance;
656 }
657 return std::nullopt;
658 }
659
660 std::optional<Instance>
661 FindInstance(std::function<bool(const Instance &)> predicate) const {
662 std::lock_guard<std::mutex> guard(m_mutex);
663 for (const auto &instance : m_instances) {
664 if (predicate(instance))
665 return instance;
666 }
667 return std::nullopt;
668 }
669
670 // Return a list of all the registered plugin instances. This includes both
671 // enabled and disabled instances. The instances are listed in the order they
672 // were registered which is the order they would be queried if they were all
673 // enabled.
674 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
675 std::lock_guard<std::mutex> guard(m_mutex);
676
677 // Lookup the plugin info for each instance in the sorted order.
678 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
679 plugin_infos.reserve(m_instances.size());
680
681 for (const Instance &instance : m_instances)
682 plugin_infos.push_back(
683 {instance.name, instance.description, instance.enabled});
684
685 return plugin_infos;
686 }
687
688 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
689 std::lock_guard<std::mutex> guard(m_mutex);
690 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
691 return instance.name == name;
692 });
693
694 if (it == m_instances.end())
695 return false;
696
697 it->enabled = enable;
698 return true;
699 }
700
701private:
702 mutable std::mutex m_mutex;
703 llvm::SmallVector<Instance> m_instances;
704};
705
706#pragma mark ABI
707
710
712 static ABIInstances g_instances;
713 return g_instances;
714}
715
716bool PluginManager::RegisterPlugin(llvm::StringRef name,
717 llvm::StringRef description,
718 ABICreateInstance create_callback) {
719 return GetABIInstances().RegisterPlugin(name, description, create_callback);
720}
721
723 return GetABIInstances().UnregisterPlugin(create_callback);
724}
725
726llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
728}
729
730#pragma mark Architecture
731
734
736 static ArchitectureInstances g_instances;
737 return g_instances;
738}
739
740void PluginManager::RegisterPlugin(llvm::StringRef name,
741 llvm::StringRef description,
742 ArchitectureCreateInstance create_callback) {
743 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
744}
745
747 ArchitectureCreateInstance create_callback) {
748 auto &instances = GetArchitectureInstances();
749 instances.UnregisterPlugin(create_callback);
750}
751
752std::unique_ptr<Architecture>
754 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
755 if (auto plugin_up = instances.create_callback(arch))
756 return plugin_up;
757 }
758 return nullptr;
759}
760
761#pragma mark BugReporter
762
765
767 static BugReporterInstances g_instances;
768 return g_instances;
769}
770
771void PluginManager::RegisterPlugin(llvm::StringRef name,
772 llvm::StringRef description,
773 BugReporterCreateInstance create_callback) {
774 GetBugReporterInstances().RegisterPlugin(name, description, create_callback);
775}
776
781
782std::unique_ptr<BugReporter>
784 if (!name.empty()) {
785 if (auto create_callback =
786 GetBugReporterInstances().GetCallbackForName(name))
787 return create_callback();
788 return nullptr;
789 }
790 for (const auto &instance : GetBugReporterInstances().GetSnapshot()) {
791 if (auto plugin_up = instance.create_callback())
792 return plugin_up;
793 }
794 return nullptr;
795}
796
797#pragma mark Disassembler
798
801
803 static DisassemblerInstances g_instances;
804 return g_instances;
805}
806
807bool PluginManager::RegisterPlugin(llvm::StringRef name,
808 llvm::StringRef description,
809 DisassemblerCreateInstance create_callback) {
810 return GetDisassemblerInstances().RegisterPlugin(name, description,
811 create_callback);
812}
813
815 DisassemblerCreateInstance create_callback) {
816 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
817}
818
819llvm::SmallVector<DisassemblerCreateInstance>
823
829
830#pragma mark DynamicLoader
831
834
836 static DynamicLoaderInstances g_instances;
837 return g_instances;
838}
839
841 llvm::StringRef name, llvm::StringRef description,
842 DynamicLoaderCreateInstance create_callback,
843 DebuggerInitializeCallback debugger_init_callback) {
845 name, description, create_callback, debugger_init_callback);
846}
847
849 DynamicLoaderCreateInstance create_callback) {
850 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
851}
852
853llvm::SmallVector<DynamicLoaderCreateInstance>
857
863
864#pragma mark JITLoader
865
868
870 static JITLoaderInstances g_instances;
871 return g_instances;
872}
873
875 llvm::StringRef name, llvm::StringRef description,
876 JITLoaderCreateInstance create_callback,
877 DebuggerInitializeCallback debugger_init_callback) {
879 name, description, create_callback, debugger_init_callback);
880}
881
883 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
884}
885
886llvm::SmallVector<JITLoaderCreateInstance>
890
891#pragma mark EmulateInstruction
892
896
898 static EmulateInstructionInstances g_instances;
899 return g_instances;
900}
901
903 llvm::StringRef name, llvm::StringRef description,
904 EmulateInstructionCreateInstance create_callback) {
905 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
906 create_callback);
907}
908
913
914llvm::SmallVector<EmulateInstructionCreateInstance>
918
924
925#pragma mark OperatingSystem
926
929
931 static OperatingSystemInstances g_instances;
932 return g_instances;
933}
934
936 llvm::StringRef name, llvm::StringRef description,
937 OperatingSystemCreateInstance create_callback,
938 DebuggerInitializeCallback debugger_init_callback) {
940 name, description, create_callback, debugger_init_callback);
941}
942
947
948llvm::SmallVector<OperatingSystemCreateInstance>
952
958
959#pragma mark Language
960
963
965 static LanguageInstances g_instances;
966 return g_instances;
967}
968
970 llvm::StringRef name, llvm::StringRef description,
971 LanguageCreateInstance create_callback,
972 DebuggerInitializeCallback debugger_init_callback) {
974 name, description, create_callback, debugger_init_callback);
975}
976
978 return GetLanguageInstances().UnregisterPlugin(create_callback);
979}
980
981llvm::SmallVector<LanguageCreateInstance>
985
986#pragma mark LanguageRuntime
987
1004
1006
1008 static LanguageRuntimeInstances g_instances;
1009 return g_instances;
1010}
1011
1013 llvm::StringRef name, llvm::StringRef description,
1014 LanguageRuntimeCreateInstance create_callback,
1015 LanguageRuntimeGetCommandObject command_callback,
1016 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
1018 name, description, create_callback, nullptr, command_callback,
1019 precondition_callback);
1020}
1021
1023 LanguageRuntimeCreateInstance create_callback) {
1024 return GetLanguageRuntimeInstances().UnregisterPlugin(create_callback);
1025}
1026
1027llvm::SmallVector<LanguageRuntimeCallbacks>
1029 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
1030 llvm::SmallVector<LanguageRuntimeCallbacks> result;
1031 result.reserve(instances.size());
1032 for (auto &instance : instances)
1033 result.push_back({instance.create_callback, instance.command_callback,
1034 instance.precondition_callback});
1035 return result;
1036}
1037
1038#pragma mark SystemRuntime
1039
1042
1044 static SystemRuntimeInstances g_instances;
1045 return g_instances;
1046}
1047
1049 llvm::StringRef name, llvm::StringRef description,
1050 SystemRuntimeCreateInstance create_callback) {
1051 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
1052 create_callback);
1053}
1054
1056 SystemRuntimeCreateInstance create_callback) {
1057 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
1058}
1059
1060llvm::SmallVector<SystemRuntimeCreateInstance>
1064
1065#pragma mark ObjectFile
1066
1086
1088 static ObjectFileInstances g_instances;
1089 return g_instances;
1090}
1091
1093 if (name.empty())
1094 return false;
1095
1096 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1097}
1098
1100 llvm::StringRef name, llvm::StringRef description,
1101 ObjectFileCreateInstance create_callback,
1102 ObjectFileCreateMemoryInstance create_memory_callback,
1103 ObjectFileGetModuleSpecifications get_module_specifications,
1104 ObjectFileSaveCore save_core,
1105 DebuggerInitializeCallback debugger_init_callback) {
1107 name, description, create_callback, create_memory_callback,
1108 get_module_specifications, save_core, debugger_init_callback);
1109}
1110
1112 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1113}
1114
1115llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1116 auto instances = GetObjectFileInstances().GetSnapshot();
1117 llvm::SmallVector<ObjectFileCallbacks> result;
1118 result.reserve(instances.size());
1119 for (auto &instance : instances)
1120 result.push_back({instance.create_callback, instance.create_memory_callback,
1121 instance.get_module_specifications, instance.save_core});
1122 return result;
1123}
1124
1127 llvm::StringRef name) {
1128 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1129 return instance->create_memory_callback;
1130 return nullptr;
1131}
1132
1134 Status error;
1135 if (!options.GetOutputFile()) {
1136 error = Status::FromErrorString("No output file specified");
1137 return error;
1138 }
1139
1140 if (!options.GetProcess()) {
1141 error = Status::FromErrorString("Invalid process");
1142 return error;
1143 }
1144
1145 error = options.EnsureValidConfiguration();
1146 if (error.Fail())
1147 return error;
1148
1149 if (!options.GetPluginName().has_value()) {
1150 // Try saving core directly from the process plugin first.
1151 llvm::Expected<bool> ret =
1152 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1153 if (!ret)
1154 return Status::FromError(ret.takeError());
1155 if (ret.get())
1156 return Status();
1157 }
1158
1159 // Fall back to object plugins.
1160 const auto &plugin_name = options.GetPluginName().value_or("");
1161 auto instances = GetObjectFileInstances().GetSnapshot();
1162 for (auto &instance : instances) {
1163 if (plugin_name.empty() || instance.name == plugin_name) {
1164 // TODO: Refactor the instance.save_core() to not require a process and
1165 // get it from options instead.
1166 if (instance.save_core &&
1167 instance.save_core(options.GetProcess(), options, error))
1168 return error;
1169 }
1170 }
1171
1172 // Check to see if any of the object file plugins tried and failed to save.
1173 // if any failure, return the error message.
1174 if (error.Fail())
1175 return error;
1176
1177 // Report only for the plugin that was specified.
1178 if (!plugin_name.empty())
1180 "The \"{}\" plugin is not able to save a core for this process.",
1181 plugin_name);
1182
1184 "no ObjectFile plugins were able to save a core for this process");
1185}
1186
1187llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1188 llvm::SmallVector<llvm::StringRef> plugin_names;
1189 auto instances = GetObjectFileInstances().GetSnapshot();
1190 for (auto &instance : instances) {
1191 if (instance.save_core)
1192 plugin_names.emplace_back(instance.name);
1193 }
1194 return plugin_names;
1195}
1196
1197#pragma mark ObjectContainer
1198
1215
1217 static ObjectContainerInstances g_instances;
1218 return g_instances;
1219}
1220
1222 llvm::StringRef name, llvm::StringRef description,
1223 ObjectContainerCreateInstance create_callback,
1224 ObjectFileGetModuleSpecifications get_module_specifications,
1225 ObjectContainerCreateMemoryInstance create_memory_callback) {
1227 name, description, create_callback, create_memory_callback,
1228 get_module_specifications);
1229}
1230
1232 ObjectContainerCreateInstance create_callback) {
1233 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1234}
1235
1236llvm::SmallVector<ObjectContainerCallbacks>
1238 auto instances = GetObjectContainerInstances().GetSnapshot();
1239 llvm::SmallVector<ObjectContainerCallbacks> result;
1240 result.reserve(instances.size());
1241 for (auto &instance : instances)
1242 result.push_back({instance.create_callback, instance.create_memory_callback,
1243 instance.get_module_specifications});
1244 return result;
1245}
1246
1247#pragma mark Platform
1248
1251
1253 static PlatformInstances g_platform_instances;
1254 return g_platform_instances;
1255}
1256
1258 llvm::StringRef name, llvm::StringRef description,
1259 PlatformCreateInstance create_callback,
1260 DebuggerInitializeCallback debugger_init_callback) {
1262 name, description, create_callback, debugger_init_callback);
1263}
1264
1266 return GetPlatformInstances().UnregisterPlugin(create_callback);
1267}
1268
1269llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1271}
1272
1273llvm::StringRef
1277
1282
1283llvm::SmallVector<PlatformCreateInstance>
1287
1289 CompletionRequest &request) {
1290 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1291 if (instance.name.starts_with(name))
1292 request.AddCompletion(instance.name);
1293 }
1294}
1295
1296#pragma mark Process
1297
1300
1302 static ProcessInstances g_instances;
1303 return g_instances;
1304}
1305
1307 llvm::StringRef name, llvm::StringRef description,
1308 ProcessCreateInstance create_callback,
1309 DebuggerInitializeCallback debugger_init_callback) {
1311 name, description, create_callback, debugger_init_callback);
1312}
1313
1315 return GetProcessInstances().UnregisterPlugin(create_callback);
1316}
1317
1318llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1319 return GetProcessInstances().GetNameAtIndex(idx);
1320}
1321
1322llvm::StringRef
1326
1331
1332llvm::SmallVector<ProcessCreateInstance>
1336
1338 CompletionRequest &request) {
1339 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1340 if (instance.name.starts_with(name))
1341 request.AddCompletion(instance.name, instance.description);
1342 }
1343}
1344
1345#pragma mark ProtocolServer
1346
1349
1351 static ProtocolServerInstances g_instances;
1352 return g_instances;
1353}
1354
1356 llvm::StringRef name, llvm::StringRef description,
1357 ProtocolServerCreateInstance create_callback) {
1358 return GetProtocolServerInstances().RegisterPlugin(name, description,
1359 create_callback);
1360}
1361
1363 ProtocolServerCreateInstance create_callback) {
1364 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1365}
1366
1367llvm::StringRef
1371
1376
1377#pragma mark RegisterTypeBuilder
1378
1380 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1385};
1386
1387typedef PluginInstances<RegisterTypeBuilderInstance>
1389
1391 static RegisterTypeBuilderInstances g_instances;
1392 return g_instances;
1393}
1394
1396 llvm::StringRef name, llvm::StringRef description,
1397 RegisterTypeBuilderCreateInstance create_callback) {
1398 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1399 create_callback);
1400}
1401
1406
1409 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1410 // type and is always present.
1412 assert(instance);
1413 return instance->create_callback(target);
1414}
1415
1416#pragma mark ScriptInterpreter
1417
1431
1433
1435 static ScriptInterpreterInstances g_instances;
1436 return g_instances;
1437}
1438
1440 llvm::StringRef name, llvm::StringRef description,
1441 lldb::ScriptLanguage script_language,
1442 ScriptInterpreterCreateInstance create_callback,
1443 ScriptInterpreterGetPath get_path_callback) {
1445 name, description, create_callback, script_language, get_path_callback);
1446}
1447
1452
1453llvm::SmallVector<ScriptInterpreterCreateInstance>
1457
1460 Debugger &debugger) {
1461 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1462 ScriptInterpreterCreateInstance none_instance = nullptr;
1463 for (const auto &instance : instances) {
1464 if (instance.language == lldb::eScriptLanguageNone)
1465 none_instance = instance.create_callback;
1466
1467 if (script_lang == instance.language)
1468 return instance.create_callback(debugger);
1469 }
1470
1471 // If we didn't find one, return the ScriptInterpreter for the null language.
1472 assert(none_instance != nullptr);
1473 return none_instance(debugger);
1474}
1475
1477 lldb::ScriptLanguage script_lang) {
1478 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1479 for (const auto &instance : instances) {
1480 if (instance.language == script_lang && instance.get_path_callback)
1481 return instance.get_path_callback();
1482 }
1483 return FileSpec();
1484}
1485
1486#pragma mark SyntheticFrameProvider
1487
1496
1498 static SyntheticFrameProviderInstances g_instances;
1499 return g_instances;
1500}
1501
1503 static ScriptedFrameProviderInstances g_instances;
1504 return g_instances;
1505}
1506
1508 llvm::StringRef name, llvm::StringRef description,
1509 SyntheticFrameProviderCreateInstance create_native_callback,
1510 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1511 if (create_native_callback)
1513 name, description, create_native_callback);
1514 else if (create_scripted_callback)
1516 name, description, create_scripted_callback);
1517 return false;
1518}
1519
1524
1529
1535
1536llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1540
1541#pragma mark StructuredDataPlugin
1542
1556
1559
1561 static StructuredDataPluginInstances g_instances;
1562 return g_instances;
1563}
1564
1566 llvm::StringRef name, llvm::StringRef description,
1567 StructuredDataPluginCreateInstance create_callback,
1568 DebuggerInitializeCallback debugger_init_callback,
1569 StructuredDataFilterLaunchInfo filter_callback) {
1571 name, description, create_callback, debugger_init_callback,
1572 filter_callback);
1573}
1574
1579
1580llvm::SmallVector<StructuredDataPluginCallbacks>
1582 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1583 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1584 result.reserve(instances.size());
1585 for (auto &instance : instances)
1586 result.push_back({instance.create_callback, instance.filter_callback});
1587 return result;
1588}
1589
1590#pragma mark SymbolFile
1591
1594
1596 static SymbolFileInstances g_instances;
1597 return g_instances;
1598}
1599
1601 llvm::StringRef name, llvm::StringRef description,
1602 SymbolFileCreateInstance create_callback,
1603 DebuggerInitializeCallback debugger_init_callback) {
1605 name, description, create_callback, debugger_init_callback);
1606}
1607
1609 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1610}
1611
1612llvm::SmallVector<SymbolFileCreateInstance>
1616
1617#pragma mark SymbolVendor
1618
1621
1623 static SymbolVendorInstances g_instances;
1624 return g_instances;
1625}
1626
1627bool PluginManager::RegisterPlugin(llvm::StringRef name,
1628 llvm::StringRef description,
1629 SymbolVendorCreateInstance create_callback) {
1630 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1631 create_callback);
1632}
1633
1635 SymbolVendorCreateInstance create_callback) {
1636 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1637}
1638
1639llvm::SmallVector<SymbolVendorCreateInstance>
1643
1644#pragma mark SymbolLocator
1645
1669
1671 static SymbolLocatorInstances g_instances;
1672 return g_instances;
1673}
1674
1676 llvm::StringRef name, llvm::StringRef description,
1677 SymbolLocatorCreateInstance create_callback,
1678 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1679 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1680 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1681 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1682 DebuggerInitializeCallback debugger_init_callback) {
1684 name, description, create_callback, locate_executable_object_file,
1685 locate_executable_symbol_file, download_object_symbol_file,
1686 find_symbol_file_in_bundle, debugger_init_callback);
1687}
1688
1690 SymbolLocatorCreateInstance create_callback) {
1691 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1692}
1693
1694llvm::SmallVector<SymbolLocatorCreateInstance>
1698
1701 StatisticsMap &map) {
1702 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1703 for (auto &instance : instances) {
1704 if (instance.locate_executable_object_file) {
1705 StatsDuration time;
1706 std::optional<ModuleSpec> result;
1707 {
1708 ElapsedTime elapsed(time);
1709 result = instance.locate_executable_object_file(module_spec);
1710 }
1711 map.add(instance.name, time.get().count());
1712 if (result)
1713 return *result;
1714 }
1715 }
1716 return {};
1717}
1718
1720 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1721 StatisticsMap &map) {
1722 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1723 for (auto &instance : instances) {
1724 if (instance.locate_executable_symbol_file) {
1725 StatsDuration time;
1726 std::optional<FileSpec> result;
1727 {
1728 ElapsedTime elapsed(time);
1729 result = instance.locate_executable_symbol_file(module_spec,
1730 default_search_paths);
1731 }
1732 map.add(instance.name, time.get().count());
1733 if (result)
1734 return *result;
1735 }
1736 }
1737 return {};
1738}
1739
1741 Status &error,
1742 bool force_lookup,
1743 bool copy_executable) {
1744 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1745 for (auto &instance : instances) {
1746 if (instance.download_object_symbol_file) {
1747 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1748 copy_executable))
1749 return true;
1750 }
1751 }
1752 return false;
1753}
1754
1756 const UUID *uuid,
1757 const ArchSpec *arch) {
1758 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1759 for (auto &instance : instances) {
1760 if (instance.find_symbol_file_in_bundle) {
1761 std::optional<FileSpec> result =
1762 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1763 if (result)
1764 return *result;
1765 }
1766 }
1767 return {};
1768}
1769
1770#pragma mark Trace
1771
1787
1789
1791 static TraceInstances g_instances;
1792 return g_instances;
1793}
1794
1796 llvm::StringRef name, llvm::StringRef description,
1797 TraceCreateInstanceFromBundle create_callback_from_bundle,
1798 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1799 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1801 name, description, create_callback_from_bundle,
1802 create_callback_for_live_process, schema, debugger_init_callback);
1803}
1804
1806 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1808 create_callback_from_bundle);
1809}
1810
1812PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1813 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1814}
1815
1818 llvm::StringRef plugin_name) {
1819 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1820 return instance->create_callback_for_live_process;
1821
1822 return nullptr;
1823}
1824
1825llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1826 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1827 return instance->schema;
1828 return llvm::StringRef();
1829}
1830
1831llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1832 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1833 return instance->schema;
1834 return llvm::StringRef();
1835}
1836
1837#pragma mark TraceExporter
1838
1852
1854
1856 static TraceExporterInstances g_instances;
1857 return g_instances;
1858}
1859
1861 llvm::StringRef name, llvm::StringRef description,
1862 TraceExporterCreateInstance create_callback,
1863 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1865 name, description, create_callback, create_thread_trace_export_command);
1866}
1867
1870 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1871}
1872
1874 TraceExporterCreateInstance create_callback) {
1875 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1876}
1877
1878llvm::SmallVector<TraceExporterCallbacks>
1880 auto instances = GetTraceExporterInstances().GetSnapshot();
1881 llvm::SmallVector<TraceExporterCallbacks> result;
1882 result.reserve(instances.size());
1883 for (auto &instance : instances)
1884 result.push_back({instance.name, instance.create_callback,
1885 instance.create_thread_trace_export_command});
1886 return result;
1887}
1888
1889#pragma mark UnwindAssembly
1890
1893
1895 static UnwindAssemblyInstances g_instances;
1896 return g_instances;
1897}
1898
1900 llvm::StringRef name, llvm::StringRef description,
1901 UnwindAssemblyCreateInstance create_callback) {
1902 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1903 create_callback);
1904}
1905
1907 UnwindAssemblyCreateInstance create_callback) {
1908 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1909}
1910
1911llvm::SmallVector<UnwindAssemblyCreateInstance>
1915
1916#pragma mark MemoryHistory
1917
1920
1922 static MemoryHistoryInstances g_instances;
1923 return g_instances;
1924}
1925
1927 llvm::StringRef name, llvm::StringRef description,
1928 MemoryHistoryCreateInstance create_callback) {
1929 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1930 create_callback);
1931}
1932
1934 MemoryHistoryCreateInstance create_callback) {
1935 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1936}
1937
1938llvm::SmallVector<MemoryHistoryCreateInstance>
1942
1943#pragma mark InstrumentationRuntime
1944
1957
1959 : public PluginInstances<InstrumentationRuntimeInstance> {
1960
1962 bool enabled_only) {
1963 if (auto instance = GetInstanceForName(name, enabled_only))
1964 return instance->get_type_callback;
1965 return nullptr;
1966 }
1967};
1968
1970 static InstrumentationRuntimeInstances g_instances;
1971 return g_instances;
1972}
1973
1975 llvm::StringRef name, llvm::StringRef description,
1977 InstrumentationRuntimeGetType get_type_callback) {
1979 name, description, create_callback, get_type_callback);
1980}
1981
1986
1987llvm::SmallVector<InstrumentationRuntimeCallbacks>
1989 auto instances =
1991 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1992 result.reserve(instances.size());
1993 for (auto &instance : instances)
1994 result.push_back({instance.create_callback, instance.get_type_callback});
1995 return result;
1996}
1997
1998#pragma mark TypeSystem
1999
2015
2017
2019 static TypeSystemInstances g_instances;
2020 return g_instances;
2021}
2022
2024 llvm::StringRef name, llvm::StringRef description,
2025 TypeSystemCreateInstance create_callback,
2026 LanguageSet supported_languages_for_types,
2027 LanguageSet supported_languages_for_expressions,
2028 DebuggerInitializeCallback debugger_init_callback) {
2030 name, description, create_callback, supported_languages_for_types,
2031 supported_languages_for_expressions, debugger_init_callback);
2032}
2033
2035 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
2036}
2037
2038llvm::SmallVector<TypeSystemCreateInstance>
2042
2044 const auto instances = GetTypeSystemInstances().GetSnapshot();
2045 LanguageSet all;
2046 for (unsigned i = 0; i < instances.size(); ++i)
2047 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
2048 return all;
2049}
2050
2052 const auto instances = GetTypeSystemInstances().GetSnapshot();
2053 LanguageSet all;
2054 for (unsigned i = 0; i < instances.size(); ++i)
2055 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
2056 return all;
2057}
2058
2059#pragma mark ScriptedInterfaces
2060
2076
2078
2080 static ScriptedInterfaceInstances g_instances;
2081 return g_instances;
2082}
2083
2085 llvm::StringRef name, llvm::StringRef description,
2086 ScriptedInterfaceCreateInstance create_callback,
2088 ScriptedInterfaceUsages usages) {
2090 name, description, create_callback, extension, language, usages);
2091}
2092
2097
2101
2102llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2104}
2105
2106llvm::StringRef
2110
2113 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(index))
2114 return instance->extension;
2116}
2117
2120 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2121 return instance->language;
2123}
2124
2127 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2128 return instance->usages;
2129 return {};
2130}
2131
2133 llvm::StringRef name, CompletionRequest &request,
2134 lldb::ScriptLanguage language) {
2135 llvm::StringSet<> emitted;
2136 for (size_t idx = 0; idx < GetNumScriptedInterfaces(); idx++) {
2138 if (!instance)
2139 continue;
2140 // Filter to the requested language when the caller pinned one via
2141 // `-l`. `eScriptLanguageUnknown` means "no filter".
2142 if (language != lldb::eScriptLanguageUnknown &&
2143 instance->language != language)
2144 continue;
2145 llvm::StringLiteral extension_name =
2146 ScriptInterpreter::ExtensionToString(instance->extension);
2147 if (!extension_name.starts_with(name))
2148 continue;
2149 // A single extension can back multiple languages, so dedup entries
2150 // we've already surfaced.
2151 if (emitted.insert(extension_name).second)
2152 request.AddCompletion(extension_name);
2153 }
2154}
2155
2156#pragma mark REPL
2157
2166
2168
2170 static REPLInstances g_instances;
2171 return g_instances;
2172}
2173
2174bool PluginManager::RegisterPlugin(llvm::StringRef name,
2175 llvm::StringRef description,
2176 REPLCreateInstance create_callback,
2177 LanguageSet supported_languages) {
2178 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2179 supported_languages);
2180}
2181
2183 return GetREPLInstances().UnregisterPlugin(create_callback);
2184}
2185
2186llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2187 auto instances = GetREPLInstances().GetSnapshot();
2188 llvm::SmallVector<REPLCallbacks> result;
2189 result.reserve(instances.size());
2190 for (auto &instance : instances)
2191 result.push_back({instance.create_callback, instance.supported_languages});
2192 return result;
2193}
2194
2196 const auto instances = GetREPLInstances().GetSnapshot();
2197 LanguageSet all;
2198 for (unsigned i = 0; i < instances.size(); ++i)
2199 all.bitvector |= instances[i].supported_languages.bitvector;
2200 return all;
2201}
2202
2203#pragma mark Highlighter
2204
2205struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2210};
2211
2213
2215 static HighlighterInstances g_instances;
2216 return g_instances;
2217}
2218
2219bool PluginManager::RegisterPlugin(llvm::StringRef name,
2220 llvm::StringRef description,
2221 HighlighterCreateInstance create_callback) {
2222 return GetHighlighterInstances().RegisterPlugin(name, description,
2223 create_callback);
2224}
2225
2227 HighlighterCreateInstance create_callback) {
2228 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2229}
2230
2231llvm::SmallVector<HighlighterCreateInstance>
2235
2236#pragma mark PluginManager
2237
2253
2254// This is the preferred new way to register plugin specific settings. e.g.
2255// This will put a plugin's settings under e.g.
2256// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2258 Debugger &debugger, llvm::StringRef plugin_type_name,
2259 llvm::StringRef plugin_type_desc, bool can_create) {
2260 lldb::OptionValuePropertiesSP parent_properties_sp(
2261 debugger.GetValueProperties());
2262 if (parent_properties_sp) {
2263 static constexpr llvm::StringLiteral g_property_name("plugin");
2264
2265 OptionValuePropertiesSP plugin_properties_sp =
2266 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2267 if (!plugin_properties_sp && can_create) {
2268 plugin_properties_sp =
2269 std::make_shared<OptionValueProperties>(g_property_name);
2270 plugin_properties_sp->SetExpectedPath("plugin");
2271 parent_properties_sp->AppendProperty(g_property_name,
2272 "Settings specify to plugins.", true,
2273 plugin_properties_sp);
2274 }
2275
2276 if (plugin_properties_sp) {
2277 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2278 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2279 if (!plugin_type_properties_sp && can_create) {
2280 plugin_type_properties_sp =
2281 std::make_shared<OptionValueProperties>(plugin_type_name);
2282 plugin_type_properties_sp->SetExpectedPath(
2283 ("plugin." + plugin_type_name).str());
2284 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2285 true, plugin_type_properties_sp);
2286 }
2287 return plugin_type_properties_sp;
2288 }
2289 }
2291}
2292
2293// This is deprecated way to register plugin specific settings. e.g.
2294// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2295// generic settings would be under "platform.SETTINGNAME".
2297 Debugger &debugger, llvm::StringRef plugin_type_name,
2298 llvm::StringRef plugin_type_desc, bool can_create) {
2299 static constexpr llvm::StringLiteral g_property_name("plugin");
2300 lldb::OptionValuePropertiesSP parent_properties_sp(
2301 debugger.GetValueProperties());
2302 if (parent_properties_sp) {
2303 OptionValuePropertiesSP plugin_properties_sp =
2304 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2305 if (!plugin_properties_sp && can_create) {
2306 plugin_properties_sp =
2307 std::make_shared<OptionValueProperties>(plugin_type_name);
2308 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2309 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2310 true, plugin_properties_sp);
2311 }
2312
2313 if (plugin_properties_sp) {
2314 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2315 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2316 if (!plugin_type_properties_sp && can_create) {
2317 plugin_type_properties_sp =
2318 std::make_shared<OptionValueProperties>(g_property_name);
2319 plugin_type_properties_sp->SetExpectedPath(
2320 (plugin_type_name + ".plugin").str());
2321 plugin_properties_sp->AppendProperty(g_property_name,
2322 "Settings specific to plugins",
2323 true, plugin_type_properties_sp);
2324 }
2325 return plugin_type_properties_sp;
2326 }
2327 }
2329}
2330
2331namespace {
2332
2334GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2335 bool can_create);
2336}
2337
2339GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2340 llvm::StringRef plugin_type_name,
2341 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2343 lldb::OptionValuePropertiesSP properties_sp;
2344 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2345 debugger, plugin_type_name,
2346 "", // not creating to so we don't need the description
2347 false));
2348 if (plugin_type_properties_sp)
2349 properties_sp =
2350 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2351 return properties_sp;
2352}
2353
2354static bool
2355CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2356 llvm::StringRef plugin_type_desc,
2357 const lldb::OptionValuePropertiesSP &properties_sp,
2358 llvm::StringRef description, bool is_global_property,
2359 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2361 if (properties_sp) {
2362 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2363 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2364 true));
2365 if (plugin_type_properties_sp) {
2366 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2367 description, is_global_property,
2368 properties_sp);
2369 return true;
2370 }
2371 }
2372 return false;
2373}
2374
2375static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2376static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2377static constexpr llvm::StringLiteral kProcessPluginName("process");
2378static constexpr llvm::StringLiteral kTracePluginName("trace");
2379static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2380static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2381static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2382static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2383static constexpr llvm::StringLiteral
2384 kStructuredDataPluginName("structured-data");
2385static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2386
2389 llvm::StringRef setting_name) {
2390 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2391}
2392
2394 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2395 llvm::StringRef description, bool is_global_property) {
2397 "Settings for dynamic loader plug-ins",
2398 properties_sp, description, is_global_property);
2399}
2400
2403 llvm::StringRef setting_name) {
2404 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2406}
2407
2409 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2410 llvm::StringRef description, bool is_global_property) {
2412 "Settings for platform plug-ins", properties_sp,
2413 description, is_global_property,
2415}
2416
2419 llvm::StringRef setting_name) {
2420 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2421}
2422
2424 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2425 llvm::StringRef description, bool is_global_property) {
2427 "Settings for process plug-ins", properties_sp,
2428 description, is_global_property);
2429}
2430
2433 llvm::StringRef setting_name) {
2434 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2435}
2436
2438 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2439 llvm::StringRef description, bool is_global_property) {
2441 "Settings for symbol locator plug-ins",
2442 properties_sp, description, is_global_property);
2443}
2444
2446 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2447 llvm::StringRef description, bool is_global_property) {
2449 "Settings for trace plug-ins", properties_sp,
2450 description, is_global_property);
2451}
2452
2455 llvm::StringRef setting_name) {
2456 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2457}
2458
2460 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2461 llvm::StringRef description, bool is_global_property) {
2463 "Settings for object file plug-ins",
2464 properties_sp, description, is_global_property);
2465}
2466
2469 llvm::StringRef setting_name) {
2470 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2471}
2472
2474 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2475 llvm::StringRef description, bool is_global_property) {
2477 "Settings for symbol file plug-ins",
2478 properties_sp, description, is_global_property);
2479}
2480
2483 llvm::StringRef setting_name) {
2484 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2485}
2486
2488 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2489 llvm::StringRef description, bool is_global_property) {
2491 "Settings for JIT loader plug-ins",
2492 properties_sp, description, is_global_property);
2493}
2494
2495static const char *kOperatingSystemPluginName("os");
2496
2498 Debugger &debugger, llvm::StringRef setting_name) {
2499 lldb::OptionValuePropertiesSP properties_sp;
2500 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2503 "", // not creating to so we don't need the description
2504 false));
2505 if (plugin_type_properties_sp)
2506 properties_sp =
2507 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2508 return properties_sp;
2509}
2510
2512 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2513 llvm::StringRef description, bool is_global_property) {
2514 if (properties_sp) {
2515 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2517 "Settings for operating system plug-ins",
2518 true));
2519 if (plugin_type_properties_sp) {
2520 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2521 description, is_global_property,
2522 properties_sp);
2523 return true;
2524 }
2525 }
2526 return false;
2527}
2528
2531 llvm::StringRef setting_name) {
2532 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2533}
2534
2536 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2537 llvm::StringRef description, bool is_global_property) {
2539 "Settings for structured data plug-ins",
2540 properties_sp, description, is_global_property);
2541}
2542
2545 Debugger &debugger, llvm::StringRef setting_name) {
2546 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2547}
2548
2550 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2551 llvm::StringRef description, bool is_global_property) {
2553 "Settings for CPlusPlus language plug-ins",
2554 properties_sp, description, is_global_property);
2555}
2556
2557//
2558// Plugin Info+Enable Implementations
2559//
2560llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2562}
2563bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2564 return GetABIInstances().SetInstanceEnabled(name, enable);
2565}
2566
2567llvm::SmallVector<RegisteredPluginInfo>
2572 bool enable) {
2573 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2574}
2575
2576llvm::SmallVector<RegisteredPluginInfo>
2581 bool enable) {
2582 return GetBugReporterInstances().SetInstanceEnabled(name, enable);
2583}
2584
2585llvm::SmallVector<RegisteredPluginInfo>
2590 bool enable) {
2591 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2592}
2593
2594llvm::SmallVector<RegisteredPluginInfo>
2599 bool enable) {
2600 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2601}
2602
2603llvm::SmallVector<RegisteredPluginInfo>
2608 bool enable) {
2610}
2611
2612llvm::SmallVector<RegisteredPluginInfo>
2616
2618 switch (kind) {
2620 return "global";
2622 return "debugger";
2624 return "target";
2625 }
2626 llvm_unreachable("unhandled PluginDomainKind");
2627}
2628
2630 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2631 PluginDomainKind domain) {
2632 if (domain != lldb::ePluginDomainKindGlobal)
2633 return llvm::createStringErrorV("{} domain is not supported",
2634 PluginDomainKindToStr(domain));
2635 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2636 return llvm::createStringError("plugin could not be found");
2637
2638 return llvm::Error::success();
2639}
2640
2641llvm::SmallVector<RegisteredPluginInfo>
2646 bool enable) {
2647 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2648}
2649
2650llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2652}
2654 bool enable) {
2655 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2656}
2657
2658llvm::SmallVector<RegisteredPluginInfo>
2663 bool enable) {
2664 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2665}
2666
2667llvm::SmallVector<RegisteredPluginInfo>
2672 bool enable) {
2673 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2674}
2675
2676llvm::SmallVector<RegisteredPluginInfo>
2681 bool enable) {
2682 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2683}
2684
2685llvm::SmallVector<RegisteredPluginInfo>
2690 bool enable) {
2691 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2692}
2693
2694llvm::SmallVector<RegisteredPluginInfo>
2699 bool enable) {
2700 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2701}
2702
2703llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2705}
2707 bool enable) {
2708 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2709}
2710
2711llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2713}
2714bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2715 return GetProcessInstances().SetInstanceEnabled(name, enable);
2716}
2717
2718llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2720}
2721bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2722 return GetREPLInstances().SetInstanceEnabled(name, enable);
2723}
2724
2725llvm::SmallVector<RegisteredPluginInfo>
2730 bool enable) {
2732}
2733
2734llvm::SmallVector<RegisteredPluginInfo>
2739 bool enable) {
2741}
2742
2743llvm::SmallVector<RegisteredPluginInfo>
2748 bool enable) {
2750}
2751
2752llvm::SmallVector<RegisteredPluginInfo>
2757 bool enable) {
2759}
2760
2761llvm::SmallVector<RegisteredPluginInfo>
2766 bool enable) {
2767 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2768}
2769
2770llvm::SmallVector<RegisteredPluginInfo>
2775 bool enable) {
2776 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2777}
2778
2779llvm::SmallVector<RegisteredPluginInfo>
2784 bool enable) {
2785 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2786}
2787
2788llvm::SmallVector<RegisteredPluginInfo>
2793 bool enable) {
2794 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2795}
2796
2797llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2799}
2800bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2801 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2802}
2803
2804llvm::SmallVector<RegisteredPluginInfo>
2809 bool enable) {
2810 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2811}
2812
2813llvm::SmallVector<RegisteredPluginInfo>
2818 bool enable) {
2819 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2820}
2821
2822llvm::SmallVector<RegisteredPluginInfo>
2827 bool enable) {
2828 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2829}
2830
2832 CompletionRequest &request) {
2833 // Split the name into the namespace and the plugin name.
2834 // If there is no dot then the ns_name will be equal to name and
2835 // plugin_prefix will be empty.
2836 llvm::StringRef ns_name, plugin_prefix;
2837 std::tie(ns_name, plugin_prefix) = name.split('.');
2838
2839 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2840 // If the plugin namespace matches exactly then
2841 // add all the plugins in this namespace as completions if the
2842 // plugin names starts with the plugin_prefix. If the plugin_prefix
2843 // is empty then it will match all the plugins (empty string is a
2844 // prefix of everything).
2845 if (plugin_ns.name == ns_name) {
2846 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2847 llvm::SmallString<128> buf;
2848 if (plugin.name.starts_with(plugin_prefix))
2849 request.AddCompletion(
2850 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2851 }
2852 } else if (plugin_ns.name.starts_with(name) &&
2853 !plugin_ns.get_info().empty()) {
2854 // Otherwise check if the namespace is a prefix of the full name.
2855 // Use a partial completion here so that we can either operate on the full
2856 // namespace or tab-complete to the next level.
2857 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2858 }
2859 }
2860}
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:907
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:405
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:101
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:56
llvm::StringRef GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:414
llvm::StringRef GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:248
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:380
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp:410
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 void AutoCompleteScriptedExtension(llvm::StringRef partial_name, CompletionRequest &request, lldb::ScriptLanguage language=lldb::eScriptLanguageUnknown)
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 lldb::ScriptedExtension GetScriptedInterfaceExtensionAtIndex(uint32_t idx)
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
static llvm::StringLiteral ExtensionToString(lldb::ScriptedExtension extension)
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:338
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.
@ eScriptLanguageUnknown
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
ScriptedExtension
Scripting extension types.
@ eScriptedExtensionInvalid
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
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description, ScriptedInterfaceCreateInstance create_callback, lldb::ScriptedExtension extension, lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
lldb::ScriptLanguage language
lldb::ScriptedExtension extension
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
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions, DebuggerInitializeCallback debugger_init_callback)
LanguageSet supported_languages_for_types
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39