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
11#include "lldb/Core/Debugger.h"
13#include "lldb/Host/HostInfo.h"
16#include "lldb/Target/Process.h"
18#include "lldb/Utility/Status.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/ADT/Twine.h"
22#include "llvm/Support/DynamicLibrary.h"
23#include "llvm/Support/ErrorExtras.h"
24#include "llvm/Support/FileSystem.h"
25#include "llvm/Support/raw_ostream.h"
26#include <cassert>
27#include <memory>
28#include <mutex>
29#include <string>
30#include <utility>
31#if defined(_WIN32)
33#endif
34
35using namespace lldb;
36using namespace lldb_private;
37
39typedef void (*PluginTermCallback)();
40
41struct PluginInfo {
42 PluginInfo() = default;
43
44 PluginInfo(const PluginInfo &) = delete;
45 PluginInfo &operator=(const PluginInfo &) = delete;
46
48 : library(std::move(other.library)),
50 std::exchange(other.plugin_init_callback, nullptr)),
52 std::exchange(other.plugin_term_callback, nullptr)) {}
53
55 library = std::move(other.library);
56 plugin_init_callback = std::exchange(other.plugin_init_callback, nullptr);
57 plugin_term_callback = std::exchange(other.plugin_term_callback, nullptr);
58 return *this;
59 }
60
62 if (!library.isValid())
63 return;
65 return;
67 }
68
69 static llvm::Expected<PluginInfo> Create(const FileSpec &path);
70
71private:
72 llvm::sys::DynamicLibrary library;
75};
76
77typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap;
78
79namespace {
80enum class PluginLifecycle { Uninitialized, Initialized, Terminated };
81
82struct PluginRegistry {
83 std::recursive_mutex mutex;
85
86 void Initialize() {
87 std::lock_guard<std::recursive_mutex> guard(mutex);
88 lifecycle = PluginLifecycle::Initialized;
89 }
90
91 void Terminate() {
92 std::lock_guard<std::recursive_mutex> guard(mutex);
93 lifecycle = PluginLifecycle::Terminated;
94 map.clear();
95 }
96
97 // Only after Terminate() is a leftover PluginInstances registration a bug;
98 // exiting in any other state (e.g. `import lldb`, which never calls
99 // Terminate()) is supported and leaves plugins registered.
100 bool IsTerminated() const { return lifecycle == PluginLifecycle::Terminated; }
101
102private:
103 PluginLifecycle lifecycle = PluginLifecycle::Uninitialized;
104};
105} // namespace
106
107// Never destroyed: at static-destruction time the PluginInstances containers
108// (separate statics, arbitrary teardown order) still call IsTerminated(), and
109// the map's PluginInfo terminate callbacks must not run when the containers
110// they unregister from may already be gone. Terminate() clears the map
111// explicitly while everything is alive. The static pointer keeps it reachable,
112// so this is not a LeakSanitizer leak.
113static PluginRegistry &GetPluginRegistry() {
114 static PluginRegistry *g_registry = new PluginRegistry();
115 return *g_registry;
116}
117
118static std::recursive_mutex &GetPluginMapMutex() {
119 return GetPluginRegistry().mutex;
120}
121
123
124static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
125 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
126 return GetPluginMap().contains(plugin_file_spec);
127}
128
129static void SetPluginInfo(const FileSpec &plugin_file_spec,
130 PluginInfo plugin_info) {
131 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
132 DynamicPluginMap &plugin_map = GetPluginMap();
133 assert(!plugin_map.contains(plugin_file_spec));
134 plugin_map.try_emplace(plugin_file_spec, std::move(plugin_info));
135}
136
137template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
138 return reinterpret_cast<FPtrTy>(VPtr);
139}
140
141static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin";
142struct PluginDir {
144 /// Try to load anything that looks like a shared library.
146
147 /// Only load shared libraries who's filename start with g_plugin_prefix.
149 };
150
153
154 explicit operator bool() const { return FileSystem::Instance().Exists(path); }
155
156 /// The path to the plugin directory.
158
159 /// Filter when looking for plugins.
161};
162
163llvm::Expected<PluginInfo> PluginInfo::Create(const FileSpec &path) {
164 PluginInfo plugin_info;
165 std::string error;
166 plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
167 path.GetPath().c_str(), &error);
168 if (!plugin_info.library.isValid())
169 return llvm::createStringError(error);
170
171 // Look for files that follow the convention <g_plugin_prefix><name>.<ext>, in
172 // which case we need to call lldb_initialize_<name> and
173 // lldb_terminate_<name>.
174 llvm::StringRef file_name = path.GetFileNameStrippingExtension();
175 if (file_name.starts_with(g_plugin_prefix)) {
176 llvm::StringRef plugin_name = file_name.substr(g_plugin_prefix.size());
177 std::string init_symbol =
178 llvm::Twine("lldb_initialize_" + plugin_name).str();
179
180 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
181 plugin_info.library.getAddressOfSymbol(init_symbol.c_str()))) {
182 if (!init_fn())
183 return llvm::createStringErrorV("initializer '{0}' returned false",
184 init_symbol);
185 const std::string term_symbol =
186 llvm::Twine("lldb_terminate_" + plugin_name).str();
188 plugin_info.library.getAddressOfSymbol(term_symbol.c_str()));
189 }
190 return plugin_info;
191 }
192
193 // Look for the legacy LLDBPluginInitialize/LLDBPluginTerminate symbols.
194 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
195 plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"))) {
196 if (!init_fn())
197 return llvm::createStringError(
198 "initializer 'LLDBPluginInitialize' returned false");
199
200 plugin_info.plugin_init_callback = init_fn;
202 plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
203 return plugin_info;
204 }
205
206 return llvm::createStringError("no initialize symbol found");
207}
208
210LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
211 llvm::StringRef path) {
212 namespace fs = llvm::sys::fs;
213
214 static constexpr std::array<llvm::StringLiteral, 3>
215 g_shared_library_extension = {".dylib", ".so", ".dll"};
216
217 // If we have a regular file, a symbolic link or unknown file type, try and
218 // process the file. We must handle unknown as sometimes the directory
219 // enumeration might be enumerating a file system that doesn't have correct
220 // file type information.
221 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
222 ft == fs::file_type::type_unknown) {
223 FileSpec plugin_file_spec(path);
224 FileSystem::Instance().Resolve(plugin_file_spec);
225
226 // Don't try to load unknown extensions.
227 if (!llvm::is_contained(g_shared_library_extension,
228 plugin_file_spec.GetFileNameExtension()))
230
231 // Don't try to load libraries that don't start with g_plugin_prefix if so
232 // requested.
234 if (*policy == PluginDir::LoadOnlyWithLLDBPrefix &&
235 !plugin_file_spec.GetFilename().GetStringRef().starts_with(
238
239 // Don't try to load an already loaded plugin again.
240 if (PluginIsLoaded(plugin_file_spec))
242
243 llvm::Expected<PluginInfo> plugin_info =
244 PluginInfo::Create(plugin_file_spec);
245 if (plugin_info) {
246 SetPluginInfo(plugin_file_spec, std::move(*plugin_info));
247 } else {
248 // Cache an empty plugin info so we don't try to load it again and again.
249 SetPluginInfo(plugin_file_spec, PluginInfo());
250
251 LLDB_LOG_ERROR(GetLog(LLDBLog::Host), plugin_info.takeError(),
252 "could not load plugin: {0}");
253 }
254
256 }
257
258 if (ft == fs::file_type::directory_file ||
259 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
260 // Try and recurse into anything that a directory or symbolic link. We must
261 // also do this for unknown as sometimes the directory enumeration might be
262 // enumerating a file system that doesn't have correct file type
263 // information.
265 }
266
268}
269
271 GetPluginRegistry().Initialize();
272
273 static const bool find_directories = true;
274 static const bool find_files = true;
275 static const bool find_other = true;
276
277 // Directories to scan for plugins. Unlike the plugin directories, which are
278 // meant exclusively for LLDB, the shared library directory is likely to
279 // contain unrelated shared libraries that we do not want to load. Therefore,
280 // limit the scan to libraries that start with g_plugin_prefix.
281 const std::array<PluginDir, 3> plugin_dirs = {
282 PluginDir(HostInfo::GetShlibDir(), PluginDir::LoadOnlyWithLLDBPrefix),
283 PluginDir(HostInfo::GetSystemPluginDir(), PluginDir::LoadAnyDylib),
284 PluginDir(HostInfo::GetUserPluginDir(), PluginDir::LoadAnyDylib)};
285
286 for (const PluginDir &plugin_dir : plugin_dirs) {
287 if (plugin_dir) {
289 plugin_dir.path.GetPath().c_str(), find_directories, find_files,
290 find_other, LoadPluginCallback, (void *)&plugin_dir.policy);
291 }
292 }
293}
294
296
297llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
298 static PluginNamespace PluginNamespaces[] = {
299
300 {
301 "abi",
304 },
305
306 {
307 "architecture",
310 },
311
312 {
313 "disassembler",
316 },
317
318 {
319 "dynamic-loader",
322 },
323
324 {
325 "emulate-instruction",
328 },
329
330 {
331 "instrumentation-runtime",
334 },
335
336 {
337 "jit-loader",
340 },
341
342 {
343 "language",
346 },
347
348 {
349 "language-runtime",
352 },
353
354 {
355 "memory-history",
358 },
359
360 {
361 "object-container",
364 },
365
366 {
367 "object-file",
370 },
371
372 {
373 "operating-system",
376 },
377
378 {
379 "platform",
382 },
383
384 {
385 "process",
388 },
389
390 {
391 "repl",
394 },
395
396 {
397 "register-type-builder",
400 },
401
402 {
403 "script-interpreter",
406 },
407
408 {
409 "scripted-interface",
412 },
413
414 {
415 "structured-data",
418 },
419
420 {
421 "symbol-file",
424 },
425
426 {
427 "symbol-locator",
430 },
431
432 {
433 "symbol-vendor",
436 },
437
438 {
439 "system-runtime",
442 },
443
444 {
445 "trace",
448 },
449
450 {
451 "trace-exporter",
454 },
455
456 {
457 "type-system",
460 },
461
462 {
463 "unwind-assembly",
466 },
467 };
468
469 return PluginNamespaces;
470}
471
472llvm::json::Object PluginManager::GetJSON(llvm::StringRef pattern) {
473 llvm::json::Object plugin_stats;
474
475 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
476 llvm::json::Array namespace_stats;
477
478 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
479 if (MatchPluginName(pattern, plugin_ns, plugin)) {
480 llvm::json::Object plugin_json;
481 plugin_json.try_emplace("name", plugin.name);
482 plugin_json.try_emplace("enabled", plugin.enabled);
483 namespace_stats.emplace_back(std::move(plugin_json));
484 }
485 }
486 if (!namespace_stats.empty())
487 plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
488 }
489
490 return plugin_stats;
491}
492
493bool PluginManager::MatchPluginName(llvm::StringRef pattern,
494 const PluginNamespace &plugin_ns,
495 const RegisteredPluginInfo &plugin_info) {
496 // The empty pattern matches all plugins.
497 if (pattern.empty())
498 return true;
499
500 // Check if the pattern matches the namespace.
501 if (pattern == plugin_ns.name)
502 return true;
503
504 // Check if the pattern matches the qualified name.
505 std::string qualified_name = (plugin_ns.name + "." + plugin_info.name).str();
506 return pattern == qualified_name;
507}
508
509template <typename Callback> struct PluginInstance {
510 typedef Callback CallbackType;
511
512 PluginInstance() = default;
519
520 llvm::StringRef name;
521 llvm::StringRef description;
525};
526
527template <typename Instance> class PluginInstances {
528public:
530 // Only meaningful after a real teardown; see PluginRegistry::IsTerminated.
531 if (!GetPluginRegistry().IsTerminated())
532 return;
533#ifndef NDEBUG
534 for (const auto &instance : m_instances)
535 llvm::errs() << llvm::formatv("Use `image lookup -va {0:x}` to find out "
536 "which callback was not removed\n",
537 instance.create_callback);
538#endif
539 assert(m_instances.empty() && "forgot to unregister plugin?");
540 }
541
542 template <typename... Args>
543 bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
544 typename Instance::CallbackType callback,
545 Args &&...args) {
546 if (!callback)
547 return false;
548 assert(!name.empty());
549
550 std::lock_guard<std::mutex> guard(m_mutex);
551 m_instances.emplace_back(name, description, callback,
552 std::forward<Args>(args)...);
553 return true;
554 }
555
556 bool UnregisterPlugin(typename Instance::CallbackType callback) {
557 if (!callback)
558 return false;
559
560 std::lock_guard<std::mutex> guard(m_mutex);
561 auto pos = m_instances.begin();
562 auto end = m_instances.end();
563 for (; pos != end; ++pos) {
564 if (pos->create_callback == callback) {
565 m_instances.erase(pos);
566 return true;
567 }
568 }
569 return false;
570 }
571
572 llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
573 if (auto instance = GetInstanceAtIndex(idx))
574 return instance->description;
575 return "";
576 }
577
578 llvm::StringRef GetNameAtIndex(uint32_t idx) {
579 if (auto instance = GetInstanceAtIndex(idx))
580 return instance->name;
581 return "";
582 }
583
584 typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
585 if (auto instance = GetInstanceForName(name))
586 return instance->create_callback;
587 return nullptr;
588 }
589
590 llvm::SmallVector<typename Instance::CallbackType> GetCreateCallbacks() {
591 llvm::SmallVector<Instance> snapshot = GetSnapshot();
592 llvm::SmallVector<typename Instance::CallbackType> result;
593 result.reserve(snapshot.size());
594 for (const auto &instance : snapshot)
595 result.push_back(instance.create_callback);
596 return result;
597 }
598
600 for (const auto &instance : GetSnapshot()) {
601 if (instance.debugger_init_callback)
602 instance.debugger_init_callback(debugger);
603 }
604 }
605
606 // Return a copy of all the enabled instances.
607 // Note that this is a copy of the internal state so modifications
608 // to the returned instances will not be reflected back to instances
609 // stored by the PluginInstances object.
610 llvm::SmallVector<Instance> GetSnapshot(bool enabled_only = true) const {
611 std::lock_guard<std::mutex> guard(m_mutex);
612
613 llvm::SmallVector<Instance> enabled_instances;
614 enabled_instances.reserve(m_instances.size());
615 for (const auto &instance : m_instances) {
616 if (!enabled_only || instance.enabled)
617 enabled_instances.push_back(instance);
618 }
619 return enabled_instances;
620 }
621
622 std::optional<Instance> GetInstanceAtIndex(uint32_t idx) {
623 uint32_t count = 0;
624
625 return FindEnabledInstance(
626 [&](const Instance &instance) { return count++ == idx; });
627 }
628
629 std::optional<Instance> GetInstanceForName(llvm::StringRef name,
630 bool enabled_only = true) {
631 if (name.empty())
632 return std::nullopt;
633
634 auto predicate = [&](const Instance &instance) {
635 return instance.name == name;
636 };
637 if (enabled_only)
638 return FindEnabledInstance(predicate);
639
640 return FindInstance(predicate);
641 }
642
643 std::optional<Instance>
644 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
645 for (const auto &instance : GetSnapshot()) {
646 if (predicate(instance))
647 return instance;
648 }
649 return std::nullopt;
650 }
651
652 std::optional<Instance>
653 FindInstance(std::function<bool(const Instance &)> predicate) const {
654 std::lock_guard<std::mutex> guard(m_mutex);
655 for (const auto &instance : m_instances) {
656 if (predicate(instance))
657 return instance;
658 }
659 return std::nullopt;
660 }
661
662 // Return a list of all the registered plugin instances. This includes both
663 // enabled and disabled instances. The instances are listed in the order they
664 // were registered which is the order they would be queried if they were all
665 // enabled.
666 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
667 std::lock_guard<std::mutex> guard(m_mutex);
668
669 // Lookup the plugin info for each instance in the sorted order.
670 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
671 plugin_infos.reserve(m_instances.size());
672
673 for (const Instance &instance : m_instances)
674 plugin_infos.push_back(
675 {instance.name, instance.description, instance.enabled});
676
677 return plugin_infos;
678 }
679
680 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
681 std::lock_guard<std::mutex> guard(m_mutex);
682 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
683 return instance.name == name;
684 });
685
686 if (it == m_instances.end())
687 return false;
688
689 it->enabled = enable;
690 return true;
691 }
692
693private:
694 mutable std::mutex m_mutex;
695 llvm::SmallVector<Instance> m_instances;
696};
697
698#pragma mark ABI
699
702
704 static ABIInstances g_instances;
705 return g_instances;
706}
707
708bool PluginManager::RegisterPlugin(llvm::StringRef name,
709 llvm::StringRef description,
710 ABICreateInstance create_callback) {
711 return GetABIInstances().RegisterPlugin(name, description, create_callback);
712}
713
715 return GetABIInstances().UnregisterPlugin(create_callback);
716}
717
718llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
720}
721
722#pragma mark Architecture
723
726
728 static ArchitectureInstances g_instances;
729 return g_instances;
730}
731
732void PluginManager::RegisterPlugin(llvm::StringRef name,
733 llvm::StringRef description,
734 ArchitectureCreateInstance create_callback) {
735 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
736}
737
739 ArchitectureCreateInstance create_callback) {
740 auto &instances = GetArchitectureInstances();
741 instances.UnregisterPlugin(create_callback);
742}
743
744std::unique_ptr<Architecture>
746 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
747 if (auto plugin_up = instances.create_callback(arch))
748 return plugin_up;
749 }
750 return nullptr;
751}
752
753#pragma mark Disassembler
754
757
759 static DisassemblerInstances g_instances;
760 return g_instances;
761}
762
763bool PluginManager::RegisterPlugin(llvm::StringRef name,
764 llvm::StringRef description,
765 DisassemblerCreateInstance create_callback) {
766 return GetDisassemblerInstances().RegisterPlugin(name, description,
767 create_callback);
768}
769
771 DisassemblerCreateInstance create_callback) {
772 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
773}
774
775llvm::SmallVector<DisassemblerCreateInstance>
779
785
786#pragma mark DynamicLoader
787
790
792 static DynamicLoaderInstances g_instances;
793 return g_instances;
794}
795
797 llvm::StringRef name, llvm::StringRef description,
798 DynamicLoaderCreateInstance create_callback,
799 DebuggerInitializeCallback debugger_init_callback) {
801 name, description, create_callback, debugger_init_callback);
802}
803
805 DynamicLoaderCreateInstance create_callback) {
806 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
807}
808
809llvm::SmallVector<DynamicLoaderCreateInstance>
813
819
820#pragma mark JITLoader
821
824
826 static JITLoaderInstances g_instances;
827 return g_instances;
828}
829
831 llvm::StringRef name, llvm::StringRef description,
832 JITLoaderCreateInstance create_callback,
833 DebuggerInitializeCallback debugger_init_callback) {
835 name, description, create_callback, debugger_init_callback);
836}
837
839 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
840}
841
842llvm::SmallVector<JITLoaderCreateInstance>
846
847#pragma mark EmulateInstruction
848
852
854 static EmulateInstructionInstances g_instances;
855 return g_instances;
856}
857
859 llvm::StringRef name, llvm::StringRef description,
860 EmulateInstructionCreateInstance create_callback) {
861 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
862 create_callback);
863}
864
869
870llvm::SmallVector<EmulateInstructionCreateInstance>
874
880
881#pragma mark OperatingSystem
882
885
887 static OperatingSystemInstances g_instances;
888 return g_instances;
889}
890
892 llvm::StringRef name, llvm::StringRef description,
893 OperatingSystemCreateInstance create_callback,
894 DebuggerInitializeCallback debugger_init_callback) {
896 name, description, create_callback, debugger_init_callback);
897}
898
903
904llvm::SmallVector<OperatingSystemCreateInstance>
908
914
915#pragma mark Language
916
919
921 static LanguageInstances g_instances;
922 return g_instances;
923}
924
926 llvm::StringRef name, llvm::StringRef description,
927 LanguageCreateInstance create_callback,
928 DebuggerInitializeCallback debugger_init_callback) {
930 name, description, create_callback, debugger_init_callback);
931}
932
934 return GetLanguageInstances().UnregisterPlugin(create_callback);
935}
936
937llvm::SmallVector<LanguageCreateInstance>
941
942#pragma mark LanguageRuntime
943
960
962
964 static LanguageRuntimeInstances g_instances;
965 return g_instances;
966}
967
969 llvm::StringRef name, llvm::StringRef description,
970 LanguageRuntimeCreateInstance create_callback,
971 LanguageRuntimeGetCommandObject command_callback,
972 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
974 name, description, create_callback, nullptr, command_callback,
975 precondition_callback);
976}
977
982
983llvm::SmallVector<LanguageRuntimeCallbacks>
985 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
986 llvm::SmallVector<LanguageRuntimeCallbacks> result;
987 result.reserve(instances.size());
988 for (auto &instance : instances)
989 result.push_back({instance.create_callback, instance.command_callback,
990 instance.precondition_callback});
991 return result;
992}
993
994#pragma mark SystemRuntime
995
998
1000 static SystemRuntimeInstances g_instances;
1001 return g_instances;
1002}
1003
1005 llvm::StringRef name, llvm::StringRef description,
1006 SystemRuntimeCreateInstance create_callback) {
1007 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
1008 create_callback);
1009}
1010
1012 SystemRuntimeCreateInstance create_callback) {
1013 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
1014}
1015
1016llvm::SmallVector<SystemRuntimeCreateInstance>
1020
1021#pragma mark ObjectFile
1022
1042
1044 static ObjectFileInstances g_instances;
1045 return g_instances;
1046}
1047
1049 if (name.empty())
1050 return false;
1051
1052 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1053}
1054
1056 llvm::StringRef name, llvm::StringRef description,
1057 ObjectFileCreateInstance create_callback,
1058 ObjectFileCreateMemoryInstance create_memory_callback,
1059 ObjectFileGetModuleSpecifications get_module_specifications,
1060 ObjectFileSaveCore save_core,
1061 DebuggerInitializeCallback debugger_init_callback) {
1063 name, description, create_callback, create_memory_callback,
1064 get_module_specifications, save_core, debugger_init_callback);
1065}
1066
1068 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1069}
1070
1071llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1072 auto instances = GetObjectFileInstances().GetSnapshot();
1073 llvm::SmallVector<ObjectFileCallbacks> result;
1074 result.reserve(instances.size());
1075 for (auto &instance : instances)
1076 result.push_back({instance.create_callback, instance.create_memory_callback,
1077 instance.get_module_specifications, instance.save_core});
1078 return result;
1079}
1080
1083 llvm::StringRef name) {
1084 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1085 return instance->create_memory_callback;
1086 return nullptr;
1087}
1088
1090 Status error;
1091 if (!options.GetOutputFile()) {
1092 error = Status::FromErrorString("No output file specified");
1093 return error;
1094 }
1095
1096 if (!options.GetProcess()) {
1097 error = Status::FromErrorString("Invalid process");
1098 return error;
1099 }
1100
1101 error = options.EnsureValidConfiguration();
1102 if (error.Fail())
1103 return error;
1104
1105 if (!options.GetPluginName().has_value()) {
1106 // Try saving core directly from the process plugin first.
1107 llvm::Expected<bool> ret =
1108 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1109 if (!ret)
1110 return Status::FromError(ret.takeError());
1111 if (ret.get())
1112 return Status();
1113 }
1114
1115 // Fall back to object plugins.
1116 const auto &plugin_name = options.GetPluginName().value_or("");
1117 auto instances = GetObjectFileInstances().GetSnapshot();
1118 for (auto &instance : instances) {
1119 if (plugin_name.empty() || instance.name == plugin_name) {
1120 // TODO: Refactor the instance.save_core() to not require a process and
1121 // get it from options instead.
1122 if (instance.save_core &&
1123 instance.save_core(options.GetProcess(), options, error))
1124 return error;
1125 }
1126 }
1127
1128 // Check to see if any of the object file plugins tried and failed to save.
1129 // if any failure, return the error message.
1130 if (error.Fail())
1131 return error;
1132
1133 // Report only for the plugin that was specified.
1134 if (!plugin_name.empty())
1136 "The \"{}\" plugin is not able to save a core for this process.",
1137 plugin_name);
1138
1140 "no ObjectFile plugins were able to save a core for this process");
1141}
1142
1143llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1144 llvm::SmallVector<llvm::StringRef> plugin_names;
1145 auto instances = GetObjectFileInstances().GetSnapshot();
1146 for (auto &instance : instances) {
1147 if (instance.save_core)
1148 plugin_names.emplace_back(instance.name);
1149 }
1150 return plugin_names;
1151}
1152
1153#pragma mark ObjectContainer
1154
1171
1173 static ObjectContainerInstances g_instances;
1174 return g_instances;
1175}
1176
1178 llvm::StringRef name, llvm::StringRef description,
1179 ObjectContainerCreateInstance create_callback,
1180 ObjectFileGetModuleSpecifications get_module_specifications,
1181 ObjectContainerCreateMemoryInstance create_memory_callback) {
1183 name, description, create_callback, create_memory_callback,
1184 get_module_specifications);
1185}
1186
1188 ObjectContainerCreateInstance create_callback) {
1189 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1190}
1191
1192llvm::SmallVector<ObjectContainerCallbacks>
1194 auto instances = GetObjectContainerInstances().GetSnapshot();
1195 llvm::SmallVector<ObjectContainerCallbacks> result;
1196 result.reserve(instances.size());
1197 for (auto &instance : instances)
1198 result.push_back({instance.create_callback, instance.create_memory_callback,
1199 instance.get_module_specifications});
1200 return result;
1201}
1202
1203#pragma mark Platform
1204
1207
1209 static PlatformInstances g_platform_instances;
1210 return g_platform_instances;
1211}
1212
1214 llvm::StringRef name, llvm::StringRef description,
1215 PlatformCreateInstance create_callback,
1216 DebuggerInitializeCallback debugger_init_callback) {
1218 name, description, create_callback, debugger_init_callback);
1219}
1220
1222 return GetPlatformInstances().UnregisterPlugin(create_callback);
1223}
1224
1225llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1227}
1228
1229llvm::StringRef
1233
1238
1239llvm::SmallVector<PlatformCreateInstance>
1243
1245 CompletionRequest &request) {
1246 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1247 if (instance.name.starts_with(name))
1248 request.AddCompletion(instance.name);
1249 }
1250}
1251
1252#pragma mark Process
1253
1256
1258 static ProcessInstances g_instances;
1259 return g_instances;
1260}
1261
1263 llvm::StringRef name, llvm::StringRef description,
1264 ProcessCreateInstance create_callback,
1265 DebuggerInitializeCallback debugger_init_callback) {
1267 name, description, create_callback, debugger_init_callback);
1268}
1269
1271 return GetProcessInstances().UnregisterPlugin(create_callback);
1272}
1273
1274llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1275 return GetProcessInstances().GetNameAtIndex(idx);
1276}
1277
1278llvm::StringRef
1282
1287
1288llvm::SmallVector<ProcessCreateInstance>
1292
1294 CompletionRequest &request) {
1295 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1296 if (instance.name.starts_with(name))
1297 request.AddCompletion(instance.name, instance.description);
1298 }
1299}
1300
1301#pragma mark ProtocolServer
1302
1305
1307 static ProtocolServerInstances g_instances;
1308 return g_instances;
1309}
1310
1312 llvm::StringRef name, llvm::StringRef description,
1313 ProtocolServerCreateInstance create_callback) {
1314 return GetProtocolServerInstances().RegisterPlugin(name, description,
1315 create_callback);
1316}
1317
1319 ProtocolServerCreateInstance create_callback) {
1320 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1321}
1322
1323llvm::StringRef
1327
1332
1333#pragma mark RegisterTypeBuilder
1334
1336 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1341};
1342
1343typedef PluginInstances<RegisterTypeBuilderInstance>
1345
1347 static RegisterTypeBuilderInstances g_instances;
1348 return g_instances;
1349}
1350
1352 llvm::StringRef name, llvm::StringRef description,
1353 RegisterTypeBuilderCreateInstance create_callback) {
1354 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1355 create_callback);
1356}
1357
1362
1365 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1366 // type and is always present.
1368 assert(instance);
1369 return instance->create_callback(target);
1370}
1371
1372#pragma mark ScriptInterpreter
1373
1387
1389
1391 static ScriptInterpreterInstances g_instances;
1392 return g_instances;
1393}
1394
1396 llvm::StringRef name, llvm::StringRef description,
1397 lldb::ScriptLanguage script_language,
1398 ScriptInterpreterCreateInstance create_callback,
1399 ScriptInterpreterGetPath get_path_callback) {
1401 name, description, create_callback, script_language, get_path_callback);
1402}
1403
1408
1409llvm::SmallVector<ScriptInterpreterCreateInstance>
1413
1416 Debugger &debugger) {
1417 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1418 ScriptInterpreterCreateInstance none_instance = nullptr;
1419 for (const auto &instance : instances) {
1420 if (instance.language == lldb::eScriptLanguageNone)
1421 none_instance = instance.create_callback;
1422
1423 if (script_lang == instance.language)
1424 return instance.create_callback(debugger);
1425 }
1426
1427 // If we didn't find one, return the ScriptInterpreter for the null language.
1428 assert(none_instance != nullptr);
1429 return none_instance(debugger);
1430}
1431
1433 lldb::ScriptLanguage script_lang) {
1434 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1435 for (const auto &instance : instances) {
1436 if (instance.language == script_lang && instance.get_path_callback)
1437 return instance.get_path_callback();
1438 }
1439 return FileSpec();
1440}
1441
1442#pragma mark SyntheticFrameProvider
1443
1452
1454 static SyntheticFrameProviderInstances g_instances;
1455 return g_instances;
1456}
1457
1459 static ScriptedFrameProviderInstances g_instances;
1460 return g_instances;
1461}
1462
1464 llvm::StringRef name, llvm::StringRef description,
1465 SyntheticFrameProviderCreateInstance create_native_callback,
1466 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1467 if (create_native_callback)
1469 name, description, create_native_callback);
1470 else if (create_scripted_callback)
1472 name, description, create_scripted_callback);
1473 return false;
1474}
1475
1480
1485
1491
1492llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1496
1497#pragma mark StructuredDataPlugin
1498
1512
1515
1517 static StructuredDataPluginInstances g_instances;
1518 return g_instances;
1519}
1520
1522 llvm::StringRef name, llvm::StringRef description,
1523 StructuredDataPluginCreateInstance create_callback,
1524 DebuggerInitializeCallback debugger_init_callback,
1525 StructuredDataFilterLaunchInfo filter_callback) {
1527 name, description, create_callback, debugger_init_callback,
1528 filter_callback);
1529}
1530
1535
1536llvm::SmallVector<StructuredDataPluginCallbacks>
1538 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1539 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1540 result.reserve(instances.size());
1541 for (auto &instance : instances)
1542 result.push_back({instance.create_callback, instance.filter_callback});
1543 return result;
1544}
1545
1546#pragma mark SymbolFile
1547
1550
1552 static SymbolFileInstances g_instances;
1553 return g_instances;
1554}
1555
1557 llvm::StringRef name, llvm::StringRef description,
1558 SymbolFileCreateInstance create_callback,
1559 DebuggerInitializeCallback debugger_init_callback) {
1561 name, description, create_callback, debugger_init_callback);
1562}
1563
1565 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1566}
1567
1568llvm::SmallVector<SymbolFileCreateInstance>
1572
1573#pragma mark SymbolVendor
1574
1577
1579 static SymbolVendorInstances g_instances;
1580 return g_instances;
1581}
1582
1583bool PluginManager::RegisterPlugin(llvm::StringRef name,
1584 llvm::StringRef description,
1585 SymbolVendorCreateInstance create_callback) {
1586 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1587 create_callback);
1588}
1589
1591 SymbolVendorCreateInstance create_callback) {
1592 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1593}
1594
1595llvm::SmallVector<SymbolVendorCreateInstance>
1599
1600#pragma mark SymbolLocator
1601
1625
1627 static SymbolLocatorInstances g_instances;
1628 return g_instances;
1629}
1630
1632 llvm::StringRef name, llvm::StringRef description,
1633 SymbolLocatorCreateInstance create_callback,
1634 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1635 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1636 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1637 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1638 DebuggerInitializeCallback debugger_init_callback) {
1640 name, description, create_callback, locate_executable_object_file,
1641 locate_executable_symbol_file, download_object_symbol_file,
1642 find_symbol_file_in_bundle, debugger_init_callback);
1643}
1644
1646 SymbolLocatorCreateInstance create_callback) {
1647 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1648}
1649
1650llvm::SmallVector<SymbolLocatorCreateInstance>
1654
1657 StatisticsMap &map) {
1658 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1659 for (auto &instance : instances) {
1660 if (instance.locate_executable_object_file) {
1661 StatsDuration time;
1662 std::optional<ModuleSpec> result;
1663 {
1664 ElapsedTime elapsed(time);
1665 result = instance.locate_executable_object_file(module_spec);
1666 }
1667 map.add(instance.name, time.get().count());
1668 if (result)
1669 return *result;
1670 }
1671 }
1672 return {};
1673}
1674
1676 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1677 StatisticsMap &map) {
1678 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1679 for (auto &instance : instances) {
1680 if (instance.locate_executable_symbol_file) {
1681 StatsDuration time;
1682 std::optional<FileSpec> result;
1683 {
1684 ElapsedTime elapsed(time);
1685 result = instance.locate_executable_symbol_file(module_spec,
1686 default_search_paths);
1687 }
1688 map.add(instance.name, time.get().count());
1689 if (result)
1690 return *result;
1691 }
1692 }
1693 return {};
1694}
1695
1697 Status &error,
1698 bool force_lookup,
1699 bool copy_executable) {
1700 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1701 for (auto &instance : instances) {
1702 if (instance.download_object_symbol_file) {
1703 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1704 copy_executable))
1705 return true;
1706 }
1707 }
1708 return false;
1709}
1710
1712 const UUID *uuid,
1713 const ArchSpec *arch) {
1714 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1715 for (auto &instance : instances) {
1716 if (instance.find_symbol_file_in_bundle) {
1717 std::optional<FileSpec> result =
1718 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1719 if (result)
1720 return *result;
1721 }
1722 }
1723 return {};
1724}
1725
1726#pragma mark Trace
1727
1743
1745
1747 static TraceInstances g_instances;
1748 return g_instances;
1749}
1750
1752 llvm::StringRef name, llvm::StringRef description,
1753 TraceCreateInstanceFromBundle create_callback_from_bundle,
1754 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1755 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1757 name, description, create_callback_from_bundle,
1758 create_callback_for_live_process, schema, debugger_init_callback);
1759}
1760
1762 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1764 create_callback_from_bundle);
1765}
1766
1768PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1769 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1770}
1771
1774 llvm::StringRef plugin_name) {
1775 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1776 return instance->create_callback_for_live_process;
1777
1778 return nullptr;
1779}
1780
1781llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1782 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1783 return instance->schema;
1784 return llvm::StringRef();
1785}
1786
1787llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1788 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1789 return instance->schema;
1790 return llvm::StringRef();
1791}
1792
1793#pragma mark TraceExporter
1794
1808
1810
1812 static TraceExporterInstances g_instances;
1813 return g_instances;
1814}
1815
1817 llvm::StringRef name, llvm::StringRef description,
1818 TraceExporterCreateInstance create_callback,
1819 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1821 name, description, create_callback, create_thread_trace_export_command);
1822}
1823
1826 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1827}
1828
1830 TraceExporterCreateInstance create_callback) {
1831 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1832}
1833
1834llvm::SmallVector<TraceExporterCallbacks>
1836 auto instances = GetTraceExporterInstances().GetSnapshot();
1837 llvm::SmallVector<TraceExporterCallbacks> result;
1838 result.reserve(instances.size());
1839 for (auto &instance : instances)
1840 result.push_back({instance.name, instance.create_callback,
1841 instance.create_thread_trace_export_command});
1842 return result;
1843}
1844
1845#pragma mark UnwindAssembly
1846
1849
1851 static UnwindAssemblyInstances g_instances;
1852 return g_instances;
1853}
1854
1856 llvm::StringRef name, llvm::StringRef description,
1857 UnwindAssemblyCreateInstance create_callback) {
1858 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1859 create_callback);
1860}
1861
1863 UnwindAssemblyCreateInstance create_callback) {
1864 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1865}
1866
1867llvm::SmallVector<UnwindAssemblyCreateInstance>
1871
1872#pragma mark MemoryHistory
1873
1876
1878 static MemoryHistoryInstances g_instances;
1879 return g_instances;
1880}
1881
1883 llvm::StringRef name, llvm::StringRef description,
1884 MemoryHistoryCreateInstance create_callback) {
1885 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1886 create_callback);
1887}
1888
1890 MemoryHistoryCreateInstance create_callback) {
1891 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1892}
1893
1894llvm::SmallVector<MemoryHistoryCreateInstance>
1898
1899#pragma mark InstrumentationRuntime
1900
1913
1915 : public PluginInstances<InstrumentationRuntimeInstance> {
1916
1918 bool enabled_only) {
1919 if (auto instance = GetInstanceForName(name, enabled_only))
1920 return instance->get_type_callback;
1921 return nullptr;
1922 }
1923};
1924
1926 static InstrumentationRuntimeInstances g_instances;
1927 return g_instances;
1928}
1929
1931 llvm::StringRef name, llvm::StringRef description,
1933 InstrumentationRuntimeGetType get_type_callback) {
1935 name, description, create_callback, get_type_callback);
1936}
1937
1942
1943llvm::SmallVector<InstrumentationRuntimeCallbacks>
1945 auto instances =
1947 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1948 result.reserve(instances.size());
1949 for (auto &instance : instances)
1950 result.push_back({instance.create_callback, instance.get_type_callback});
1951 return result;
1952}
1953
1954#pragma mark TypeSystem
1955
1970
1972
1974 static TypeSystemInstances g_instances;
1975 return g_instances;
1976}
1977
1979 llvm::StringRef name, llvm::StringRef description,
1980 TypeSystemCreateInstance create_callback,
1981 LanguageSet supported_languages_for_types,
1982 LanguageSet supported_languages_for_expressions) {
1984 name, description, create_callback, supported_languages_for_types,
1985 supported_languages_for_expressions);
1986}
1987
1989 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
1990}
1991
1992llvm::SmallVector<TypeSystemCreateInstance>
1996
1998 const auto instances = GetTypeSystemInstances().GetSnapshot();
1999 LanguageSet all;
2000 for (unsigned i = 0; i < instances.size(); ++i)
2001 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
2002 return all;
2003}
2004
2006 const auto instances = GetTypeSystemInstances().GetSnapshot();
2007 LanguageSet all;
2008 for (unsigned i = 0; i < instances.size(); ++i)
2009 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
2010 return all;
2011}
2012
2013#pragma mark ScriptedInterfaces
2014
2028
2030
2032 static ScriptedInterfaceInstances g_instances;
2033 return g_instances;
2034}
2035
2037 llvm::StringRef name, llvm::StringRef description,
2038 ScriptedInterfaceCreateInstance create_callback,
2041 name, description, create_callback, language, usages);
2042}
2043
2048
2052
2053llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2055}
2056
2057llvm::StringRef
2061
2064 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2065 return instance->language;
2067}
2068
2071 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2072 return instance->usages;
2073 return {};
2074}
2075
2076#pragma mark REPL
2077
2086
2088
2090 static REPLInstances g_instances;
2091 return g_instances;
2092}
2093
2094bool PluginManager::RegisterPlugin(llvm::StringRef name,
2095 llvm::StringRef description,
2096 REPLCreateInstance create_callback,
2097 LanguageSet supported_languages) {
2098 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2099 supported_languages);
2100}
2101
2103 return GetREPLInstances().UnregisterPlugin(create_callback);
2104}
2105
2106llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2107 auto instances = GetREPLInstances().GetSnapshot();
2108 llvm::SmallVector<REPLCallbacks> result;
2109 result.reserve(instances.size());
2110 for (auto &instance : instances)
2111 result.push_back({instance.create_callback, instance.supported_languages});
2112 return result;
2113}
2114
2116 const auto instances = GetREPLInstances().GetSnapshot();
2117 LanguageSet all;
2118 for (unsigned i = 0; i < instances.size(); ++i)
2119 all.bitvector |= instances[i].supported_languages.bitvector;
2120 return all;
2121}
2122
2123#pragma mark Highlighter
2124
2125struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2130};
2131
2133
2135 static HighlighterInstances g_instances;
2136 return g_instances;
2137}
2138
2139bool PluginManager::RegisterPlugin(llvm::StringRef name,
2140 llvm::StringRef description,
2141 HighlighterCreateInstance create_callback) {
2142 return GetHighlighterInstances().RegisterPlugin(name, description,
2143 create_callback);
2144}
2145
2147 HighlighterCreateInstance create_callback) {
2148 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2149}
2150
2151llvm::SmallVector<HighlighterCreateInstance>
2155
2156#pragma mark PluginManager
2157
2172
2173// This is the preferred new way to register plugin specific settings. e.g.
2174// This will put a plugin's settings under e.g.
2175// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2177 Debugger &debugger, llvm::StringRef plugin_type_name,
2178 llvm::StringRef plugin_type_desc, bool can_create) {
2179 lldb::OptionValuePropertiesSP parent_properties_sp(
2180 debugger.GetValueProperties());
2181 if (parent_properties_sp) {
2182 static constexpr llvm::StringLiteral g_property_name("plugin");
2183
2184 OptionValuePropertiesSP plugin_properties_sp =
2185 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2186 if (!plugin_properties_sp && can_create) {
2187 plugin_properties_sp =
2188 std::make_shared<OptionValueProperties>(g_property_name);
2189 plugin_properties_sp->SetExpectedPath("plugin");
2190 parent_properties_sp->AppendProperty(g_property_name,
2191 "Settings specify to plugins.", true,
2192 plugin_properties_sp);
2193 }
2194
2195 if (plugin_properties_sp) {
2196 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2197 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2198 if (!plugin_type_properties_sp && can_create) {
2199 plugin_type_properties_sp =
2200 std::make_shared<OptionValueProperties>(plugin_type_name);
2201 plugin_type_properties_sp->SetExpectedPath(
2202 ("plugin." + plugin_type_name).str());
2203 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2204 true, plugin_type_properties_sp);
2205 }
2206 return plugin_type_properties_sp;
2207 }
2208 }
2210}
2211
2212// This is deprecated way to register plugin specific settings. e.g.
2213// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2214// generic settings would be under "platform.SETTINGNAME".
2216 Debugger &debugger, llvm::StringRef plugin_type_name,
2217 llvm::StringRef plugin_type_desc, bool can_create) {
2218 static constexpr llvm::StringLiteral g_property_name("plugin");
2219 lldb::OptionValuePropertiesSP parent_properties_sp(
2220 debugger.GetValueProperties());
2221 if (parent_properties_sp) {
2222 OptionValuePropertiesSP plugin_properties_sp =
2223 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2224 if (!plugin_properties_sp && can_create) {
2225 plugin_properties_sp =
2226 std::make_shared<OptionValueProperties>(plugin_type_name);
2227 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2228 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2229 true, plugin_properties_sp);
2230 }
2231
2232 if (plugin_properties_sp) {
2233 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2234 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2235 if (!plugin_type_properties_sp && can_create) {
2236 plugin_type_properties_sp =
2237 std::make_shared<OptionValueProperties>(g_property_name);
2238 plugin_type_properties_sp->SetExpectedPath(
2239 (plugin_type_name + ".plugin").str());
2240 plugin_properties_sp->AppendProperty(g_property_name,
2241 "Settings specific to plugins",
2242 true, plugin_type_properties_sp);
2243 }
2244 return plugin_type_properties_sp;
2245 }
2246 }
2248}
2249
2250namespace {
2251
2253GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2254 bool can_create);
2255}
2256
2258GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2259 llvm::StringRef plugin_type_name,
2260 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2262 lldb::OptionValuePropertiesSP properties_sp;
2263 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2264 debugger, plugin_type_name,
2265 "", // not creating to so we don't need the description
2266 false));
2267 if (plugin_type_properties_sp)
2268 properties_sp =
2269 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2270 return properties_sp;
2271}
2272
2273static bool
2274CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2275 llvm::StringRef plugin_type_desc,
2276 const lldb::OptionValuePropertiesSP &properties_sp,
2277 llvm::StringRef description, bool is_global_property,
2278 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2280 if (properties_sp) {
2281 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2282 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2283 true));
2284 if (plugin_type_properties_sp) {
2285 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2286 description, is_global_property,
2287 properties_sp);
2288 return true;
2289 }
2290 }
2291 return false;
2292}
2293
2294static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2295static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2296static constexpr llvm::StringLiteral kProcessPluginName("process");
2297static constexpr llvm::StringLiteral kTracePluginName("trace");
2298static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2299static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2300static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2301static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2302static constexpr llvm::StringLiteral
2303 kStructuredDataPluginName("structured-data");
2304static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2305
2308 llvm::StringRef setting_name) {
2309 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2310}
2311
2313 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2314 llvm::StringRef description, bool is_global_property) {
2316 "Settings for dynamic loader plug-ins",
2317 properties_sp, description, is_global_property);
2318}
2319
2322 llvm::StringRef setting_name) {
2323 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2325}
2326
2328 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2329 llvm::StringRef description, bool is_global_property) {
2331 "Settings for platform plug-ins", properties_sp,
2332 description, is_global_property,
2334}
2335
2338 llvm::StringRef setting_name) {
2339 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2340}
2341
2343 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2344 llvm::StringRef description, bool is_global_property) {
2346 "Settings for process plug-ins", properties_sp,
2347 description, is_global_property);
2348}
2349
2352 llvm::StringRef setting_name) {
2353 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2354}
2355
2357 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2358 llvm::StringRef description, bool is_global_property) {
2360 "Settings for symbol locator plug-ins",
2361 properties_sp, description, is_global_property);
2362}
2363
2365 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2366 llvm::StringRef description, bool is_global_property) {
2368 "Settings for trace plug-ins", properties_sp,
2369 description, is_global_property);
2370}
2371
2374 llvm::StringRef setting_name) {
2375 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2376}
2377
2379 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2380 llvm::StringRef description, bool is_global_property) {
2382 "Settings for object file plug-ins",
2383 properties_sp, description, is_global_property);
2384}
2385
2388 llvm::StringRef setting_name) {
2389 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2390}
2391
2393 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2394 llvm::StringRef description, bool is_global_property) {
2396 "Settings for symbol file plug-ins",
2397 properties_sp, description, is_global_property);
2398}
2399
2402 llvm::StringRef setting_name) {
2403 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2404}
2405
2407 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2408 llvm::StringRef description, bool is_global_property) {
2410 "Settings for JIT loader plug-ins",
2411 properties_sp, description, is_global_property);
2412}
2413
2414static const char *kOperatingSystemPluginName("os");
2415
2417 Debugger &debugger, llvm::StringRef setting_name) {
2418 lldb::OptionValuePropertiesSP properties_sp;
2419 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2422 "", // not creating to so we don't need the description
2423 false));
2424 if (plugin_type_properties_sp)
2425 properties_sp =
2426 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2427 return properties_sp;
2428}
2429
2431 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2432 llvm::StringRef description, bool is_global_property) {
2433 if (properties_sp) {
2434 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2436 "Settings for operating system plug-ins",
2437 true));
2438 if (plugin_type_properties_sp) {
2439 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2440 description, is_global_property,
2441 properties_sp);
2442 return true;
2443 }
2444 }
2445 return false;
2446}
2447
2450 llvm::StringRef setting_name) {
2451 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2452}
2453
2455 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2456 llvm::StringRef description, bool is_global_property) {
2458 "Settings for structured data plug-ins",
2459 properties_sp, description, is_global_property);
2460}
2461
2464 Debugger &debugger, llvm::StringRef setting_name) {
2465 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2466}
2467
2469 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2470 llvm::StringRef description, bool is_global_property) {
2472 "Settings for CPlusPlus language plug-ins",
2473 properties_sp, description, is_global_property);
2474}
2475
2476//
2477// Plugin Info+Enable Implementations
2478//
2479llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2481}
2482bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2483 return GetABIInstances().SetInstanceEnabled(name, enable);
2484}
2485
2486llvm::SmallVector<RegisteredPluginInfo>
2491 bool enable) {
2492 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2493}
2494
2495llvm::SmallVector<RegisteredPluginInfo>
2500 bool enable) {
2501 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2502}
2503
2504llvm::SmallVector<RegisteredPluginInfo>
2509 bool enable) {
2510 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2511}
2512
2513llvm::SmallVector<RegisteredPluginInfo>
2518 bool enable) {
2520}
2521
2522llvm::SmallVector<RegisteredPluginInfo>
2526
2528 switch (kind) {
2530 return "global";
2532 return "debugger";
2534 return "target";
2535 }
2536 llvm_unreachable("unhandled PluginDomainKind");
2537}
2538
2540 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2541 PluginDomainKind domain) {
2542 if (domain != lldb::ePluginDomainKindGlobal)
2543 return llvm::createStringErrorV("{} domain is not supported",
2544 PluginDomainKindToStr(domain));
2545 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2546 return llvm::createStringError("plugin could not be found");
2547
2548 return llvm::Error::success();
2549}
2550
2551llvm::SmallVector<RegisteredPluginInfo>
2556 bool enable) {
2557 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2558}
2559
2560llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2562}
2564 bool enable) {
2565 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2566}
2567
2568llvm::SmallVector<RegisteredPluginInfo>
2573 bool enable) {
2574 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2575}
2576
2577llvm::SmallVector<RegisteredPluginInfo>
2582 bool enable) {
2583 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2584}
2585
2586llvm::SmallVector<RegisteredPluginInfo>
2591 bool enable) {
2592 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2593}
2594
2595llvm::SmallVector<RegisteredPluginInfo>
2600 bool enable) {
2601 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2602}
2603
2604llvm::SmallVector<RegisteredPluginInfo>
2609 bool enable) {
2610 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2611}
2612
2613llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2615}
2617 bool enable) {
2618 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2619}
2620
2621llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2623}
2624bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2625 return GetProcessInstances().SetInstanceEnabled(name, enable);
2626}
2627
2628llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2630}
2631bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2632 return GetREPLInstances().SetInstanceEnabled(name, enable);
2633}
2634
2635llvm::SmallVector<RegisteredPluginInfo>
2640 bool enable) {
2642}
2643
2644llvm::SmallVector<RegisteredPluginInfo>
2649 bool enable) {
2651}
2652
2653llvm::SmallVector<RegisteredPluginInfo>
2658 bool enable) {
2660}
2661
2662llvm::SmallVector<RegisteredPluginInfo>
2667 bool enable) {
2669}
2670
2671llvm::SmallVector<RegisteredPluginInfo>
2676 bool enable) {
2677 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2678}
2679
2680llvm::SmallVector<RegisteredPluginInfo>
2685 bool enable) {
2686 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2687}
2688
2689llvm::SmallVector<RegisteredPluginInfo>
2694 bool enable) {
2695 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2696}
2697
2698llvm::SmallVector<RegisteredPluginInfo>
2703 bool enable) {
2704 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2705}
2706
2707llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2709}
2710bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2711 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2712}
2713
2714llvm::SmallVector<RegisteredPluginInfo>
2719 bool enable) {
2720 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2721}
2722
2723llvm::SmallVector<RegisteredPluginInfo>
2728 bool enable) {
2729 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2730}
2731
2732llvm::SmallVector<RegisteredPluginInfo>
2737 bool enable) {
2738 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2739}
2740
2742 CompletionRequest &request) {
2743 // Split the name into the namespace and the plugin name.
2744 // If there is no dot then the ns_name will be equal to name and
2745 // plugin_prefix will be empty.
2746 llvm::StringRef ns_name, plugin_prefix;
2747 std::tie(ns_name, plugin_prefix) = name.split('.');
2748
2749 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2750 // If the plugin namespace matches exactly then
2751 // add all the plugins in this namespace as completions if the
2752 // plugin names starts with the plugin_prefix. If the plugin_prefix
2753 // is empty then it will match all the plugins (empty string is a
2754 // prefix of everything).
2755 if (plugin_ns.name == ns_name) {
2756 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2757 llvm::SmallString<128> buf;
2758 if (plugin.name.starts_with(plugin_prefix))
2759 request.AddCompletion(
2760 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2761 }
2762 } else if (plugin_ns.name.starts_with(name) &&
2763 !plugin_ns.get_info().empty()) {
2764 // Otherwise check if the namespace is a prefix of the full name.
2765 // Use a partial completion here so that we can either operate on the full
2766 // namespace or tab-complete to the next level.
2767 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2768 }
2769 }
2770}
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:849
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:394
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
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
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.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
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
const ConstString & GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:250
llvm::StringRef GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:410
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:374
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp:406
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultEnter
Recurse into the current entry if it is a directory or symlink, or next if not.
Definition FileSystem.h:185
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
Definition FileSystem.h:182
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool SetArchitecturePluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static bool SetPlatformPluginEnabled(llvm::StringRef name, bool enable)
static bool SetScriptInterpreterPluginEnabled(llvm::StringRef name, bool enable)
static bool MatchPluginName(llvm::StringRef pattern, const PluginNamespace &plugin_ns, const RegisteredPluginInfo &plugin)
static lldb::OptionValuePropertiesSP GetSettingForStructuredDataPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetMemoryHistoryPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetSystemRuntimePluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetTypeSystemPluginInfo()
static bool CreateSettingForJITLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetRegisterTypeBuilderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef PluginDomainKindToStr(lldb::PluginDomainKind kind)
static bool SetTraceExporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetArchitecturePluginInfo()
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< UnwindAssemblyCreateInstance > GetUnwindAssemblyCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForObjectFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetEmulateInstructionPluginInfo()
static void AutoCompletePlatformName(llvm::StringRef partial_name, CompletionRequest &request)
static TraceExporterCreateInstance GetTraceExporterCreateCallback(llvm::StringRef plugin_name)
static bool SetDynamicLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::json::Object GetJSON(llvm::StringRef pattern="")
static bool CreateSettingForObjectFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetScriptedInterfacePluginEnabled(llvm::StringRef name, bool enable)
static bool SetOperatingSystemPluginEnabled(llvm::StringRef name, bool enable)
static lldb::ScriptInterpreterSP GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, Debugger &debugger)
static llvm::SmallVector< ABICreateInstance > GetABICreateCallbacks()
static llvm::SmallVector< InstrumentationRuntimeCallbacks > GetInstrumentationRuntimeCallbacks(bool enabled_only=true)
static void AutoCompleteProcessName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptInterpreterPluginInfo()
static 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 DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
static PlatformCreateInstance GetPlatformCreateCallbackForPluginName(llvm::StringRef name)
static bool SetProcessPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< llvm::StringRef > GetSaveCorePluginNames()
static llvm::SmallVector< RegisteredPluginInfo > GetOperatingSystemPluginInfo()
static llvm::SmallVector< ScriptedFrameProviderCreateInstance > GetScriptedFrameProviderCreateCallbacks()
static bool SetABIPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptedInterfacePluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name)
static ProcessCreateInstance GetProcessCreateCallbackForPluginName(llvm::StringRef name)
static void AutoCompletePluginName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProtocolServerPluginNameAtIndex(uint32_t idx)
static bool IsRegisteredObjectFilePluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetLanguagePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetREPLPluginInfo()
static bool SetREPLPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< HighlighterCreateInstance > GetHighlighterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetUnwindAssemblyPluginInfo()
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static bool SetSymbolVendorPluginEnabled(llvm::StringRef name, bool enable)
static TraceCreateInstanceFromBundle GetTraceCreateCallback(llvm::StringRef plugin_name)
static void DebuggerInitialize(Debugger &debugger)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static llvm::SmallVector< ObjectContainerCallbacks > GetObjectContainerCallbacks()
static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
static llvm::SmallVector< StructuredDataPluginCallbacks > GetStructuredDataPluginCallbacks()
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
static llvm::SmallVector< SystemRuntimeCreateInstance > GetSystemRuntimeCreateCallbacks()
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
static llvm::SmallVector< RegisteredPluginInfo > GetStructuredDataPluginInfo()
static bool SetSymbolLocatorPluginEnabled(llvm::StringRef name, bool enable)
static ProtocolServerCreateInstance GetProtocolCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< LanguageCreateInstance > GetLanguageCreateCallbacks()
static llvm::SmallVector< DynamicLoaderCreateInstance > GetDynamicLoaderCreateCallbacks()
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
static llvm::SmallVector< MemoryHistoryCreateInstance > GetMemoryHistoryCreateCallbacks()
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name)
static bool CreateSettingForSymbolLocatorPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetJITLoaderPluginInfo()
static bool SetObjectFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< PlatformCreateInstance > GetPlatformCreateCallbacks()
lldb::OptionValuePropertiesSP GetValueProperties() const
const std::optional< lldb_private::FileSpec > GetOutputFile() const
std::optional< std::string > GetPluginName() const
lldb::ProcessSP GetProcess() const
A class to count time for plugins.
Definition Statistics.h:94
void add(llvm::StringRef key, double value)
Definition Statistics.h:96
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
Represents UUID's of various sizes.
Definition UUID.h:27
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:327
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::optional< ModuleSpec >(* SymbolLocatorLocateExecutableObjectFile)(const ModuleSpec &module_spec)
@ Partial
The current token has been partially completed.
lldb::CommandObjectSP(* LanguageRuntimeGetCommandObject)(CommandInterpreter &interpreter)
DynamicLoader *(* DynamicLoaderCreateInstance)(Process *process, bool force)
lldb::StructuredDataPluginSP(* StructuredDataPluginCreateInstance)(Process &process)
lldb::JITLoaderSP(* JITLoaderCreateInstance)(Process *process, bool force)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* SyntheticFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const std::vector< lldb_private::ThreadSpec > &thread_specs)
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
lldb::REPLSP(* REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
SymbolFile *(* SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp)
llvm::Expected< lldb::TraceExporterUP >(* TraceExporterCreateInstance)()
Highlighter *(* HighlighterCreateInstance)(lldb::LanguageType language)
std::optional< FileSpec >(* SymbolLocatorFindSymbolFileInBundle)(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
bool(* SymbolLocatorDownloadObjectAndSymbolFile)(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
Status(* StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, Target *target)
ObjectFile *(* ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
ModuleSpecList(* ObjectFileGetModuleSpecifications)(const FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t file_offset, lldb::offset_t length)
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* ScriptedFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const lldb_private::ScriptedFrameProviderDescriptor &descriptor)
lldb::CommandObjectSP(* ThreadTraceExportCommandCreator)(CommandInterpreter &interpreter)
lldb::InstrumentationRuntimeSP(* InstrumentationRuntimeCreateInstance)(const lldb::ProcessSP &process_sp)
ScriptLanguage
Script interpreter types.
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
@ ePluginDomainKindTarget
@ ePluginDomainKindGlobal
@ ePluginDomainKindDebugger
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
HighlighterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
InstrumentationRuntimeGetType get_type_callback
InstrumentationRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, InstrumentationRuntimeGetType get_type_callback)
InstrumentationRuntimeGetType GetTypeCallbackForName(llvm::StringRef name, bool enabled_only)
LanguageRuntimeGetExceptionPrecondition precondition_callback
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
LanguageRuntimeGetCommandObject command_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
ObjectContainerCreateMemoryInstance create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
ObjectFileSaveCore save_core
PluginDir(FileSpec path, LoadPolicy policy)
const LoadPolicy policy
Filter when looking for plugins.
const FileSpec path
The path to the plugin directory.
@ LoadOnlyWithLLDBPrefix
Only load shared libraries who's filename start with g_plugin_prefix.
@ LoadAnyDylib
Try to load anything that looks like a shared library.
PluginTermCallback plugin_term_callback
PluginInfo()=default
llvm::sys::DynamicLibrary library
PluginInfo & operator=(PluginInfo &&other)
PluginInitCallback plugin_init_callback
PluginInfo(const PluginInfo &)=delete
PluginInfo(PluginInfo &&other)
static llvm::Expected< PluginInfo > Create(const FileSpec &path)
PluginInfo & operator=(const PluginInfo &)=delete
DebuggerInitializeCallback debugger_init_callback
PluginInstance()=default
PluginInstance(llvm::StringRef name, llvm::StringRef description, Callback create_callback, DebuggerInitializeCallback debugger_init_callback=nullptr)
LanguageSet supported_languages
REPLInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages)
RegisterTypeBuilderInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, lldb::ScriptLanguage language, ScriptInterpreterGetPath get_path_callback)
lldb::ScriptLanguage language
ScriptInterpreterGetPath get_path_callback
ScriptedInterfaceUsages usages
lldb::ScriptLanguage language
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description, ScriptedInterfaceCreateInstance create_callback, lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
StructuredDataFilterLaunchInfo filter_callback
SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle
SymbolLocatorInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, SymbolLocatorLocateExecutableObjectFile locate_executable_object_file, SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file, SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file, SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle, DebuggerInitializeCallback debugger_init_callback)
SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file
SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file
SymbolLocatorLocateExecutableObjectFile locate_executable_object_file
ThreadTraceExportCommandCreator create_thread_trace_export_command
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
llvm::StringRef schema
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback)
TraceCreateInstanceForLiveProcess create_callback_for_live_process
LanguageSet supported_languages_for_expressions
LanguageSet supported_languages_for_types
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39