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
2014
2016
2018 static TypeSystemInstances g_instances;
2019 return g_instances;
2020}
2021
2023 llvm::StringRef name, llvm::StringRef description,
2024 TypeSystemCreateInstance create_callback,
2025 LanguageSet supported_languages_for_types,
2026 LanguageSet supported_languages_for_expressions) {
2028 name, description, create_callback, supported_languages_for_types,
2029 supported_languages_for_expressions);
2030}
2031
2033 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
2034}
2035
2036llvm::SmallVector<TypeSystemCreateInstance>
2040
2042 const auto instances = GetTypeSystemInstances().GetSnapshot();
2043 LanguageSet all;
2044 for (unsigned i = 0; i < instances.size(); ++i)
2045 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
2046 return all;
2047}
2048
2050 const auto instances = GetTypeSystemInstances().GetSnapshot();
2051 LanguageSet all;
2052 for (unsigned i = 0; i < instances.size(); ++i)
2053 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
2054 return all;
2055}
2056
2057#pragma mark ScriptedInterfaces
2058
2074
2076
2078 static ScriptedInterfaceInstances g_instances;
2079 return g_instances;
2080}
2081
2083 llvm::StringRef name, llvm::StringRef description,
2084 ScriptedInterfaceCreateInstance create_callback,
2086 ScriptedInterfaceUsages usages) {
2088 name, description, create_callback, extension, language, usages);
2089}
2090
2095
2099
2100llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2102}
2103
2104llvm::StringRef
2108
2111 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(index))
2112 return instance->extension;
2114}
2115
2118 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2119 return instance->language;
2121}
2122
2125 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2126 return instance->usages;
2127 return {};
2128}
2129
2131 llvm::StringRef name, CompletionRequest &request,
2132 lldb::ScriptLanguage language) {
2133 llvm::StringSet<> emitted;
2134 for (size_t idx = 0; idx < GetNumScriptedInterfaces(); idx++) {
2136 if (!instance)
2137 continue;
2138 // Filter to the requested language when the caller pinned one via
2139 // `-l`. `eScriptLanguageUnknown` means "no filter".
2140 if (language != lldb::eScriptLanguageUnknown &&
2141 instance->language != language)
2142 continue;
2143 llvm::StringLiteral extension_name =
2144 ScriptInterpreter::ExtensionToString(instance->extension);
2145 if (!extension_name.starts_with(name))
2146 continue;
2147 // A single extension can back multiple languages, so dedup entries
2148 // we've already surfaced.
2149 if (emitted.insert(extension_name).second)
2150 request.AddCompletion(extension_name);
2151 }
2152}
2153
2154#pragma mark REPL
2155
2164
2166
2168 static REPLInstances g_instances;
2169 return g_instances;
2170}
2171
2172bool PluginManager::RegisterPlugin(llvm::StringRef name,
2173 llvm::StringRef description,
2174 REPLCreateInstance create_callback,
2175 LanguageSet supported_languages) {
2176 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2177 supported_languages);
2178}
2179
2181 return GetREPLInstances().UnregisterPlugin(create_callback);
2182}
2183
2184llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2185 auto instances = GetREPLInstances().GetSnapshot();
2186 llvm::SmallVector<REPLCallbacks> result;
2187 result.reserve(instances.size());
2188 for (auto &instance : instances)
2189 result.push_back({instance.create_callback, instance.supported_languages});
2190 return result;
2191}
2192
2194 const auto instances = GetREPLInstances().GetSnapshot();
2195 LanguageSet all;
2196 for (unsigned i = 0; i < instances.size(); ++i)
2197 all.bitvector |= instances[i].supported_languages.bitvector;
2198 return all;
2199}
2200
2201#pragma mark Highlighter
2202
2203struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2208};
2209
2211
2213 static HighlighterInstances g_instances;
2214 return g_instances;
2215}
2216
2217bool PluginManager::RegisterPlugin(llvm::StringRef name,
2218 llvm::StringRef description,
2219 HighlighterCreateInstance create_callback) {
2220 return GetHighlighterInstances().RegisterPlugin(name, description,
2221 create_callback);
2222}
2223
2225 HighlighterCreateInstance create_callback) {
2226 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2227}
2228
2229llvm::SmallVector<HighlighterCreateInstance>
2233
2234#pragma mark PluginManager
2235
2250
2251// This is the preferred new way to register plugin specific settings. e.g.
2252// This will put a plugin's settings under e.g.
2253// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2255 Debugger &debugger, llvm::StringRef plugin_type_name,
2256 llvm::StringRef plugin_type_desc, bool can_create) {
2257 lldb::OptionValuePropertiesSP parent_properties_sp(
2258 debugger.GetValueProperties());
2259 if (parent_properties_sp) {
2260 static constexpr llvm::StringLiteral g_property_name("plugin");
2261
2262 OptionValuePropertiesSP plugin_properties_sp =
2263 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2264 if (!plugin_properties_sp && can_create) {
2265 plugin_properties_sp =
2266 std::make_shared<OptionValueProperties>(g_property_name);
2267 plugin_properties_sp->SetExpectedPath("plugin");
2268 parent_properties_sp->AppendProperty(g_property_name,
2269 "Settings specify to plugins.", true,
2270 plugin_properties_sp);
2271 }
2272
2273 if (plugin_properties_sp) {
2274 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2275 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2276 if (!plugin_type_properties_sp && can_create) {
2277 plugin_type_properties_sp =
2278 std::make_shared<OptionValueProperties>(plugin_type_name);
2279 plugin_type_properties_sp->SetExpectedPath(
2280 ("plugin." + plugin_type_name).str());
2281 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2282 true, plugin_type_properties_sp);
2283 }
2284 return plugin_type_properties_sp;
2285 }
2286 }
2288}
2289
2290// This is deprecated way to register plugin specific settings. e.g.
2291// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2292// generic settings would be under "platform.SETTINGNAME".
2294 Debugger &debugger, llvm::StringRef plugin_type_name,
2295 llvm::StringRef plugin_type_desc, bool can_create) {
2296 static constexpr llvm::StringLiteral g_property_name("plugin");
2297 lldb::OptionValuePropertiesSP parent_properties_sp(
2298 debugger.GetValueProperties());
2299 if (parent_properties_sp) {
2300 OptionValuePropertiesSP plugin_properties_sp =
2301 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2302 if (!plugin_properties_sp && can_create) {
2303 plugin_properties_sp =
2304 std::make_shared<OptionValueProperties>(plugin_type_name);
2305 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2306 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2307 true, plugin_properties_sp);
2308 }
2309
2310 if (plugin_properties_sp) {
2311 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2312 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2313 if (!plugin_type_properties_sp && can_create) {
2314 plugin_type_properties_sp =
2315 std::make_shared<OptionValueProperties>(g_property_name);
2316 plugin_type_properties_sp->SetExpectedPath(
2317 (plugin_type_name + ".plugin").str());
2318 plugin_properties_sp->AppendProperty(g_property_name,
2319 "Settings specific to plugins",
2320 true, plugin_type_properties_sp);
2321 }
2322 return plugin_type_properties_sp;
2323 }
2324 }
2326}
2327
2328namespace {
2329
2331GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2332 bool can_create);
2333}
2334
2336GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2337 llvm::StringRef plugin_type_name,
2338 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2340 lldb::OptionValuePropertiesSP properties_sp;
2341 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2342 debugger, plugin_type_name,
2343 "", // not creating to so we don't need the description
2344 false));
2345 if (plugin_type_properties_sp)
2346 properties_sp =
2347 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2348 return properties_sp;
2349}
2350
2351static bool
2352CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2353 llvm::StringRef plugin_type_desc,
2354 const lldb::OptionValuePropertiesSP &properties_sp,
2355 llvm::StringRef description, bool is_global_property,
2356 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2358 if (properties_sp) {
2359 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2360 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2361 true));
2362 if (plugin_type_properties_sp) {
2363 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2364 description, is_global_property,
2365 properties_sp);
2366 return true;
2367 }
2368 }
2369 return false;
2370}
2371
2372static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2373static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2374static constexpr llvm::StringLiteral kProcessPluginName("process");
2375static constexpr llvm::StringLiteral kTracePluginName("trace");
2376static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2377static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2378static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2379static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2380static constexpr llvm::StringLiteral
2381 kStructuredDataPluginName("structured-data");
2382static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2383
2386 llvm::StringRef setting_name) {
2387 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2388}
2389
2391 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2392 llvm::StringRef description, bool is_global_property) {
2394 "Settings for dynamic loader plug-ins",
2395 properties_sp, description, is_global_property);
2396}
2397
2400 llvm::StringRef setting_name) {
2401 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2403}
2404
2406 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2407 llvm::StringRef description, bool is_global_property) {
2409 "Settings for platform plug-ins", properties_sp,
2410 description, is_global_property,
2412}
2413
2416 llvm::StringRef setting_name) {
2417 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2418}
2419
2421 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2422 llvm::StringRef description, bool is_global_property) {
2424 "Settings for process plug-ins", properties_sp,
2425 description, is_global_property);
2426}
2427
2430 llvm::StringRef setting_name) {
2431 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2432}
2433
2435 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2436 llvm::StringRef description, bool is_global_property) {
2438 "Settings for symbol locator plug-ins",
2439 properties_sp, description, is_global_property);
2440}
2441
2443 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2444 llvm::StringRef description, bool is_global_property) {
2446 "Settings for trace plug-ins", properties_sp,
2447 description, is_global_property);
2448}
2449
2452 llvm::StringRef setting_name) {
2453 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2454}
2455
2457 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2458 llvm::StringRef description, bool is_global_property) {
2460 "Settings for object file plug-ins",
2461 properties_sp, description, is_global_property);
2462}
2463
2466 llvm::StringRef setting_name) {
2467 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2468}
2469
2471 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2472 llvm::StringRef description, bool is_global_property) {
2474 "Settings for symbol file plug-ins",
2475 properties_sp, description, is_global_property);
2476}
2477
2480 llvm::StringRef setting_name) {
2481 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2482}
2483
2485 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2486 llvm::StringRef description, bool is_global_property) {
2488 "Settings for JIT loader plug-ins",
2489 properties_sp, description, is_global_property);
2490}
2491
2492static const char *kOperatingSystemPluginName("os");
2493
2495 Debugger &debugger, llvm::StringRef setting_name) {
2496 lldb::OptionValuePropertiesSP properties_sp;
2497 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2500 "", // not creating to so we don't need the description
2501 false));
2502 if (plugin_type_properties_sp)
2503 properties_sp =
2504 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2505 return properties_sp;
2506}
2507
2509 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2510 llvm::StringRef description, bool is_global_property) {
2511 if (properties_sp) {
2512 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2514 "Settings for operating system plug-ins",
2515 true));
2516 if (plugin_type_properties_sp) {
2517 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2518 description, is_global_property,
2519 properties_sp);
2520 return true;
2521 }
2522 }
2523 return false;
2524}
2525
2528 llvm::StringRef setting_name) {
2529 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2530}
2531
2533 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2534 llvm::StringRef description, bool is_global_property) {
2536 "Settings for structured data plug-ins",
2537 properties_sp, description, is_global_property);
2538}
2539
2542 Debugger &debugger, llvm::StringRef setting_name) {
2543 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2544}
2545
2547 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2548 llvm::StringRef description, bool is_global_property) {
2550 "Settings for CPlusPlus language plug-ins",
2551 properties_sp, description, is_global_property);
2552}
2553
2554//
2555// Plugin Info+Enable Implementations
2556//
2557llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2559}
2560bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2561 return GetABIInstances().SetInstanceEnabled(name, enable);
2562}
2563
2564llvm::SmallVector<RegisteredPluginInfo>
2569 bool enable) {
2570 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2571}
2572
2573llvm::SmallVector<RegisteredPluginInfo>
2578 bool enable) {
2579 return GetBugReporterInstances().SetInstanceEnabled(name, enable);
2580}
2581
2582llvm::SmallVector<RegisteredPluginInfo>
2587 bool enable) {
2588 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2589}
2590
2591llvm::SmallVector<RegisteredPluginInfo>
2596 bool enable) {
2597 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2598}
2599
2600llvm::SmallVector<RegisteredPluginInfo>
2605 bool enable) {
2607}
2608
2609llvm::SmallVector<RegisteredPluginInfo>
2613
2615 switch (kind) {
2617 return "global";
2619 return "debugger";
2621 return "target";
2622 }
2623 llvm_unreachable("unhandled PluginDomainKind");
2624}
2625
2627 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2628 PluginDomainKind domain) {
2629 if (domain != lldb::ePluginDomainKindGlobal)
2630 return llvm::createStringErrorV("{} domain is not supported",
2631 PluginDomainKindToStr(domain));
2632 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2633 return llvm::createStringError("plugin could not be found");
2634
2635 return llvm::Error::success();
2636}
2637
2638llvm::SmallVector<RegisteredPluginInfo>
2643 bool enable) {
2644 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2645}
2646
2647llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2649}
2651 bool enable) {
2652 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2653}
2654
2655llvm::SmallVector<RegisteredPluginInfo>
2660 bool enable) {
2661 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2662}
2663
2664llvm::SmallVector<RegisteredPluginInfo>
2669 bool enable) {
2670 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2671}
2672
2673llvm::SmallVector<RegisteredPluginInfo>
2678 bool enable) {
2679 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2680}
2681
2682llvm::SmallVector<RegisteredPluginInfo>
2687 bool enable) {
2688 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2689}
2690
2691llvm::SmallVector<RegisteredPluginInfo>
2696 bool enable) {
2697 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2698}
2699
2700llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2702}
2704 bool enable) {
2705 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2706}
2707
2708llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2710}
2711bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2712 return GetProcessInstances().SetInstanceEnabled(name, enable);
2713}
2714
2715llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2717}
2718bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2719 return GetREPLInstances().SetInstanceEnabled(name, enable);
2720}
2721
2722llvm::SmallVector<RegisteredPluginInfo>
2727 bool enable) {
2729}
2730
2731llvm::SmallVector<RegisteredPluginInfo>
2736 bool enable) {
2738}
2739
2740llvm::SmallVector<RegisteredPluginInfo>
2745 bool enable) {
2747}
2748
2749llvm::SmallVector<RegisteredPluginInfo>
2754 bool enable) {
2756}
2757
2758llvm::SmallVector<RegisteredPluginInfo>
2763 bool enable) {
2764 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2765}
2766
2767llvm::SmallVector<RegisteredPluginInfo>
2772 bool enable) {
2773 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2774}
2775
2776llvm::SmallVector<RegisteredPluginInfo>
2781 bool enable) {
2782 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2783}
2784
2785llvm::SmallVector<RegisteredPluginInfo>
2790 bool enable) {
2791 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2792}
2793
2794llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2796}
2797bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2798 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2799}
2800
2801llvm::SmallVector<RegisteredPluginInfo>
2806 bool enable) {
2807 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2808}
2809
2810llvm::SmallVector<RegisteredPluginInfo>
2815 bool enable) {
2816 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2817}
2818
2819llvm::SmallVector<RegisteredPluginInfo>
2824 bool enable) {
2825 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2826}
2827
2829 CompletionRequest &request) {
2830 // Split the name into the namespace and the plugin name.
2831 // If there is no dot then the ns_name will be equal to name and
2832 // plugin_prefix will be empty.
2833 llvm::StringRef ns_name, plugin_prefix;
2834 std::tie(ns_name, plugin_prefix) = name.split('.');
2835
2836 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2837 // If the plugin namespace matches exactly then
2838 // add all the plugins in this namespace as completions if the
2839 // plugin names starts with the plugin_prefix. If the plugin_prefix
2840 // is empty then it will match all the plugins (empty string is a
2841 // prefix of everything).
2842 if (plugin_ns.name == ns_name) {
2843 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2844 llvm::SmallString<128> buf;
2845 if (plugin.name.starts_with(plugin_prefix))
2846 request.AddCompletion(
2847 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2848 }
2849 } else if (plugin_ns.name.starts_with(name) &&
2850 !plugin_ns.get_info().empty()) {
2851 // Otherwise check if the namespace is a prefix of the full name.
2852 // Use a partial completion here so that we can either operate on the full
2853 // namespace or tab-complete to the next level.
2854 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2855 }
2856 }
2857}
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:871
#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:100
A class that measures elapsed time in an exception safe way.
Definition Statistics.h:76
A file collection class.
A file utility class.
Definition FileSpec.h:57
llvm::StringRef GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:412
llvm::StringRef GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:249
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:376
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp:408
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultEnter
Recurse into the current entry if it is a directory or symlink, or next if not.
Definition FileSystem.h:185
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
Definition FileSystem.h:182
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool SetArchitecturePluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static bool SetPlatformPluginEnabled(llvm::StringRef name, bool enable)
static bool SetScriptInterpreterPluginEnabled(llvm::StringRef name, bool enable)
static bool MatchPluginName(llvm::StringRef pattern, const PluginNamespace &plugin_ns, const RegisteredPluginInfo &plugin)
static lldb::OptionValuePropertiesSP GetSettingForStructuredDataPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetMemoryHistoryPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetSystemRuntimePluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetTypeSystemPluginInfo()
static 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
LanguageSet supported_languages_for_types
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39