LLDB mainline
PluginManager.cpp
Go to the documentation of this file.
1//===-- PluginManager.cpp -------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
12#include "lldb/Core/Debugger.h"
14#include "lldb/Host/HostInfo.h"
18#include "lldb/Target/Process.h"
20#include "lldb/Utility/Status.h"
22#include "llvm/ADT/SmallSet.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/ADT/Twine.h"
25#include "llvm/Support/DynamicLibrary.h"
26#include "llvm/Support/ErrorExtras.h"
27#include "llvm/Support/FileSystem.h"
28#include "llvm/Support/raw_ostream.h"
29#include <cassert>
30#include <memory>
31#include <mutex>
32#include <string>
33#include <utility>
34#if defined(_WIN32)
36#endif
37
38using namespace lldb;
39using namespace lldb_private;
40
42typedef void (*PluginTermCallback)();
43
44struct PluginInfo {
45 PluginInfo() = default;
46
47 PluginInfo(const PluginInfo &) = delete;
48 PluginInfo &operator=(const PluginInfo &) = delete;
49
51 : library(std::move(other.library)),
53 std::exchange(other.plugin_init_callback, nullptr)),
55 std::exchange(other.plugin_term_callback, nullptr)) {}
56
58 library = std::move(other.library);
59 plugin_init_callback = std::exchange(other.plugin_init_callback, nullptr);
60 plugin_term_callback = std::exchange(other.plugin_term_callback, nullptr);
61 return *this;
62 }
63
65 if (!library.isValid())
66 return;
68 return;
70 }
71
72 static llvm::Expected<PluginInfo> Create(const FileSpec &path);
73
74private:
75 llvm::sys::DynamicLibrary library;
78};
79
80typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap;
81
82namespace {
83enum class PluginLifecycle { Uninitialized, Initialized, Terminated };
84
85struct PluginRegistry {
86 std::recursive_mutex mutex;
88
89 void Initialize() {
90 std::lock_guard<std::recursive_mutex> guard(mutex);
91 lifecycle = PluginLifecycle::Initialized;
92 }
93
94 void Terminate() {
95 std::lock_guard<std::recursive_mutex> guard(mutex);
96 lifecycle = PluginLifecycle::Terminated;
97 map.clear();
98 }
99
100 // Only after Terminate() is a leftover PluginInstances registration a bug;
101 // exiting in any other state (e.g. `import lldb`, which never calls
102 // Terminate()) is supported and leaves plugins registered.
103 bool IsTerminated() const { return lifecycle == PluginLifecycle::Terminated; }
104
105private:
106 PluginLifecycle lifecycle = PluginLifecycle::Uninitialized;
107};
108} // namespace
109
110// Never destroyed: at static-destruction time the PluginInstances containers
111// (separate statics, arbitrary teardown order) still call IsTerminated(), and
112// the map's PluginInfo terminate callbacks must not run when the containers
113// they unregister from may already be gone. Terminate() clears the map
114// explicitly while everything is alive. The static pointer keeps it reachable,
115// so this is not a LeakSanitizer leak.
116static PluginRegistry &GetPluginRegistry() {
117 static PluginRegistry *g_registry = new PluginRegistry();
118 return *g_registry;
119}
120
121static std::recursive_mutex &GetPluginMapMutex() {
122 return GetPluginRegistry().mutex;
123}
124
126
127static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
128 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
129 return GetPluginMap().contains(plugin_file_spec);
130}
131
132static void SetPluginInfo(const FileSpec &plugin_file_spec,
133 PluginInfo plugin_info) {
134 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
135 DynamicPluginMap &plugin_map = GetPluginMap();
136 assert(!plugin_map.contains(plugin_file_spec));
137 plugin_map.try_emplace(plugin_file_spec, std::move(plugin_info));
138}
139
140template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
141 return reinterpret_cast<FPtrTy>(VPtr);
142}
143
144static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin";
145struct PluginDir {
147 /// Try to load anything that looks like a shared library.
149
150 /// Only load shared libraries who's filename start with g_plugin_prefix.
152 };
153
156
157 explicit operator bool() const { return FileSystem::Instance().Exists(path); }
158
159 /// The path to the plugin directory.
161
162 /// Filter when looking for plugins.
164};
165
166llvm::Expected<PluginInfo> PluginInfo::Create(const FileSpec &path) {
167 PluginInfo plugin_info;
168 std::string error;
169 plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
170 path.GetPath().c_str(), &error);
171 if (!plugin_info.library.isValid())
172 return llvm::createStringError(error);
173
174 // Look for files that follow the convention <g_plugin_prefix><name>.<ext>, in
175 // which case we need to call lldb_initialize_<name> and
176 // lldb_terminate_<name>.
177 llvm::StringRef file_name = path.GetFileNameStrippingExtension();
178 if (file_name.starts_with(g_plugin_prefix)) {
179 llvm::StringRef plugin_name = file_name.substr(g_plugin_prefix.size());
180 std::string init_symbol =
181 llvm::Twine("lldb_initialize_" + plugin_name).str();
182
183 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
184 plugin_info.library.getAddressOfSymbol(init_symbol.c_str()))) {
185 if (!init_fn())
186 return llvm::createStringErrorV("initializer '{0}' returned false",
187 init_symbol);
188 const std::string term_symbol =
189 llvm::Twine("lldb_terminate_" + plugin_name).str();
191 plugin_info.library.getAddressOfSymbol(term_symbol.c_str()));
192 }
193 return plugin_info;
194 }
195
196 // Look for the legacy LLDBPluginInitialize/LLDBPluginTerminate symbols.
197 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
198 plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"))) {
199 if (!init_fn())
200 return llvm::createStringError(
201 "initializer 'LLDBPluginInitialize' returned false");
202
203 plugin_info.plugin_init_callback = init_fn;
205 plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
206 return plugin_info;
207 }
208
209 return llvm::createStringError("no initialize symbol found");
210}
211
213LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
214 llvm::StringRef path) {
215 namespace fs = llvm::sys::fs;
216
217 static constexpr std::array<llvm::StringLiteral, 3>
218 g_shared_library_extension = {".dylib", ".so", ".dll"};
219
220 // If we have a regular file, a symbolic link or unknown file type, try and
221 // process the file. We must handle unknown as sometimes the directory
222 // enumeration might be enumerating a file system that doesn't have correct
223 // file type information.
224 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
225 ft == fs::file_type::type_unknown) {
226 FileSpec plugin_file_spec(path);
227 FileSystem::Instance().Resolve(plugin_file_spec);
228
229 // Don't try to load unknown extensions.
230 if (!llvm::is_contained(g_shared_library_extension,
231 plugin_file_spec.GetFileNameExtension()))
233
234 // Don't try to load libraries that don't start with g_plugin_prefix if so
235 // requested.
237 if (*policy == PluginDir::LoadOnlyWithLLDBPrefix &&
238 !plugin_file_spec.GetFilename().starts_with(g_plugin_prefix))
240
241 // Don't try to load an already loaded plugin again.
242 if (PluginIsLoaded(plugin_file_spec))
244
245 llvm::Expected<PluginInfo> plugin_info =
246 PluginInfo::Create(plugin_file_spec);
247 if (plugin_info) {
248 SetPluginInfo(plugin_file_spec, std::move(*plugin_info));
249 } else {
250 // Cache an empty plugin info so we don't try to load it again and again.
251 SetPluginInfo(plugin_file_spec, PluginInfo());
252
253 LLDB_LOG_ERROR(GetLog(LLDBLog::Host), plugin_info.takeError(),
254 "could not load plugin: {0}");
255 }
256
258 }
259
260 if (ft == fs::file_type::directory_file ||
261 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
262 // Try and recurse into anything that a directory or symbolic link. We must
263 // also do this for unknown as sometimes the directory enumeration might be
264 // enumerating a file system that doesn't have correct file type
265 // information.
267 }
268
270}
271
273 GetPluginRegistry().Initialize();
274
275 static const bool find_directories = true;
276 static const bool find_files = true;
277 static const bool find_other = true;
278
279 // Directories to scan for plugins. Unlike the plugin directories, which are
280 // meant exclusively for LLDB, the shared library directory is likely to
281 // contain unrelated shared libraries that we do not want to load. Therefore,
282 // limit the scan to libraries that start with g_plugin_prefix.
283 const std::array<PluginDir, 3> plugin_dirs = {
284 PluginDir(HostInfo::GetShlibDir(), PluginDir::LoadOnlyWithLLDBPrefix),
285 PluginDir(HostInfo::GetSystemPluginDir(), PluginDir::LoadAnyDylib),
286 PluginDir(HostInfo::GetUserPluginDir(), PluginDir::LoadAnyDylib)};
287
288 for (const PluginDir &plugin_dir : plugin_dirs) {
289 if (plugin_dir) {
291 plugin_dir.path.GetPath().c_str(), find_directories, find_files,
292 find_other, LoadPluginCallback, (void *)&plugin_dir.policy);
293 }
294 }
295}
296
298
299llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
300 static PluginNamespace PluginNamespaces[] = {
301
302 {
303 "abi",
306 },
307
308 {
309 "architecture",
312 },
313
314 {
315 "bug-reporter",
318 },
319
320 {
321 "disassembler",
324 },
325
326 {
327 "dynamic-loader",
330 },
331
332 {
333 "emulate-instruction",
336 },
337
338 {
339 "instrumentation-runtime",
342 },
343
344 {
345 "jit-loader",
348 },
349
350 {
351 "language",
354 },
355
356 {
357 "language-runtime",
360 },
361
362 {
363 "memory-history",
366 },
367
368 {
369 "object-container",
372 },
373
374 {
375 "object-file",
378 },
379
380 {
381 "operating-system",
384 },
385
386 {
387 "platform",
390 },
391
392 {
393 "process",
396 },
397
398 {
399 "repl",
402 },
403
404 {
405 "register-type-builder",
408 },
409
410 {
411 "script-interpreter",
414 },
415
416 {
417 "scripted-interface",
420 },
421
422 {
423 "structured-data",
426 },
427
428 {
429 "symbol-file",
432 },
433
434 {
435 "symbol-locator",
438 },
439
440 {
441 "symbol-vendor",
444 },
445
446 {
447 "system-runtime",
450 },
451
452 {
453 "trace",
456 },
457
458 {
459 "trace-exporter",
462 },
463
464 {
465 "type-system",
468 },
469
470 {
471 "unwind-assembly",
474 },
475 };
476
477 return PluginNamespaces;
478}
479
480llvm::json::Object PluginManager::GetJSON(llvm::StringRef pattern) {
481 llvm::json::Object plugin_stats;
482
483 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
484 llvm::json::Array namespace_stats;
485
486 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
487 if (MatchPluginName(pattern, plugin_ns, plugin)) {
488 llvm::json::Object plugin_json;
489 plugin_json.try_emplace("name", plugin.name);
490 plugin_json.try_emplace("enabled", plugin.enabled);
491 namespace_stats.emplace_back(std::move(plugin_json));
492 }
493 }
494 if (!namespace_stats.empty())
495 plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
496 }
497
498 return plugin_stats;
499}
500
501bool PluginManager::MatchPluginName(llvm::StringRef pattern,
502 const PluginNamespace &plugin_ns,
503 const RegisteredPluginInfo &plugin_info) {
504 // The empty pattern matches all plugins.
505 if (pattern.empty())
506 return true;
507
508 // Check if the pattern matches the namespace.
509 if (pattern == plugin_ns.name)
510 return true;
511
512 // Check if the pattern matches the qualified name.
513 std::string qualified_name = (plugin_ns.name + "." + plugin_info.name).str();
514 return pattern == qualified_name;
515}
516
517template <typename Instance> class PluginInstances {
518public:
520 // Only meaningful after a real teardown; see PluginRegistry::IsTerminated.
521 if (!GetPluginRegistry().IsTerminated())
522 return;
523#ifndef NDEBUG
524 for (const auto &instance : m_instances)
525 llvm::errs() << llvm::formatv("Use `image lookup -va {0:x}` to find out "
526 "which callback was not removed\n",
527 instance.create_callback);
528#endif
529 assert(m_instances.empty() && "forgot to unregister plugin?");
530 }
531
532 template <typename... Args>
533 bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
534 typename Instance::CallbackType callback,
535 Args &&...args) {
536 if (!callback)
537 return false;
538 assert(!name.empty());
539
540 std::lock_guard<std::mutex> guard(m_mutex);
541 m_instances.emplace_back(name, description, callback,
542 std::forward<Args>(args)...);
543 return true;
544 }
545
546 bool UnregisterPlugin(typename Instance::CallbackType callback) {
547 if (!callback)
548 return false;
549
550 std::lock_guard<std::mutex> guard(m_mutex);
551 auto pos = m_instances.begin();
552 auto end = m_instances.end();
553 for (; pos != end; ++pos) {
554 if (pos->create_callback == callback) {
555 m_instances.erase(pos);
556 return true;
557 }
558 }
559 return false;
560 }
561
562 llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
563 if (auto instance = GetInstanceAtIndex(idx))
564 return instance->description;
565 return "";
566 }
567
568 llvm::StringRef GetNameAtIndex(uint32_t idx) {
569 if (auto instance = GetInstanceAtIndex(idx))
570 return instance->name;
571 return "";
572 }
573
574 typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
575 if (auto instance = GetInstanceForName(name))
576 return instance->create_callback;
577 return nullptr;
578 }
579
580 llvm::SmallVector<typename Instance::CallbackType> GetCreateCallbacks() {
581 llvm::SmallVector<Instance> snapshot = GetSnapshot();
582 llvm::SmallVector<typename Instance::CallbackType> result;
583 result.reserve(snapshot.size());
584 for (const auto &instance : snapshot)
585 result.push_back(instance.create_callback);
586 return result;
587 }
588
590 for (const auto &instance : GetSnapshot()) {
591 if (instance.debugger_init_callback)
592 instance.debugger_init_callback(debugger);
593 }
594 }
595
596 // Return a copy of all the enabled instances.
597 // Note that this is a copy of the internal state so modifications
598 // to the returned instances will not be reflected back to instances
599 // stored by the PluginInstances object.
600 llvm::SmallVector<Instance> GetSnapshot(bool enabled_only = true) const {
601 std::lock_guard<std::mutex> guard(m_mutex);
602
603 llvm::SmallVector<Instance> enabled_instances;
604 enabled_instances.reserve(m_instances.size());
605 for (const auto &instance : m_instances) {
606 if (!enabled_only || instance.enabled)
607 enabled_instances.push_back(instance);
608 }
609 return enabled_instances;
610 }
611
612 std::optional<Instance> GetInstanceAtIndex(uint32_t idx) {
613 uint32_t count = 0;
614
615 return FindEnabledInstance(
616 [&](const Instance &instance) { return count++ == idx; });
617 }
618
619 std::optional<Instance> GetInstanceForName(llvm::StringRef name,
620 bool enabled_only = true) {
621 if (name.empty())
622 return std::nullopt;
623
624 auto predicate = [&](const Instance &instance) {
625 return instance.name == name;
626 };
627 if (enabled_only)
628 return FindEnabledInstance(predicate);
629
630 return FindInstance(predicate);
631 }
632
633 std::optional<Instance>
634 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
635 for (const auto &instance : GetSnapshot()) {
636 if (predicate(instance))
637 return instance;
638 }
639 return std::nullopt;
640 }
641
642 std::optional<Instance>
643 FindInstance(std::function<bool(const Instance &)> predicate) const {
644 std::lock_guard<std::mutex> guard(m_mutex);
645 for (const auto &instance : m_instances) {
646 if (predicate(instance))
647 return instance;
648 }
649 return std::nullopt;
650 }
651
652 // Return a list of all the registered plugin instances. This includes both
653 // enabled and disabled instances. The instances are listed in the order they
654 // were registered which is the order they would be queried if they were all
655 // enabled.
656 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
657 std::lock_guard<std::mutex> guard(m_mutex);
658
659 // Lookup the plugin info for each instance in the sorted order.
660 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
661 plugin_infos.reserve(m_instances.size());
662
663 for (const Instance &instance : m_instances)
664 plugin_infos.push_back(
665 {instance.name, instance.description, instance.enabled});
666
667 return plugin_infos;
668 }
669
670 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
671 std::lock_guard<std::mutex> guard(m_mutex);
672 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
673 return instance.name == name;
674 });
675
676 if (it == m_instances.end())
677 return false;
678
679 it->enabled = enable;
680 return true;
681 }
682
683private:
684 mutable std::mutex m_mutex;
685 llvm::SmallVector<Instance> m_instances;
686};
687
688#pragma mark ABI
689
692
694 static ABIInstances g_instances;
695 return g_instances;
696}
697
698bool PluginManager::RegisterPlugin(llvm::StringRef name,
699 llvm::StringRef description,
700 ABICreateInstance create_callback) {
701 return GetABIInstances().RegisterPlugin(name, description, create_callback);
702}
703
705 return GetABIInstances().UnregisterPlugin(create_callback);
706}
707
708llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
710}
711
712#pragma mark Architecture
713
716
718 static ArchitectureInstances g_instances;
719 return g_instances;
720}
721
722void PluginManager::RegisterPlugin(llvm::StringRef name,
723 llvm::StringRef description,
724 ArchitectureCreateInstance create_callback) {
725 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
726}
727
729 ArchitectureCreateInstance create_callback) {
730 auto &instances = GetArchitectureInstances();
731 instances.UnregisterPlugin(create_callback);
732}
733
734std::unique_ptr<Architecture>
736 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
737 if (auto plugin_up = instances.create_callback(arch))
738 return plugin_up;
739 }
740 return nullptr;
741}
742
743#pragma mark BugReporter
744
747
749 static BugReporterInstances g_instances;
750 return g_instances;
751}
752
753void PluginManager::RegisterPlugin(llvm::StringRef name,
754 llvm::StringRef description,
755 BugReporterCreateInstance create_callback) {
756 GetBugReporterInstances().RegisterPlugin(name, description, create_callback);
757}
758
763
764std::unique_ptr<BugReporter>
766 if (!name.empty()) {
767 if (auto create_callback =
768 GetBugReporterInstances().GetCallbackForName(name))
769 return create_callback();
770 return nullptr;
771 }
772 for (const auto &instance : GetBugReporterInstances().GetSnapshot()) {
773 if (auto plugin_up = instance.create_callback())
774 return plugin_up;
775 }
776 return nullptr;
777}
778
779#pragma mark Disassembler
780
783
785 static DisassemblerInstances g_instances;
786 return g_instances;
787}
788
789bool PluginManager::RegisterPlugin(llvm::StringRef name,
790 llvm::StringRef description,
791 DisassemblerCreateInstance create_callback) {
792 return GetDisassemblerInstances().RegisterPlugin(name, description,
793 create_callback);
794}
795
797 DisassemblerCreateInstance create_callback) {
798 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
799}
800
801llvm::SmallVector<DisassemblerCreateInstance>
805
811
812#pragma mark DynamicLoader
813
816
818 static DynamicLoaderInstances g_instances;
819 return g_instances;
820}
821
823 llvm::StringRef name, llvm::StringRef description,
824 DynamicLoaderCreateInstance create_callback,
825 DebuggerInitializeCallback debugger_init_callback) {
827 name, description, create_callback, debugger_init_callback);
828}
829
831 DynamicLoaderCreateInstance create_callback) {
832 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
833}
834
835llvm::SmallVector<DynamicLoaderCreateInstance>
839
845
846#pragma mark JITLoader
847
850
852 static JITLoaderInstances g_instances;
853 return g_instances;
854}
855
857 llvm::StringRef name, llvm::StringRef description,
858 JITLoaderCreateInstance create_callback,
859 DebuggerInitializeCallback debugger_init_callback) {
861 name, description, create_callback, debugger_init_callback);
862}
863
865 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
866}
867
868llvm::SmallVector<JITLoaderCreateInstance>
872
873#pragma mark EmulateInstruction
874
878
880 static EmulateInstructionInstances g_instances;
881 return g_instances;
882}
883
885 llvm::StringRef name, llvm::StringRef description,
886 EmulateInstructionCreateInstance create_callback) {
887 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
888 create_callback);
889}
890
895
896llvm::SmallVector<EmulateInstructionCreateInstance>
900
906
907#pragma mark OperatingSystem
908
911
913 static OperatingSystemInstances g_instances;
914 return g_instances;
915}
916
918 llvm::StringRef name, llvm::StringRef description,
919 OperatingSystemCreateInstance create_callback,
920 DebuggerInitializeCallback debugger_init_callback) {
922 name, description, create_callback, debugger_init_callback);
923}
924
929
930llvm::SmallVector<OperatingSystemCreateInstance>
934
940
941#pragma mark Language
942
945
947 static LanguageInstances g_instances;
948 return g_instances;
949}
950
952 llvm::StringRef name, llvm::StringRef description,
953 LanguageCreateInstance create_callback,
954 DebuggerInitializeCallback debugger_init_callback) {
956 name, description, create_callback, debugger_init_callback);
957}
958
960 return GetLanguageInstances().UnregisterPlugin(create_callback);
961}
962
963llvm::SmallVector<LanguageCreateInstance>
967
968#pragma mark LanguageRuntime
969
986
988
990 static LanguageRuntimeInstances g_instances;
991 return g_instances;
992}
993
995 llvm::StringRef name, llvm::StringRef description,
996 LanguageRuntimeCreateInstance create_callback,
997 LanguageRuntimeGetCommandObject command_callback,
998 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
1000 name, description, create_callback, nullptr, command_callback,
1001 precondition_callback);
1002}
1003
1005 LanguageRuntimeCreateInstance create_callback) {
1006 return GetLanguageRuntimeInstances().UnregisterPlugin(create_callback);
1007}
1008
1009llvm::SmallVector<LanguageRuntimeCallbacks>
1011 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
1012 llvm::SmallVector<LanguageRuntimeCallbacks> result;
1013 result.reserve(instances.size());
1014 for (auto &instance : instances)
1015 result.push_back({instance.create_callback, instance.command_callback,
1016 instance.precondition_callback});
1017 return result;
1018}
1019
1020#pragma mark SystemRuntime
1021
1024
1026 static SystemRuntimeInstances g_instances;
1027 return g_instances;
1028}
1029
1031 llvm::StringRef name, llvm::StringRef description,
1032 SystemRuntimeCreateInstance create_callback) {
1033 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
1034 create_callback);
1035}
1036
1038 SystemRuntimeCreateInstance create_callback) {
1039 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
1040}
1041
1042llvm::SmallVector<SystemRuntimeCreateInstance>
1046
1047#pragma mark ObjectFile
1048
1068
1070 static ObjectFileInstances g_instances;
1071 return g_instances;
1072}
1073
1075 if (name.empty())
1076 return false;
1077
1078 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1079}
1080
1082 llvm::StringRef name, llvm::StringRef description,
1083 ObjectFileCreateInstance create_callback,
1084 ObjectFileCreateMemoryInstance create_memory_callback,
1085 ObjectFileGetModuleSpecifications get_module_specifications,
1086 ObjectFileSaveCore save_core,
1087 DebuggerInitializeCallback debugger_init_callback) {
1089 name, description, create_callback, create_memory_callback,
1090 get_module_specifications, save_core, debugger_init_callback);
1091}
1092
1094 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1095}
1096
1097llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1098 auto instances = GetObjectFileInstances().GetSnapshot();
1099 llvm::SmallVector<ObjectFileCallbacks> result;
1100 result.reserve(instances.size());
1101 for (auto &instance : instances)
1102 result.push_back({instance.create_callback, instance.create_memory_callback,
1103 instance.get_module_specifications, instance.save_core});
1104 return result;
1105}
1106
1109 llvm::StringRef name) {
1110 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1111 return instance->create_memory_callback;
1112 return nullptr;
1113}
1114
1116 Status error;
1117 if (!options.GetOutputFile()) {
1118 error = Status::FromErrorString("No output file specified");
1119 return error;
1120 }
1121
1122 if (!options.GetProcess()) {
1123 error = Status::FromErrorString("Invalid process");
1124 return error;
1125 }
1126
1127 error = options.EnsureValidConfiguration();
1128 if (error.Fail())
1129 return error;
1130
1131 if (!options.GetPluginName().has_value()) {
1132 // Try saving core directly from the process plugin first.
1133 llvm::Expected<bool> ret =
1134 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1135 if (!ret)
1136 return Status::FromError(ret.takeError());
1137 if (ret.get())
1138 return Status();
1139 }
1140
1141 // Fall back to object plugins.
1142 const auto &plugin_name = options.GetPluginName().value_or("");
1143 auto instances = GetObjectFileInstances().GetSnapshot();
1144 for (auto &instance : instances) {
1145 if (plugin_name.empty() || instance.name == plugin_name) {
1146 // TODO: Refactor the instance.save_core() to not require a process and
1147 // get it from options instead.
1148 if (instance.save_core &&
1149 instance.save_core(options.GetProcess(), options, error))
1150 return error;
1151 }
1152 }
1153
1154 // Check to see if any of the object file plugins tried and failed to save.
1155 // if any failure, return the error message.
1156 if (error.Fail())
1157 return error;
1158
1159 // Report only for the plugin that was specified.
1160 if (!plugin_name.empty())
1162 "The \"{}\" plugin is not able to save a core for this process.",
1163 plugin_name);
1164
1166 "no ObjectFile plugins were able to save a core for this process");
1167}
1168
1169llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1170 llvm::SmallVector<llvm::StringRef> plugin_names;
1171 auto instances = GetObjectFileInstances().GetSnapshot();
1172 for (auto &instance : instances) {
1173 if (instance.save_core)
1174 plugin_names.emplace_back(instance.name);
1175 }
1176 return plugin_names;
1177}
1178
1179#pragma mark ObjectContainer
1180
1197
1199 static ObjectContainerInstances g_instances;
1200 return g_instances;
1201}
1202
1204 llvm::StringRef name, llvm::StringRef description,
1205 ObjectContainerCreateInstance create_callback,
1206 ObjectFileGetModuleSpecifications get_module_specifications,
1207 ObjectContainerCreateMemoryInstance create_memory_callback) {
1209 name, description, create_callback, create_memory_callback,
1210 get_module_specifications);
1211}
1212
1214 ObjectContainerCreateInstance create_callback) {
1215 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1216}
1217
1218llvm::SmallVector<ObjectContainerCallbacks>
1220 auto instances = GetObjectContainerInstances().GetSnapshot();
1221 llvm::SmallVector<ObjectContainerCallbacks> result;
1222 result.reserve(instances.size());
1223 for (auto &instance : instances)
1224 result.push_back({instance.create_callback, instance.create_memory_callback,
1225 instance.get_module_specifications});
1226 return result;
1227}
1228
1229#pragma mark Platform
1230
1233
1235 static PlatformInstances g_platform_instances;
1236 return g_platform_instances;
1237}
1238
1240 llvm::StringRef name, llvm::StringRef description,
1241 PlatformCreateInstance create_callback,
1242 DebuggerInitializeCallback debugger_init_callback) {
1244 name, description, create_callback, debugger_init_callback);
1245}
1246
1248 return GetPlatformInstances().UnregisterPlugin(create_callback);
1249}
1250
1251llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1253}
1254
1255llvm::StringRef
1259
1264
1265llvm::SmallVector<PlatformCreateInstance>
1269
1271 CompletionRequest &request) {
1272 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1273 if (instance.name.starts_with(name))
1274 request.AddCompletion(instance.name);
1275 }
1276}
1277
1278#pragma mark Process
1279
1282
1284 static ProcessInstances g_instances;
1285 return g_instances;
1286}
1287
1289 llvm::StringRef name, llvm::StringRef description,
1290 ProcessCreateInstance create_callback,
1291 DebuggerInitializeCallback debugger_init_callback) {
1293 name, description, create_callback, debugger_init_callback);
1294}
1295
1297 return GetProcessInstances().UnregisterPlugin(create_callback);
1298}
1299
1300llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1301 return GetProcessInstances().GetNameAtIndex(idx);
1302}
1303
1304llvm::StringRef
1308
1313
1314llvm::SmallVector<ProcessCreateInstance>
1318
1320 CompletionRequest &request) {
1321 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1322 if (instance.name.starts_with(name))
1323 request.AddCompletion(instance.name, instance.description);
1324 }
1325}
1326
1327#pragma mark ProtocolServer
1328
1331
1333 static ProtocolServerInstances g_instances;
1334 return g_instances;
1335}
1336
1338 llvm::StringRef name, llvm::StringRef description,
1339 ProtocolServerCreateInstance create_callback) {
1340 return GetProtocolServerInstances().RegisterPlugin(name, description,
1341 create_callback);
1342}
1343
1345 ProtocolServerCreateInstance create_callback) {
1346 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1347}
1348
1349llvm::StringRef
1353
1358
1359#pragma mark RegisterTypeBuilder
1360
1362 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1367};
1368
1369typedef PluginInstances<RegisterTypeBuilderInstance>
1371
1373 static RegisterTypeBuilderInstances g_instances;
1374 return g_instances;
1375}
1376
1378 llvm::StringRef name, llvm::StringRef description,
1379 RegisterTypeBuilderCreateInstance create_callback) {
1380 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1381 create_callback);
1382}
1383
1388
1391 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1392 // type and is always present.
1394 assert(instance);
1395 return instance->create_callback(target);
1396}
1397
1398#pragma mark ScriptInterpreter
1399
1413
1415
1417 static ScriptInterpreterInstances g_instances;
1418 return g_instances;
1419}
1420
1422 llvm::StringRef name, llvm::StringRef description,
1423 lldb::ScriptLanguage script_language,
1424 ScriptInterpreterCreateInstance create_callback,
1425 ScriptInterpreterGetPath get_path_callback) {
1427 name, description, create_callback, script_language, get_path_callback);
1428}
1429
1434
1435llvm::SmallVector<ScriptInterpreterCreateInstance>
1439
1442 Debugger &debugger) {
1443 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1444 ScriptInterpreterCreateInstance none_instance = nullptr;
1445 for (const auto &instance : instances) {
1446 if (instance.language == lldb::eScriptLanguageNone)
1447 none_instance = instance.create_callback;
1448
1449 if (script_lang == instance.language)
1450 return instance.create_callback(debugger);
1451 }
1452
1453 // If we didn't find one, return the ScriptInterpreter for the null language.
1454 assert(none_instance != nullptr);
1455 return none_instance(debugger);
1456}
1457
1459 lldb::ScriptLanguage script_lang) {
1460 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1461 for (const auto &instance : instances) {
1462 if (instance.language == script_lang && instance.get_path_callback)
1463 return instance.get_path_callback();
1464 }
1465 return FileSpec();
1466}
1467
1468#pragma mark SyntheticFrameProvider
1469
1478
1480 static SyntheticFrameProviderInstances g_instances;
1481 return g_instances;
1482}
1483
1485 static ScriptedFrameProviderInstances g_instances;
1486 return g_instances;
1487}
1488
1490 llvm::StringRef name, llvm::StringRef description,
1491 SyntheticFrameProviderCreateInstance create_native_callback,
1492 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1493 if (create_native_callback)
1495 name, description, create_native_callback);
1496 else if (create_scripted_callback)
1498 name, description, create_scripted_callback);
1499 return false;
1500}
1501
1506
1511
1517
1518llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1522
1523#pragma mark StructuredDataPlugin
1524
1538
1541
1543 static StructuredDataPluginInstances g_instances;
1544 return g_instances;
1545}
1546
1548 llvm::StringRef name, llvm::StringRef description,
1549 StructuredDataPluginCreateInstance create_callback,
1550 DebuggerInitializeCallback debugger_init_callback,
1551 StructuredDataFilterLaunchInfo filter_callback) {
1553 name, description, create_callback, debugger_init_callback,
1554 filter_callback);
1555}
1556
1561
1562llvm::SmallVector<StructuredDataPluginCallbacks>
1564 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1565 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1566 result.reserve(instances.size());
1567 for (auto &instance : instances)
1568 result.push_back({instance.create_callback, instance.filter_callback});
1569 return result;
1570}
1571
1572#pragma mark SymbolFile
1573
1576
1578 static SymbolFileInstances g_instances;
1579 return g_instances;
1580}
1581
1583 llvm::StringRef name, llvm::StringRef description,
1584 SymbolFileCreateInstance create_callback,
1585 DebuggerInitializeCallback debugger_init_callback) {
1587 name, description, create_callback, debugger_init_callback);
1588}
1589
1591 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1592}
1593
1594llvm::SmallVector<SymbolFileCreateInstance>
1598
1599#pragma mark SymbolVendor
1600
1603
1605 static SymbolVendorInstances g_instances;
1606 return g_instances;
1607}
1608
1609bool PluginManager::RegisterPlugin(llvm::StringRef name,
1610 llvm::StringRef description,
1611 SymbolVendorCreateInstance create_callback) {
1612 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1613 create_callback);
1614}
1615
1617 SymbolVendorCreateInstance create_callback) {
1618 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1619}
1620
1621llvm::SmallVector<SymbolVendorCreateInstance>
1625
1626#pragma mark SymbolLocator
1627
1651
1653 static SymbolLocatorInstances g_instances;
1654 return g_instances;
1655}
1656
1658 llvm::StringRef name, llvm::StringRef description,
1659 SymbolLocatorCreateInstance create_callback,
1660 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1661 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1662 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1663 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1664 DebuggerInitializeCallback debugger_init_callback) {
1666 name, description, create_callback, locate_executable_object_file,
1667 locate_executable_symbol_file, download_object_symbol_file,
1668 find_symbol_file_in_bundle, debugger_init_callback);
1669}
1670
1672 SymbolLocatorCreateInstance create_callback) {
1673 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1674}
1675
1676llvm::SmallVector<SymbolLocatorCreateInstance>
1680
1683 StatisticsMap &map) {
1684 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1685 for (auto &instance : instances) {
1686 if (instance.locate_executable_object_file) {
1687 StatsDuration time;
1688 std::optional<ModuleSpec> result;
1689 {
1690 ElapsedTime elapsed(time);
1691 result = instance.locate_executable_object_file(module_spec);
1692 }
1693 map.add(instance.name, time.get().count());
1694 if (result)
1695 return *result;
1696 }
1697 }
1698 return {};
1699}
1700
1702 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1703 StatisticsMap &map) {
1704 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1705 for (auto &instance : instances) {
1706 if (instance.locate_executable_symbol_file) {
1707 StatsDuration time;
1708 std::optional<FileSpec> result;
1709 {
1710 ElapsedTime elapsed(time);
1711 result = instance.locate_executable_symbol_file(module_spec,
1712 default_search_paths);
1713 }
1714 map.add(instance.name, time.get().count());
1715 if (result)
1716 return *result;
1717 }
1718 }
1719 return {};
1720}
1721
1723 Status &error,
1724 bool force_lookup,
1725 bool copy_executable) {
1726 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1727 for (auto &instance : instances) {
1728 if (instance.download_object_symbol_file) {
1729 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1730 copy_executable))
1731 return true;
1732 }
1733 }
1734 return false;
1735}
1736
1738 const UUID *uuid,
1739 const ArchSpec *arch) {
1740 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1741 for (auto &instance : instances) {
1742 if (instance.find_symbol_file_in_bundle) {
1743 std::optional<FileSpec> result =
1744 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1745 if (result)
1746 return *result;
1747 }
1748 }
1749 return {};
1750}
1751
1752#pragma mark Trace
1753
1769
1771
1773 static TraceInstances g_instances;
1774 return g_instances;
1775}
1776
1778 llvm::StringRef name, llvm::StringRef description,
1779 TraceCreateInstanceFromBundle create_callback_from_bundle,
1780 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1781 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1783 name, description, create_callback_from_bundle,
1784 create_callback_for_live_process, schema, debugger_init_callback);
1785}
1786
1788 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1790 create_callback_from_bundle);
1791}
1792
1794PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1795 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1796}
1797
1800 llvm::StringRef plugin_name) {
1801 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1802 return instance->create_callback_for_live_process;
1803
1804 return nullptr;
1805}
1806
1807llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1808 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1809 return instance->schema;
1810 return llvm::StringRef();
1811}
1812
1813llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1814 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1815 return instance->schema;
1816 return llvm::StringRef();
1817}
1818
1819#pragma mark TraceExporter
1820
1834
1836
1838 static TraceExporterInstances g_instances;
1839 return g_instances;
1840}
1841
1843 llvm::StringRef name, llvm::StringRef description,
1844 TraceExporterCreateInstance create_callback,
1845 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1847 name, description, create_callback, create_thread_trace_export_command);
1848}
1849
1852 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1853}
1854
1856 TraceExporterCreateInstance create_callback) {
1857 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1858}
1859
1860llvm::SmallVector<TraceExporterCallbacks>
1862 auto instances = GetTraceExporterInstances().GetSnapshot();
1863 llvm::SmallVector<TraceExporterCallbacks> result;
1864 result.reserve(instances.size());
1865 for (auto &instance : instances)
1866 result.push_back({instance.name, instance.create_callback,
1867 instance.create_thread_trace_export_command});
1868 return result;
1869}
1870
1871#pragma mark UnwindAssembly
1872
1875
1877 static UnwindAssemblyInstances g_instances;
1878 return g_instances;
1879}
1880
1882 llvm::StringRef name, llvm::StringRef description,
1883 UnwindAssemblyCreateInstance create_callback) {
1884 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1885 create_callback);
1886}
1887
1889 UnwindAssemblyCreateInstance create_callback) {
1890 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1891}
1892
1893llvm::SmallVector<UnwindAssemblyCreateInstance>
1897
1898#pragma mark MemoryHistory
1899
1902
1904 static MemoryHistoryInstances g_instances;
1905 return g_instances;
1906}
1907
1909 llvm::StringRef name, llvm::StringRef description,
1910 MemoryHistoryCreateInstance create_callback) {
1911 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1912 create_callback);
1913}
1914
1916 MemoryHistoryCreateInstance create_callback) {
1917 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1918}
1919
1920llvm::SmallVector<MemoryHistoryCreateInstance>
1924
1925#pragma mark InstrumentationRuntime
1926
1939
1941 : public PluginInstances<InstrumentationRuntimeInstance> {
1942
1944 bool enabled_only) {
1945 if (auto instance = GetInstanceForName(name, enabled_only))
1946 return instance->get_type_callback;
1947 return nullptr;
1948 }
1949};
1950
1952 static InstrumentationRuntimeInstances g_instances;
1953 return g_instances;
1954}
1955
1957 llvm::StringRef name, llvm::StringRef description,
1959 InstrumentationRuntimeGetType get_type_callback) {
1961 name, description, create_callback, get_type_callback);
1962}
1963
1968
1969llvm::SmallVector<InstrumentationRuntimeCallbacks>
1971 auto instances =
1973 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1974 result.reserve(instances.size());
1975 for (auto &instance : instances)
1976 result.push_back({instance.create_callback, instance.get_type_callback});
1977 return result;
1978}
1979
1980#pragma mark TypeSystem
1981
1997
1999
2001 static TypeSystemInstances g_instances;
2002 return g_instances;
2003}
2004
2006 llvm::StringRef name, llvm::StringRef description,
2007 TypeSystemCreateInstance create_callback,
2008 LanguageSet supported_languages_for_types,
2009 LanguageSet supported_languages_for_expressions,
2010 DebuggerInitializeCallback debugger_init_callback) {
2012 name, description, create_callback, supported_languages_for_types,
2013 supported_languages_for_expressions, debugger_init_callback);
2014}
2015
2017 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
2018}
2019
2020llvm::SmallVector<TypeSystemCreateInstance>
2024
2026 const auto instances = GetTypeSystemInstances().GetSnapshot();
2027 LanguageSet all;
2028 for (unsigned i = 0; i < instances.size(); ++i)
2029 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
2030 return all;
2031}
2032
2034 const auto instances = GetTypeSystemInstances().GetSnapshot();
2035 LanguageSet all;
2036 for (unsigned i = 0; i < instances.size(); ++i)
2037 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
2038 return all;
2039}
2040
2041#pragma mark ScriptedInterfaces
2042
2044
2046 static ScriptedInterfaceInstances g_instances;
2047 return g_instances;
2048}
2049
2051 llvm::StringRef name, llvm::StringRef description,
2052 ScriptedInterfaceCreateInstance create_callback,
2054 ScriptedInterfaceUsages usages) {
2056 name, description, create_callback, extension, language, usages);
2057}
2058
2063
2067
2068llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2070}
2071
2072llvm::StringRef
2076
2079 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(index))
2080 return instance->extension;
2082}
2083
2086 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2087 return instance->language;
2089}
2090
2093 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2094 return instance->usages;
2095 return {};
2096}
2097
2099 llvm::function_ref<void(const ScriptedInterfaceInstance &)> callback,
2100 lldb::ScriptLanguage language) {
2101 llvm::SmallSet<lldb::ScriptedExtension, 16> emitted;
2102 for (size_t idx = 0; idx < GetNumScriptedInterfaces(); idx++) {
2104 if (!instance)
2105 continue;
2106 if (language != lldb::eScriptLanguageUnknown &&
2107 instance->language != language)
2108 continue;
2109 if (emitted.insert(instance->extension).second)
2110 callback(*instance);
2111 }
2112}
2113
2115 llvm::StringRef name, CompletionRequest &request,
2116 lldb::ScriptLanguage language) {
2118 [&](const ScriptedInterfaceInstance &instance) {
2119 llvm::StringLiteral extension_name =
2121 if (extension_name.starts_with(name))
2122 request.AddCompletion(extension_name);
2123 },
2124 language);
2125}
2126
2127#pragma mark REPL
2128
2137
2139
2141 static REPLInstances g_instances;
2142 return g_instances;
2143}
2144
2145bool PluginManager::RegisterPlugin(llvm::StringRef name,
2146 llvm::StringRef description,
2147 REPLCreateInstance create_callback,
2148 LanguageSet supported_languages) {
2149 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2150 supported_languages);
2151}
2152
2154 return GetREPLInstances().UnregisterPlugin(create_callback);
2155}
2156
2157llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2158 auto instances = GetREPLInstances().GetSnapshot();
2159 llvm::SmallVector<REPLCallbacks> result;
2160 result.reserve(instances.size());
2161 for (auto &instance : instances)
2162 result.push_back({instance.create_callback, instance.supported_languages});
2163 return result;
2164}
2165
2167 const auto instances = GetREPLInstances().GetSnapshot();
2168 LanguageSet all;
2169 for (unsigned i = 0; i < instances.size(); ++i)
2170 all.bitvector |= instances[i].supported_languages.bitvector;
2171 return all;
2172}
2173
2174#pragma mark Highlighter
2175
2176struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2181};
2182
2184
2186 static HighlighterInstances g_instances;
2187 return g_instances;
2188}
2189
2190bool PluginManager::RegisterPlugin(llvm::StringRef name,
2191 llvm::StringRef description,
2192 HighlighterCreateInstance create_callback) {
2193 return GetHighlighterInstances().RegisterPlugin(name, description,
2194 create_callback);
2195}
2196
2198 HighlighterCreateInstance create_callback) {
2199 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2200}
2201
2202llvm::SmallVector<HighlighterCreateInstance>
2206
2207#pragma mark PluginManager
2208
2224
2225// This is the preferred new way to register plugin specific settings. e.g.
2226// This will put a plugin's settings under e.g.
2227// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2229 Debugger &debugger, llvm::StringRef plugin_type_name,
2230 llvm::StringRef plugin_type_desc, bool can_create) {
2231 lldb::OptionValuePropertiesSP parent_properties_sp(
2232 debugger.GetValueProperties());
2233 if (parent_properties_sp) {
2234 static constexpr llvm::StringLiteral g_property_name("plugin");
2235
2236 OptionValuePropertiesSP plugin_properties_sp =
2237 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2238 if (!plugin_properties_sp && can_create) {
2239 plugin_properties_sp =
2240 std::make_shared<OptionValueProperties>(g_property_name);
2241 plugin_properties_sp->SetExpectedPath("plugin");
2242 parent_properties_sp->AppendProperty(g_property_name,
2243 "Settings specify to plugins.", true,
2244 plugin_properties_sp);
2245 }
2246
2247 if (plugin_properties_sp) {
2248 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2249 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2250 if (!plugin_type_properties_sp && can_create) {
2251 plugin_type_properties_sp =
2252 std::make_shared<OptionValueProperties>(plugin_type_name);
2253 plugin_type_properties_sp->SetExpectedPath(
2254 ("plugin." + plugin_type_name).str());
2255 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2256 true, plugin_type_properties_sp);
2257 }
2258 return plugin_type_properties_sp;
2259 }
2260 }
2262}
2263
2264// This is deprecated way to register plugin specific settings. e.g.
2265// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2266// generic settings would be under "platform.SETTINGNAME".
2268 Debugger &debugger, llvm::StringRef plugin_type_name,
2269 llvm::StringRef plugin_type_desc, bool can_create) {
2270 static constexpr llvm::StringLiteral g_property_name("plugin");
2271 lldb::OptionValuePropertiesSP parent_properties_sp(
2272 debugger.GetValueProperties());
2273 if (parent_properties_sp) {
2274 OptionValuePropertiesSP plugin_properties_sp =
2275 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2276 if (!plugin_properties_sp && can_create) {
2277 plugin_properties_sp =
2278 std::make_shared<OptionValueProperties>(plugin_type_name);
2279 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2280 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2281 true, plugin_properties_sp);
2282 }
2283
2284 if (plugin_properties_sp) {
2285 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2286 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2287 if (!plugin_type_properties_sp && can_create) {
2288 plugin_type_properties_sp =
2289 std::make_shared<OptionValueProperties>(g_property_name);
2290 plugin_type_properties_sp->SetExpectedPath(
2291 (plugin_type_name + ".plugin").str());
2292 plugin_properties_sp->AppendProperty(g_property_name,
2293 "Settings specific to plugins",
2294 true, plugin_type_properties_sp);
2295 }
2296 return plugin_type_properties_sp;
2297 }
2298 }
2300}
2301
2302namespace {
2303
2305GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2306 bool can_create);
2307}
2308
2310GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2311 llvm::StringRef plugin_type_name,
2312 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2314 lldb::OptionValuePropertiesSP properties_sp;
2315 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2316 debugger, plugin_type_name,
2317 "", // not creating to so we don't need the description
2318 false));
2319 if (plugin_type_properties_sp)
2320 properties_sp =
2321 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2322 return properties_sp;
2323}
2324
2325static bool
2326CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2327 llvm::StringRef plugin_type_desc,
2328 const lldb::OptionValuePropertiesSP &properties_sp,
2329 llvm::StringRef description, bool is_global_property,
2330 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2332 if (properties_sp) {
2333 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2334 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2335 true));
2336 if (plugin_type_properties_sp) {
2337 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2338 description, is_global_property,
2339 properties_sp);
2340 return true;
2341 }
2342 }
2343 return false;
2344}
2345
2346static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2347static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2348static constexpr llvm::StringLiteral kProcessPluginName("process");
2349static constexpr llvm::StringLiteral kTracePluginName("trace");
2350static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2351static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2352static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2353static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2354static constexpr llvm::StringLiteral
2355 kStructuredDataPluginName("structured-data");
2356static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2357
2360 llvm::StringRef setting_name) {
2361 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2362}
2363
2365 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2366 llvm::StringRef description, bool is_global_property) {
2368 "Settings for dynamic loader plug-ins",
2369 properties_sp, description, is_global_property);
2370}
2371
2374 llvm::StringRef setting_name) {
2375 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2377}
2378
2380 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2381 llvm::StringRef description, bool is_global_property) {
2383 "Settings for platform plug-ins", properties_sp,
2384 description, is_global_property,
2386}
2387
2390 llvm::StringRef setting_name) {
2391 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2392}
2393
2395 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2396 llvm::StringRef description, bool is_global_property) {
2398 "Settings for process plug-ins", properties_sp,
2399 description, is_global_property);
2400}
2401
2404 llvm::StringRef setting_name) {
2405 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2406}
2407
2409 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2410 llvm::StringRef description, bool is_global_property) {
2412 "Settings for symbol locator plug-ins",
2413 properties_sp, description, is_global_property);
2414}
2415
2417 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2418 llvm::StringRef description, bool is_global_property) {
2420 "Settings for trace plug-ins", properties_sp,
2421 description, is_global_property);
2422}
2423
2426 llvm::StringRef setting_name) {
2427 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2428}
2429
2431 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2432 llvm::StringRef description, bool is_global_property) {
2434 "Settings for object file plug-ins",
2435 properties_sp, description, is_global_property);
2436}
2437
2440 llvm::StringRef setting_name) {
2441 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2442}
2443
2445 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2446 llvm::StringRef description, bool is_global_property) {
2448 "Settings for symbol file plug-ins",
2449 properties_sp, description, is_global_property);
2450}
2451
2454 llvm::StringRef setting_name) {
2455 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2456}
2457
2459 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2460 llvm::StringRef description, bool is_global_property) {
2462 "Settings for JIT loader plug-ins",
2463 properties_sp, description, is_global_property);
2464}
2465
2466static const char *kOperatingSystemPluginName("os");
2467
2469 Debugger &debugger, llvm::StringRef setting_name) {
2470 lldb::OptionValuePropertiesSP properties_sp;
2471 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2474 "", // not creating to so we don't need the description
2475 false));
2476 if (plugin_type_properties_sp)
2477 properties_sp =
2478 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2479 return properties_sp;
2480}
2481
2483 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2484 llvm::StringRef description, bool is_global_property) {
2485 if (properties_sp) {
2486 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2488 "Settings for operating system plug-ins",
2489 true));
2490 if (plugin_type_properties_sp) {
2491 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2492 description, is_global_property,
2493 properties_sp);
2494 return true;
2495 }
2496 }
2497 return false;
2498}
2499
2502 llvm::StringRef setting_name) {
2503 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2504}
2505
2507 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2508 llvm::StringRef description, bool is_global_property) {
2510 "Settings for structured data plug-ins",
2511 properties_sp, description, is_global_property);
2512}
2513
2516 Debugger &debugger, llvm::StringRef setting_name) {
2517 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2518}
2519
2521 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2522 llvm::StringRef description, bool is_global_property) {
2524 "Settings for CPlusPlus language plug-ins",
2525 properties_sp, description, is_global_property);
2526}
2527
2528//
2529// Plugin Info+Enable Implementations
2530//
2531llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2533}
2534bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2535 return GetABIInstances().SetInstanceEnabled(name, enable);
2536}
2537
2538llvm::SmallVector<RegisteredPluginInfo>
2543 bool enable) {
2544 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2545}
2546
2547llvm::SmallVector<RegisteredPluginInfo>
2552 bool enable) {
2553 return GetBugReporterInstances().SetInstanceEnabled(name, enable);
2554}
2555
2556llvm::SmallVector<RegisteredPluginInfo>
2561 bool enable) {
2562 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2563}
2564
2565llvm::SmallVector<RegisteredPluginInfo>
2570 bool enable) {
2571 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2572}
2573
2574llvm::SmallVector<RegisteredPluginInfo>
2579 bool enable) {
2581}
2582
2583llvm::SmallVector<RegisteredPluginInfo>
2587
2589 switch (kind) {
2591 return "global";
2593 return "debugger";
2595 return "target";
2596 }
2597 llvm_unreachable("unhandled PluginDomainKind");
2598}
2599
2601 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2602 PluginDomainKind domain) {
2603 if (domain != lldb::ePluginDomainKindGlobal)
2604 return llvm::createStringErrorV("{} domain is not supported",
2605 PluginDomainKindToStr(domain));
2606 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2607 return llvm::createStringError("plugin could not be found");
2608
2609 return llvm::Error::success();
2610}
2611
2612llvm::SmallVector<RegisteredPluginInfo>
2617 bool enable) {
2618 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2619}
2620
2621llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2623}
2625 bool enable) {
2626 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2627}
2628
2629llvm::SmallVector<RegisteredPluginInfo>
2634 bool enable) {
2635 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2636}
2637
2638llvm::SmallVector<RegisteredPluginInfo>
2643 bool enable) {
2644 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2645}
2646
2647llvm::SmallVector<RegisteredPluginInfo>
2652 bool enable) {
2653 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2654}
2655
2656llvm::SmallVector<RegisteredPluginInfo>
2661 bool enable) {
2662 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2663}
2664
2665llvm::SmallVector<RegisteredPluginInfo>
2670 bool enable) {
2671 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2672}
2673
2674llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2676}
2678 bool enable) {
2679 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2680}
2681
2682llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2684}
2685bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2686 return GetProcessInstances().SetInstanceEnabled(name, enable);
2687}
2688
2689llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2691}
2692bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2693 return GetREPLInstances().SetInstanceEnabled(name, enable);
2694}
2695
2696llvm::SmallVector<RegisteredPluginInfo>
2701 bool enable) {
2703}
2704
2705llvm::SmallVector<RegisteredPluginInfo>
2710 bool enable) {
2712}
2713
2714llvm::SmallVector<RegisteredPluginInfo>
2719 bool enable) {
2721}
2722
2723llvm::SmallVector<RegisteredPluginInfo>
2728 bool enable) {
2730}
2731
2732llvm::SmallVector<RegisteredPluginInfo>
2737 bool enable) {
2738 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2739}
2740
2741llvm::SmallVector<RegisteredPluginInfo>
2746 bool enable) {
2747 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2748}
2749
2750llvm::SmallVector<RegisteredPluginInfo>
2755 bool enable) {
2756 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2757}
2758
2759llvm::SmallVector<RegisteredPluginInfo>
2764 bool enable) {
2765 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2766}
2767
2768llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2770}
2771bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2772 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2773}
2774
2775llvm::SmallVector<RegisteredPluginInfo>
2780 bool enable) {
2781 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2782}
2783
2784llvm::SmallVector<RegisteredPluginInfo>
2789 bool enable) {
2790 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2791}
2792
2793llvm::SmallVector<RegisteredPluginInfo>
2798 bool enable) {
2799 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2800}
2801
2803 CompletionRequest &request) {
2804 // Split the name into the namespace and the plugin name.
2805 // If there is no dot then the ns_name will be equal to name and
2806 // plugin_prefix will be empty.
2807 llvm::StringRef ns_name, plugin_prefix;
2808 std::tie(ns_name, plugin_prefix) = name.split('.');
2809
2810 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2811 // If the plugin namespace matches exactly then
2812 // add all the plugins in this namespace as completions if the
2813 // plugin names starts with the plugin_prefix. If the plugin_prefix
2814 // is empty then it will match all the plugins (empty string is a
2815 // prefix of everything).
2816 if (plugin_ns.name == ns_name) {
2817 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2818 llvm::SmallString<128> buf;
2819 if (plugin.name.starts_with(plugin_prefix))
2820 request.AddCompletion(
2821 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2822 }
2823 } else if (plugin_ns.name.starts_with(name) &&
2824 !plugin_ns.get_info().empty()) {
2825 // Otherwise check if the namespace is a prefix of the full name.
2826 // Use a partial completion here so that we can either operate on the full
2827 // namespace or tab-complete to the next level.
2828 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2829 }
2830 }
2831}
static llvm::raw_ostream & error(Stream &strm)
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
Definition Debugger.cpp:907
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:405
static BugReporterInstances & GetBugReporterInstances()
static DisassemblerInstances & GetDisassemblerInstances()
PluginInstances< ProtocolServerInstance > ProtocolServerInstances
static TraceInstances & GetTracePluginInstances()
static ObjectContainerInstances & GetObjectContainerInstances()
PluginInstances< JITLoaderInstance > JITLoaderInstances
static MemoryHistoryInstances & GetMemoryHistoryInstances()
PluginInstance< PlatformCreateInstance > PlatformInstance
PluginInstances< HighlighterInstance > HighlighterInstances
static DynamicLoaderInstances & GetDynamicLoaderInstances()
PluginInstances< SymbolFileInstance > SymbolFileInstances
PluginInstances< TypeSystemInstance > TypeSystemInstances
PluginInstance< ABICreateInstance > ABIInstance
static SystemRuntimeInstances & GetSystemRuntimeInstances()
PluginInstances< TraceExporterInstance > TraceExporterInstances
static constexpr llvm::StringLiteral kPlatformPluginName("platform")
static constexpr llvm::StringLiteral g_plugin_prefix
PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
static ABIInstances & GetABIInstances()
static constexpr llvm::StringLiteral kProcessPluginName("process")
PluginInstances< SymbolVendorInstance > SymbolVendorInstances
static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader")
static lldb::OptionValuePropertiesSP GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name, llvm::StringRef plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static ScriptInterpreterInstances & GetScriptInterpreterInstances()
PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
PluginInstances< PlatformInstance > PlatformInstances
PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus")
PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
static TraceExporterInstances & GetTraceExporterInstances()
PluginInstance< LanguageCreateInstance > LanguageInstance
PluginInstances< BugReporterInstance > BugReporterInstances
PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator")
PluginInstances< ObjectFileInstance > ObjectFileInstances
void(* PluginTermCallback)()
static StructuredDataPluginInstances & GetStructuredDataPluginInstances()
static constexpr llvm::StringLiteral kObjectFilePluginName("object-file")
PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
PluginInstances< LanguageInstance > LanguageInstances
PluginInstances< TraceInstance > TraceInstances
PluginInstances< ArchitectureInstance > ArchitectureInstances
PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
static constexpr llvm::StringLiteral kStructuredDataPluginName("structured-data")
PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
static const char * kOperatingSystemPluginName("os")
static SymbolLocatorInstances & GetSymbolLocatorInstances()
PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
static ObjectFileInstances & GetObjectFileInstances()
static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file")
PluginInstances< SymbolLocatorInstance > SymbolLocatorInstances
PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
static EmulateInstructionInstances & GetEmulateInstructionInstances()
PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
static LanguageInstances & GetLanguageInstances()
static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader")
static ScriptedFrameProviderInstances & GetScriptedFrameProviderInstances()
PluginInstances< OperatingSystemInstance > OperatingSystemInstances
static LanguageRuntimeInstances & GetLanguageRuntimeInstances()
PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances()
PluginInstances< ProcessInstance > ProcessInstances
PluginInstances< SyntheticFrameProviderInstance > SyntheticFrameProviderInstances
PluginInstances< REPLInstance > REPLInstances
static ArchitectureInstances & GetArchitectureInstances()
static DynamicPluginMap & GetPluginMap()
PluginInstances< ScriptedFrameProviderInstance > ScriptedFrameProviderInstances
PluginInstance< BugReporterCreateInstance > BugReporterInstance
static PluginRegistry & GetPluginRegistry()
static RegisterTypeBuilderInstances & GetRegisterTypeBuilderInstances()
static std::recursive_mutex & GetPluginMapMutex()
llvm::SmallDenseMap< FileSpec, PluginInfo > DynamicPluginMap
static HighlighterInstances & GetHighlighterInstances()
static TypeSystemInstances & GetTypeSystemInstances()
static PlatformInstances & GetPlatformInstances()
static ScriptedInterfaceInstances & GetScriptedInterfaceInstances()
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
PluginInstances< EmulateInstructionInstance > EmulateInstructionInstances
PluginInstance< SyntheticFrameProviderCreateInstance > SyntheticFrameProviderInstance
static JITLoaderInstances & GetJITLoaderInstances()
PluginInstances< DisassemblerInstance > DisassemblerInstances
PluginInstance< ProcessCreateInstance > ProcessInstance
static UnwindAssemblyInstances & GetUnwindAssemblyInstances()
static void SetPluginInfo(const FileSpec &plugin_file_spec, PluginInfo plugin_info)
PluginInstances< ScriptedInterfaceInstance > ScriptedInterfaceInstances
PluginInstances< UnwindAssemblyInstance > UnwindAssemblyInstances
static SymbolFileInstances & GetSymbolFileInstances()
static bool CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
PluginInstances< ABIInstance > ABIInstances
static FPtrTy CastToFPtr(void *VPtr)
static ProcessInstances & GetProcessInstances()
static bool PluginIsLoaded(const FileSpec &plugin_file_spec)
static OperatingSystemInstances & GetOperatingSystemInstances()
static constexpr llvm::StringLiteral kTracePluginName("trace")
PluginInstance< ScriptedFrameProviderCreateInstance > ScriptedFrameProviderInstance
PluginInstances< ScriptInterpreterInstance > ScriptInterpreterInstances
static SyntheticFrameProviderInstances & GetSyntheticFrameProviderInstances()
bool(* PluginInitCallback)()
PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
static SymbolVendorInstances & GetSymbolVendorInstances()
PluginInstances< ObjectContainerInstance > ObjectContainerInstances
static ProtocolServerInstances & GetProtocolServerInstances()
PluginInstances< RegisterTypeBuilderInstance > RegisterTypeBuilderInstances
static REPLInstances & GetREPLInstances()
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
bool UnregisterPlugin(typename Instance::CallbackType callback)
std::optional< ABIInstance > FindInstance(std::function< bool(const ABIInstance &)> predicate) const
llvm::StringRef GetNameAtIndex(uint32_t idx)
llvm::SmallVector< ABIInstance > m_instances
llvm::StringRef GetDescriptionAtIndex(uint32_t idx)
llvm::SmallVector< typename Instance::CallbackType > GetCreateCallbacks()
std::optional< ABIInstance > GetInstanceAtIndex(uint32_t idx)
llvm::SmallVector< RegisteredPluginInfo > GetPluginInfoForAllInstances()
Instance::CallbackType GetCallbackForName(llvm::StringRef name)
llvm::SmallVector< ABIInstance > GetSnapshot(bool enabled_only=true) const
bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, typename Instance::CallbackType callback, Args &&...args)
void PerformDebuggerCallback(Debugger &debugger)
std::optional< ABIInstance > FindEnabledInstance(std::function< bool(const ABIInstance &)> predicate) const
std::optional< ABIInstance > GetInstanceForName(llvm::StringRef name, bool enabled_only=true)
bool SetInstanceEnabled(llvm::StringRef name, bool enable)
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
A class to manage flag bits.
Definition Debugger.h:103
A class that measures elapsed time in an exception safe way.
Definition Statistics.h:76
A file collection class.
A file utility class.
Definition FileSpec.h:56
llvm::StringRef GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:414
llvm::StringRef GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:248
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:380
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp:410
void EnumerateDirectory(llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
@ eEnumerateDirectoryResultEnter
Recurse into the current entry if it is a directory or symlink, or next if not.
Definition FileSystem.h:185
@ eEnumerateDirectoryResultNext
Enumerate next entry in the current directory.
Definition FileSystem.h:182
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
void Resolve(llvm::SmallVectorImpl< char > &path, bool force_make_absolute=false)
Resolve path to make it canonical.
static bool SetArchitecturePluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx)
static bool SetPlatformPluginEnabled(llvm::StringRef name, bool enable)
static bool SetScriptInterpreterPluginEnabled(llvm::StringRef name, bool enable)
static bool MatchPluginName(llvm::StringRef pattern, const PluginNamespace &plugin_ns, const RegisteredPluginInfo &plugin)
static lldb::OptionValuePropertiesSP GetSettingForStructuredDataPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetMemoryHistoryPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetSystemRuntimePluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetTypeSystemPluginInfo()
static void AutoCompleteScriptedExtension(llvm::StringRef partial_name, CompletionRequest &request, lldb::ScriptLanguage language=lldb::eScriptLanguageUnknown)
static bool CreateSettingForJITLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetRegisterTypeBuilderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::StringRef PluginDomainKindToStr(lldb::PluginDomainKind kind)
static bool SetTraceExporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetArchitecturePluginInfo()
static void ForEachScriptedExtension(llvm::function_ref< void(const ScriptedInterfaceInstance &)> callback, lldb::ScriptLanguage language=lldb::eScriptLanguageUnknown)
Invoke callback once per registered scripted extension, passing the first interface registered for it...
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< UnwindAssemblyCreateInstance > GetUnwindAssemblyCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForObjectFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetEmulateInstructionPluginInfo()
static void AutoCompletePlatformName(llvm::StringRef partial_name, CompletionRequest &request)
static TraceExporterCreateInstance GetTraceExporterCreateCallback(llvm::StringRef plugin_name)
static bool SetDynamicLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::json::Object GetJSON(llvm::StringRef pattern="")
static bool CreateSettingForObjectFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetScriptedInterfacePluginEnabled(llvm::StringRef name, bool enable)
static bool SetOperatingSystemPluginEnabled(llvm::StringRef name, bool enable)
static lldb::ScriptInterpreterSP GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, Debugger &debugger)
static llvm::SmallVector< ABICreateInstance > GetABICreateCallbacks()
static llvm::SmallVector< InstrumentationRuntimeCallbacks > GetInstrumentationRuntimeCallbacks(bool enabled_only=true)
static void AutoCompleteProcessName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptInterpreterPluginInfo()
static bool SetBugReporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetABIPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguagePluginInfo()
static LanguageSet GetREPLAllTypeSystemSupportedLanguages()
static llvm::SmallVector< OperatingSystemCreateInstance > GetOperatingSystemCreateCallbacks()
static bool CreateSettingForTracePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetDynamicLoaderPluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::Error SetInstrumentationRuntimePluginEnabled(llvm::StringRef name, bool enable, Debugger &requesting_debugger, lldb::PluginDomainKind domain)
static llvm::SmallVector< ProcessCreateInstance > GetProcessCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetObjectContainerPluginInfo()
static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Status &error, bool force_lookup=true, bool copy_executable=true)
static llvm::SmallVector< RegisteredPluginInfo > GetDisassemblerPluginInfo()
static llvm::SmallVector< LanguageRuntimeCallbacks > GetLanguageRuntimeCallbacks()
static llvm::SmallVector< SymbolFileCreateInstance > GetSymbolFileCreateCallbacks()
static bool SetLanguageRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetObjectFilePluginInfo()
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolLocatorPluginInfo()
static llvm::StringRef GetTraceSchema(llvm::StringRef plugin_name)
Get the JSON schema for a trace bundle description file corresponding to the given plugin.
static llvm::SmallVector< SymbolVendorCreateInstance > GetSymbolVendorCreateCallbacks()
static bool SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForCPlusPlusLanguagePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetDisassemblerPluginEnabled(llvm::StringRef name, bool enable)
static bool SetSystemRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetTracePluginInfo()
static llvm::SmallVector< JITLoaderCreateInstance > GetJITLoaderCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetProcessPluginInfo()
static TraceCreateInstanceForLiveProcess GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name)
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static llvm::SmallVector< DisassemblerCreateInstance > GetDisassemblerCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForSymbolLocatorPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetStructuredDataPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ObjectFileCallbacks > GetObjectFileCallbacks()
static 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 size_t GetNumScriptedInterfaces()
static bool CreateSettingForCPlusPlusLanguagePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< TraceExporterCallbacks > GetTraceExporterCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolVendorPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetBugReporterPluginInfo()
static DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
static PlatformCreateInstance GetPlatformCreateCallbackForPluginName(llvm::StringRef name)
static bool SetProcessPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< llvm::StringRef > GetSaveCorePluginNames()
static llvm::SmallVector< RegisteredPluginInfo > GetOperatingSystemPluginInfo()
static llvm::SmallVector< ScriptedFrameProviderCreateInstance > GetScriptedFrameProviderCreateCallbacks()
static bool SetABIPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptedInterfacePluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name)
static ProcessCreateInstance GetProcessCreateCallbackForPluginName(llvm::StringRef name)
static lldb::ScriptedExtension GetScriptedInterfaceExtensionAtIndex(uint32_t idx)
static void AutoCompletePluginName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProtocolServerPluginNameAtIndex(uint32_t idx)
static bool IsRegisteredObjectFilePluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetLanguagePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetREPLPluginInfo()
static bool SetREPLPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< HighlighterCreateInstance > GetHighlighterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetUnwindAssemblyPluginInfo()
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static bool SetSymbolVendorPluginEnabled(llvm::StringRef name, bool enable)
static TraceCreateInstanceFromBundle GetTraceCreateCallback(llvm::StringRef plugin_name)
static void DebuggerInitialize(Debugger &debugger)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static llvm::SmallVector< ObjectContainerCallbacks > GetObjectContainerCallbacks()
static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
static llvm::SmallVector< StructuredDataPluginCallbacks > GetStructuredDataPluginCallbacks()
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
static llvm::SmallVector< SystemRuntimeCreateInstance > GetSystemRuntimeCreateCallbacks()
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
static llvm::SmallVector< RegisteredPluginInfo > GetStructuredDataPluginInfo()
static bool SetSymbolLocatorPluginEnabled(llvm::StringRef name, bool enable)
static ProtocolServerCreateInstance GetProtocolCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< LanguageCreateInstance > GetLanguageCreateCallbacks()
static std::unique_ptr< BugReporter > CreateBugReporterInstance(llvm::StringRef name={})
static llvm::SmallVector< DynamicLoaderCreateInstance > GetDynamicLoaderCreateCallbacks()
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
static llvm::SmallVector< MemoryHistoryCreateInstance > GetMemoryHistoryCreateCallbacks()
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name)
static bool CreateSettingForSymbolLocatorPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetJITLoaderPluginInfo()
static bool SetObjectFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< PlatformCreateInstance > GetPlatformCreateCallbacks()
lldb::OptionValuePropertiesSP GetValueProperties() const
const std::optional< lldb_private::FileSpec > GetOutputFile() const
std::optional< std::string > GetPluginName() const
lldb::ProcessSP GetProcess() const
static llvm::StringLiteral ExtensionToString(lldb::ScriptedExtension extension)
A class to count time for plugins.
Definition Statistics.h:94
void add(llvm::StringRef key, double value)
Definition Statistics.h:96
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
Represents UUID's of various sizes.
Definition UUID.h:27
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:338
SymbolVendor *(* SymbolVendorCreateInstance)(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
bool(* ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, lldb_private::SaveCoreOptions &options, Status &error)
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceForLiveProcess)(Process &process)
FileSpec(* ScriptInterpreterGetPath)()
lldb::RegisterTypeBuilderSP(* RegisterTypeBuilderCreateInstance)(Target &target)
lldb::ProtocolServerUP(* ProtocolServerCreateInstance)()
LanguageRuntime *(* LanguageRuntimeCreateInstance)(Process *process, lldb::LanguageType language)
lldb::InstrumentationRuntimeType(* InstrumentationRuntimeGetType)()
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceFromBundle)(const llvm::json::Value &trace_bundle_description, llvm::StringRef session_file_dir, lldb_private::Debugger &debugger)
Trace.
lldb::DisassemblerSP(* DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor, const char *cpu, const char *features)
std::optional< FileSpec >(* SymbolLocatorLocateExecutableSymbolFile)(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
EmulateInstruction *(* EmulateInstructionCreateInstance)(const ArchSpec &arch, InstructionType inst_type)
ObjectContainer *(* ObjectContainerCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
void(* DebuggerInitializeCallback)(Debugger &debugger)
std::unique_ptr< Architecture >(* ArchitectureCreateInstance)(const ArchSpec &arch)
lldb::ScriptInterpreterSP(* ScriptInterpreterCreateInstance)(Debugger &debugger)
lldb::PlatformSP(* PlatformCreateInstance)(bool force, const ArchSpec *arch)
bool(* ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
SystemRuntime *(* SystemRuntimeCreateInstance)(Process *process)
lldb::ProcessSP(* ProcessCreateInstance)(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
UnwindAssembly *(* UnwindAssemblyCreateInstance)(const ArchSpec &arch)
lldb::TypeSystemSP(* TypeSystemCreateInstance)(lldb::LanguageType language, Module *module, Target *target)
lldb::BreakpointPreconditionSP(* LanguageRuntimeGetExceptionPrecondition)(lldb::LanguageType language, bool throw_bp)
ObjectContainer *(* ObjectContainerCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
lldb::MemoryHistorySP(* MemoryHistoryCreateInstance)(const lldb::ProcessSP &process_sp)
ObjectFile *(* ObjectFileCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
SymbolLocator *(* SymbolLocatorCreateInstance)()
std::unique_ptr< BugReporter >(* BugReporterCreateInstance)()
std::optional< ModuleSpec >(* SymbolLocatorLocateExecutableObjectFile)(const ModuleSpec &module_spec)
@ Partial
The current token has been partially completed.
lldb::CommandObjectSP(* LanguageRuntimeGetCommandObject)(CommandInterpreter &interpreter)
DynamicLoader *(* DynamicLoaderCreateInstance)(Process *process, bool force)
lldb::StructuredDataPluginSP(* StructuredDataPluginCreateInstance)(Process &process)
lldb::JITLoaderSP(* JITLoaderCreateInstance)(Process *process, bool force)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* SyntheticFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const std::vector< lldb_private::ThreadSpec > &thread_specs)
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
lldb::REPLSP(* REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
SymbolFile *(* SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp)
llvm::Expected< lldb::TraceExporterUP >(* TraceExporterCreateInstance)()
Highlighter *(* HighlighterCreateInstance)(lldb::LanguageType language)
std::optional< FileSpec >(* SymbolLocatorFindSymbolFileInBundle)(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
bool(* SymbolLocatorDownloadObjectAndSymbolFile)(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
Status(* StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, Target *target)
ObjectFile *(* ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
ModuleSpecList(* ObjectFileGetModuleSpecifications)(const FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t file_offset, lldb::offset_t length)
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* ScriptedFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const lldb_private::ScriptedFrameProviderDescriptor &descriptor)
lldb::CommandObjectSP(* ThreadTraceExportCommandCreator)(CommandInterpreter &interpreter)
lldb::InstrumentationRuntimeSP(* InstrumentationRuntimeCreateInstance)(const lldb::ProcessSP &process_sp)
ScriptLanguage
Script interpreter types.
@ eScriptLanguageUnknown
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
ScriptedExtension
Scripting extension types.
@ eScriptedExtensionInvalid
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
@ ePluginDomainKindTarget
@ ePluginDomainKindGlobal
@ ePluginDomainKindDebugger
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
HighlighterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
InstrumentationRuntimeGetType get_type_callback
InstrumentationRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, InstrumentationRuntimeGetType get_type_callback)
InstrumentationRuntimeGetType GetTypeCallbackForName(llvm::StringRef name, bool enabled_only)
LanguageRuntimeGetExceptionPrecondition precondition_callback
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
LanguageRuntimeGetCommandObject command_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
ObjectContainerCreateMemoryInstance create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
ObjectFileSaveCore save_core
PluginDir(FileSpec path, LoadPolicy policy)
const LoadPolicy policy
Filter when looking for plugins.
const FileSpec path
The path to the plugin directory.
@ LoadOnlyWithLLDBPrefix
Only load shared libraries who's filename start with g_plugin_prefix.
@ LoadAnyDylib
Try to load anything that looks like a shared library.
PluginTermCallback plugin_term_callback
PluginInfo()=default
llvm::sys::DynamicLibrary library
PluginInfo & operator=(PluginInfo &&other)
PluginInitCallback plugin_init_callback
PluginInfo(const PluginInfo &)=delete
PluginInfo(PluginInfo &&other)
static llvm::Expected< PluginInfo > Create(const FileSpec &path)
PluginInfo & operator=(const PluginInfo &)=delete
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
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
StructuredDataFilterLaunchInfo filter_callback
SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle
SymbolLocatorInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, SymbolLocatorLocateExecutableObjectFile locate_executable_object_file, SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file, SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file, SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle, DebuggerInitializeCallback debugger_init_callback)
SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file
SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file
SymbolLocatorLocateExecutableObjectFile locate_executable_object_file
ThreadTraceExportCommandCreator create_thread_trace_export_command
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
llvm::StringRef schema
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback)
TraceCreateInstanceForLiveProcess create_callback_for_live_process
LanguageSet supported_languages_for_expressions
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions, DebuggerInitializeCallback debugger_init_callback)
LanguageSet supported_languages_for_types
A SmallBitVector that represents a set of source languages (lldb::LanguageType).