LLDB mainline
PluginManager.cpp
Go to the documentation of this file.
1//===-- PluginManager.cpp -------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11#include "lldb/Core/Debugger.h"
13#include "lldb/Host/HostInfo.h"
16#include "lldb/Target/Process.h"
18#include "lldb/Utility/Status.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/ADT/Twine.h"
22#include "llvm/Support/DynamicLibrary.h"
23#include "llvm/Support/ErrorExtras.h"
24#include "llvm/Support/FileSystem.h"
25#include "llvm/Support/raw_ostream.h"
26#include <cassert>
27#include <memory>
28#include <mutex>
29#include <string>
30#include <utility>
31#if defined(_WIN32)
33#endif
34
35using namespace lldb;
36using namespace lldb_private;
37
39typedef void (*PluginTermCallback)();
40
41struct PluginInfo {
42 PluginInfo() = default;
43
44 PluginInfo(const PluginInfo &) = delete;
45 PluginInfo &operator=(const PluginInfo &) = delete;
46
48 : library(std::move(other.library)),
50 std::exchange(other.plugin_init_callback, nullptr)),
52 std::exchange(other.plugin_term_callback, nullptr)) {}
53
55 library = std::move(other.library);
56 plugin_init_callback = std::exchange(other.plugin_init_callback, nullptr);
57 plugin_term_callback = std::exchange(other.plugin_term_callback, nullptr);
58 return *this;
59 }
60
62 if (!library.isValid())
63 return;
65 return;
67 }
68
69 static llvm::Expected<PluginInfo> Create(const FileSpec &path);
70
71private:
72 llvm::sys::DynamicLibrary library;
75};
76
77typedef llvm::SmallDenseMap<FileSpec, PluginInfo> DynamicPluginMap;
78
79static std::recursive_mutex &GetPluginMapMutex() {
80 static std::recursive_mutex g_plugin_map_mutex;
81 return g_plugin_map_mutex;
82}
83
85 static DynamicPluginMap g_plugin_map;
86 return g_plugin_map;
87}
88
89static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
90 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
91 return GetPluginMap().contains(plugin_file_spec);
92}
93
94static void SetPluginInfo(const FileSpec &plugin_file_spec,
95 PluginInfo plugin_info) {
96 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
97 DynamicPluginMap &plugin_map = GetPluginMap();
98 assert(!plugin_map.contains(plugin_file_spec));
99 plugin_map.try_emplace(plugin_file_spec, std::move(plugin_info));
100}
101
102template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
103 return reinterpret_cast<FPtrTy>(VPtr);
104}
105
106static constexpr llvm::StringLiteral g_plugin_prefix = "liblldbPlugin";
107struct PluginDir {
109 /// Try to load anything that looks like a shared library.
111
112 /// Only load shared libraries who's filename start with g_plugin_prefix.
114 };
115
118
119 explicit operator bool() const { return FileSystem::Instance().Exists(path); }
120
121 /// The path to the plugin directory.
123
124 /// Filter when looking for plugins.
126};
127
128llvm::Expected<PluginInfo> PluginInfo::Create(const FileSpec &path) {
129 PluginInfo plugin_info;
130 std::string error;
131 plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
132 path.GetPath().c_str(), &error);
133 if (!plugin_info.library.isValid())
134 return llvm::createStringError(error);
135
136 // Look for files that follow the convention <g_plugin_prefix><name>.<ext>, in
137 // which case we need to call lldb_initialize_<name> and
138 // lldb_terminate_<name>.
139 llvm::StringRef file_name =
141 if (file_name.starts_with(g_plugin_prefix)) {
142 llvm::StringRef plugin_name = file_name.substr(g_plugin_prefix.size());
143 std::string init_symbol =
144 llvm::Twine("lldb_initialize_" + plugin_name).str();
145
146 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
147 plugin_info.library.getAddressOfSymbol(init_symbol.c_str()))) {
148 if (!init_fn())
149 return llvm::createStringErrorV("initializer '{0}' returned false",
150 init_symbol);
151 const std::string term_symbol =
152 llvm::Twine("lldb_terminate_" + plugin_name).str();
154 plugin_info.library.getAddressOfSymbol(term_symbol.c_str()));
155 }
156 return plugin_info;
157 }
158
159 // Look for the legacy LLDBPluginInitialize/LLDBPluginTerminate symbols.
160 if (auto *init_fn = CastToFPtr<PluginInitCallback>(
161 plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"))) {
162 if (!init_fn())
163 return llvm::createStringError(
164 "initializer 'LLDBPluginInitialize' returned false");
165
166 plugin_info.plugin_init_callback = init_fn;
168 plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
169 return plugin_info;
170 }
171
172 return llvm::createStringError("no initialize symbol found");
173}
174
176LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
177 llvm::StringRef path) {
178 namespace fs = llvm::sys::fs;
179
180 static constexpr std::array<llvm::StringLiteral, 3>
181 g_shared_library_extension = {".dylib", ".so", ".dll"};
182
183 // If we have a regular file, a symbolic link or unknown file type, try and
184 // process the file. We must handle unknown as sometimes the directory
185 // enumeration might be enumerating a file system that doesn't have correct
186 // file type information.
187 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
188 ft == fs::file_type::type_unknown) {
189 FileSpec plugin_file_spec(path);
190 FileSystem::Instance().Resolve(plugin_file_spec);
191
192 // Don't try to load unknown extensions.
193 if (!llvm::is_contained(g_shared_library_extension,
194 plugin_file_spec.GetFileNameExtension()))
196
197 // Don't try to load libraries that don't start with g_plugin_prefix if so
198 // requested.
200 if (*policy == PluginDir::LoadOnlyWithLLDBPrefix &&
201 !plugin_file_spec.GetFilename().GetStringRef().starts_with(
204
205 // Don't try to load an already loaded plugin again.
206 if (PluginIsLoaded(plugin_file_spec))
208
209 llvm::Expected<PluginInfo> plugin_info =
210 PluginInfo::Create(plugin_file_spec);
211 if (plugin_info) {
212 SetPluginInfo(plugin_file_spec, std::move(*plugin_info));
213 } else {
214 // Cache an empty plugin info so we don't try to load it again and again.
215 SetPluginInfo(plugin_file_spec, PluginInfo());
216
217 LLDB_LOG_ERROR(GetLog(LLDBLog::Host), plugin_info.takeError(),
218 "could not load plugin: {0}");
219 }
220
222 }
223
224 if (ft == fs::file_type::directory_file ||
225 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
226 // Try and recurse into anything that a directory or symbolic link. We must
227 // also do this for unknown as sometimes the directory enumeration might be
228 // enumerating a file system that doesn't have correct file type
229 // information.
231 }
232
234}
235
237 static const bool find_directories = true;
238 static const bool find_files = true;
239 static const bool find_other = true;
240
241 // Directories to scan for plugins. Unlike the plugin directories, which are
242 // meant exclusively for LLDB, the shared library directory is likely to
243 // contain unrelated shared libraries that we do not want to load. Therefore,
244 // limit the scan to libraries that start with g_plugin_prefix.
245 const std::array<PluginDir, 3> plugin_dirs = {
246 PluginDir(HostInfo::GetShlibDir(), PluginDir::LoadOnlyWithLLDBPrefix),
247 PluginDir(HostInfo::GetSystemPluginDir(), PluginDir::LoadAnyDylib),
248 PluginDir(HostInfo::GetUserPluginDir(), PluginDir::LoadAnyDylib)};
249
250 for (const PluginDir &plugin_dir : plugin_dirs) {
251 if (plugin_dir) {
253 plugin_dir.path.GetPath().c_str(), find_directories, find_files,
254 find_other, LoadPluginCallback, (void *)&plugin_dir.policy);
255 }
256 }
257}
258
260 std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
261 GetPluginMap().clear();
262}
263
264llvm::ArrayRef<PluginNamespace> PluginManager::GetPluginNamespaces() {
265 static PluginNamespace PluginNamespaces[] = {
266
267 {
268 "abi",
271 },
272
273 {
274 "architecture",
277 },
278
279 {
280 "disassembler",
283 },
284
285 {
286 "dynamic-loader",
289 },
290
291 {
292 "emulate-instruction",
295 },
296
297 {
298 "instrumentation-runtime",
301 },
302
303 {
304 "jit-loader",
307 },
308
309 {
310 "language",
313 },
314
315 {
316 "language-runtime",
319 },
320
321 {
322 "memory-history",
325 },
326
327 {
328 "object-container",
331 },
332
333 {
334 "object-file",
337 },
338
339 {
340 "operating-system",
343 },
344
345 {
346 "platform",
349 },
350
351 {
352 "process",
355 },
356
357 {
358 "repl",
361 },
362
363 {
364 "register-type-builder",
367 },
368
369 {
370 "script-interpreter",
373 },
374
375 {
376 "scripted-interface",
379 },
380
381 {
382 "structured-data",
385 },
386
387 {
388 "symbol-file",
391 },
392
393 {
394 "symbol-locator",
397 },
398
399 {
400 "symbol-vendor",
403 },
404
405 {
406 "system-runtime",
409 },
410
411 {
412 "trace",
415 },
416
417 {
418 "trace-exporter",
421 },
422
423 {
424 "type-system",
427 },
428
429 {
430 "unwind-assembly",
433 },
434 };
435
436 return PluginNamespaces;
437}
438
439llvm::json::Object PluginManager::GetJSON(llvm::StringRef pattern) {
440 llvm::json::Object plugin_stats;
441
442 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
443 llvm::json::Array namespace_stats;
444
445 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
446 if (MatchPluginName(pattern, plugin_ns, plugin)) {
447 llvm::json::Object plugin_json;
448 plugin_json.try_emplace("name", plugin.name);
449 plugin_json.try_emplace("enabled", plugin.enabled);
450 namespace_stats.emplace_back(std::move(plugin_json));
451 }
452 }
453 if (!namespace_stats.empty())
454 plugin_stats.try_emplace(plugin_ns.name, std::move(namespace_stats));
455 }
456
457 return plugin_stats;
458}
459
460bool PluginManager::MatchPluginName(llvm::StringRef pattern,
461 const PluginNamespace &plugin_ns,
462 const RegisteredPluginInfo &plugin_info) {
463 // The empty pattern matches all plugins.
464 if (pattern.empty())
465 return true;
466
467 // Check if the pattern matches the namespace.
468 if (pattern == plugin_ns.name)
469 return true;
470
471 // Check if the pattern matches the qualified name.
472 std::string qualified_name = (plugin_ns.name + "." + plugin_info.name).str();
473 return pattern == qualified_name;
474}
475
476template <typename Callback> struct PluginInstance {
477 typedef Callback CallbackType;
478
479 PluginInstance() = default;
486
487 llvm::StringRef name;
488 llvm::StringRef description;
492};
493
494template <typename Instance> class PluginInstances {
495public:
497#ifndef NDEBUG
498 for (const auto &instance : m_instances)
499 llvm::errs() << llvm::formatv("Use `image lookup -va {0:x}` to find out "
500 "which callback was not removed\n",
501 instance.create_callback);
502#endif
503 assert(m_instances.empty() && "forgot to unregister plugin?");
504 }
505
506 template <typename... Args>
507 bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
508 typename Instance::CallbackType callback,
509 Args &&...args) {
510 if (!callback)
511 return false;
512 assert(!name.empty());
513
514 std::lock_guard<std::mutex> guard(m_mutex);
515 m_instances.emplace_back(name, description, callback,
516 std::forward<Args>(args)...);
517 return true;
518 }
519
520 bool UnregisterPlugin(typename Instance::CallbackType callback) {
521 if (!callback)
522 return false;
523
524 std::lock_guard<std::mutex> guard(m_mutex);
525 auto pos = m_instances.begin();
526 auto end = m_instances.end();
527 for (; pos != end; ++pos) {
528 if (pos->create_callback == callback) {
529 m_instances.erase(pos);
530 return true;
531 }
532 }
533 return false;
534 }
535
536 llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
537 if (auto instance = GetInstanceAtIndex(idx))
538 return instance->description;
539 return "";
540 }
541
542 llvm::StringRef GetNameAtIndex(uint32_t idx) {
543 if (auto instance = GetInstanceAtIndex(idx))
544 return instance->name;
545 return "";
546 }
547
548 typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
549 if (auto instance = GetInstanceForName(name))
550 return instance->create_callback;
551 return nullptr;
552 }
553
554 llvm::SmallVector<typename Instance::CallbackType> GetCreateCallbacks() {
555 llvm::SmallVector<Instance> snapshot = GetSnapshot();
556 llvm::SmallVector<typename Instance::CallbackType> result;
557 result.reserve(snapshot.size());
558 for (const auto &instance : snapshot)
559 result.push_back(instance.create_callback);
560 return result;
561 }
562
564 for (const auto &instance : GetSnapshot()) {
565 if (instance.debugger_init_callback)
566 instance.debugger_init_callback(debugger);
567 }
568 }
569
570 // Return a copy of all the enabled instances.
571 // Note that this is a copy of the internal state so modifications
572 // to the returned instances will not be reflected back to instances
573 // stored by the PluginInstances object.
574 llvm::SmallVector<Instance> GetSnapshot() const {
575 std::lock_guard<std::mutex> guard(m_mutex);
576
577 llvm::SmallVector<Instance> enabled_instances;
578 enabled_instances.reserve(m_instances.size());
579 for (const auto &instance : m_instances) {
580 if (instance.enabled)
581 enabled_instances.push_back(instance);
582 }
583 return enabled_instances;
584 }
585
586 std::optional<Instance> GetInstanceAtIndex(uint32_t idx) {
587 uint32_t count = 0;
588
589 return FindEnabledInstance(
590 [&](const Instance &instance) { return count++ == idx; });
591 }
592
593 std::optional<Instance> GetInstanceForName(llvm::StringRef name) {
594 if (name.empty())
595 return std::nullopt;
596
597 return FindEnabledInstance(
598 [&](const Instance &instance) { return instance.name == name; });
599 }
600
601 std::optional<Instance>
602 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
603 for (const auto &instance : GetSnapshot()) {
604 if (predicate(instance))
605 return instance;
606 }
607 return std::nullopt;
608 }
609
610 // Return a list of all the registered plugin instances. This includes both
611 // enabled and disabled instances. The instances are listed in the order they
612 // were registered which is the order they would be queried if they were all
613 // enabled.
614 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
615 std::lock_guard<std::mutex> guard(m_mutex);
616
617 // Lookup the plugin info for each instance in the sorted order.
618 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
619 plugin_infos.reserve(m_instances.size());
620
621 for (const Instance &instance : m_instances)
622 plugin_infos.push_back(
623 {instance.name, instance.description, instance.enabled});
624
625 return plugin_infos;
626 }
627
628 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
629 std::lock_guard<std::mutex> guard(m_mutex);
630 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
631 return instance.name == name;
632 });
633
634 if (it == m_instances.end())
635 return false;
636
637 it->enabled = enable;
638 return true;
639 }
640
641private:
642 mutable std::mutex m_mutex;
643 llvm::SmallVector<Instance> m_instances;
644};
645
646#pragma mark ABI
647
650
652 static ABIInstances g_instances;
653 return g_instances;
654}
655
656bool PluginManager::RegisterPlugin(llvm::StringRef name,
657 llvm::StringRef description,
658 ABICreateInstance create_callback) {
659 return GetABIInstances().RegisterPlugin(name, description, create_callback);
660}
661
663 return GetABIInstances().UnregisterPlugin(create_callback);
664}
665
666llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
668}
669
670#pragma mark Architecture
671
674
676 static ArchitectureInstances g_instances;
677 return g_instances;
678}
679
680void PluginManager::RegisterPlugin(llvm::StringRef name,
681 llvm::StringRef description,
682 ArchitectureCreateInstance create_callback) {
683 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
684}
685
687 ArchitectureCreateInstance create_callback) {
688 auto &instances = GetArchitectureInstances();
689 instances.UnregisterPlugin(create_callback);
690}
691
692std::unique_ptr<Architecture>
694 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
695 if (auto plugin_up = instances.create_callback(arch))
696 return plugin_up;
697 }
698 return nullptr;
699}
700
701#pragma mark Disassembler
702
705
707 static DisassemblerInstances g_instances;
708 return g_instances;
709}
710
711bool PluginManager::RegisterPlugin(llvm::StringRef name,
712 llvm::StringRef description,
713 DisassemblerCreateInstance create_callback) {
714 return GetDisassemblerInstances().RegisterPlugin(name, description,
715 create_callback);
716}
717
719 DisassemblerCreateInstance create_callback) {
720 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
721}
722
723llvm::SmallVector<DisassemblerCreateInstance>
727
733
734#pragma mark DynamicLoader
735
738
740 static DynamicLoaderInstances g_instances;
741 return g_instances;
742}
743
745 llvm::StringRef name, llvm::StringRef description,
746 DynamicLoaderCreateInstance create_callback,
747 DebuggerInitializeCallback debugger_init_callback) {
749 name, description, create_callback, debugger_init_callback);
750}
751
753 DynamicLoaderCreateInstance create_callback) {
754 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
755}
756
757llvm::SmallVector<DynamicLoaderCreateInstance>
761
767
768#pragma mark JITLoader
769
772
774 static JITLoaderInstances g_instances;
775 return g_instances;
776}
777
779 llvm::StringRef name, llvm::StringRef description,
780 JITLoaderCreateInstance create_callback,
781 DebuggerInitializeCallback debugger_init_callback) {
783 name, description, create_callback, debugger_init_callback);
784}
785
787 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
788}
789
790llvm::SmallVector<JITLoaderCreateInstance>
794
795#pragma mark EmulateInstruction
796
800
802 static EmulateInstructionInstances g_instances;
803 return g_instances;
804}
805
807 llvm::StringRef name, llvm::StringRef description,
808 EmulateInstructionCreateInstance create_callback) {
809 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
810 create_callback);
811}
812
817
818llvm::SmallVector<EmulateInstructionCreateInstance>
822
828
829#pragma mark OperatingSystem
830
833
835 static OperatingSystemInstances g_instances;
836 return g_instances;
837}
838
840 llvm::StringRef name, llvm::StringRef description,
841 OperatingSystemCreateInstance create_callback,
842 DebuggerInitializeCallback debugger_init_callback) {
844 name, description, create_callback, debugger_init_callback);
845}
846
851
852llvm::SmallVector<OperatingSystemCreateInstance>
856
862
863#pragma mark Language
864
867
869 static LanguageInstances g_instances;
870 return g_instances;
871}
872
874 llvm::StringRef name, llvm::StringRef description,
875 LanguageCreateInstance create_callback,
876 DebuggerInitializeCallback debugger_init_callback) {
878 name, description, create_callback, debugger_init_callback);
879}
880
882 return GetLanguageInstances().UnregisterPlugin(create_callback);
883}
884
885llvm::SmallVector<LanguageCreateInstance>
889
890#pragma mark LanguageRuntime
891
908
910
912 static LanguageRuntimeInstances g_instances;
913 return g_instances;
914}
915
917 llvm::StringRef name, llvm::StringRef description,
918 LanguageRuntimeCreateInstance create_callback,
919 LanguageRuntimeGetCommandObject command_callback,
920 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
922 name, description, create_callback, nullptr, command_callback,
923 precondition_callback);
924}
925
930
931llvm::SmallVector<LanguageRuntimeCallbacks>
933 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
934 llvm::SmallVector<LanguageRuntimeCallbacks> result;
935 result.reserve(instances.size());
936 for (auto &instance : instances)
937 result.push_back({instance.create_callback, instance.command_callback,
938 instance.precondition_callback});
939 return result;
940}
941
942#pragma mark SystemRuntime
943
946
948 static SystemRuntimeInstances g_instances;
949 return g_instances;
950}
951
953 llvm::StringRef name, llvm::StringRef description,
954 SystemRuntimeCreateInstance create_callback) {
955 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
956 create_callback);
957}
958
960 SystemRuntimeCreateInstance create_callback) {
961 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
962}
963
964llvm::SmallVector<SystemRuntimeCreateInstance>
968
969#pragma mark ObjectFile
970
990
992 static ObjectFileInstances g_instances;
993 return g_instances;
994}
995
997 if (name.empty())
998 return false;
999
1000 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1001}
1002
1004 llvm::StringRef name, llvm::StringRef description,
1005 ObjectFileCreateInstance create_callback,
1006 ObjectFileCreateMemoryInstance create_memory_callback,
1007 ObjectFileGetModuleSpecifications get_module_specifications,
1008 ObjectFileSaveCore save_core,
1009 DebuggerInitializeCallback debugger_init_callback) {
1011 name, description, create_callback, create_memory_callback,
1012 get_module_specifications, save_core, debugger_init_callback);
1013}
1014
1016 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1017}
1018
1019llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1020 auto instances = GetObjectFileInstances().GetSnapshot();
1021 llvm::SmallVector<ObjectFileCallbacks> result;
1022 result.reserve(instances.size());
1023 for (auto &instance : instances)
1024 result.push_back({instance.create_callback, instance.create_memory_callback,
1025 instance.get_module_specifications, instance.save_core});
1026 return result;
1027}
1028
1031 llvm::StringRef name) {
1032 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1033 return instance->create_memory_callback;
1034 return nullptr;
1035}
1036
1038 Status error;
1039 if (!options.GetOutputFile()) {
1040 error = Status::FromErrorString("No output file specified");
1041 return error;
1042 }
1043
1044 if (!options.GetProcess()) {
1045 error = Status::FromErrorString("Invalid process");
1046 return error;
1047 }
1048
1049 error = options.EnsureValidConfiguration();
1050 if (error.Fail())
1051 return error;
1052
1053 if (!options.GetPluginName().has_value()) {
1054 // Try saving core directly from the process plugin first.
1055 llvm::Expected<bool> ret =
1056 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1057 if (!ret)
1058 return Status::FromError(ret.takeError());
1059 if (ret.get())
1060 return Status();
1061 }
1062
1063 // Fall back to object plugins.
1064 const auto &plugin_name = options.GetPluginName().value_or("");
1065 auto instances = GetObjectFileInstances().GetSnapshot();
1066 for (auto &instance : instances) {
1067 if (plugin_name.empty() || instance.name == plugin_name) {
1068 // TODO: Refactor the instance.save_core() to not require a process and
1069 // get it from options instead.
1070 if (instance.save_core &&
1071 instance.save_core(options.GetProcess(), options, error))
1072 return error;
1073 }
1074 }
1075
1076 // Check to see if any of the object file plugins tried and failed to save.
1077 // if any failure, return the error message.
1078 if (error.Fail())
1079 return error;
1080
1081 // Report only for the plugin that was specified.
1082 if (!plugin_name.empty())
1084 "The \"{}\" plugin is not able to save a core for this process.",
1085 plugin_name);
1086
1088 "no ObjectFile plugins were able to save a core for this process");
1089}
1090
1091llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1092 llvm::SmallVector<llvm::StringRef> plugin_names;
1093 auto instances = GetObjectFileInstances().GetSnapshot();
1094 for (auto &instance : instances) {
1095 if (instance.save_core)
1096 plugin_names.emplace_back(instance.name);
1097 }
1098 return plugin_names;
1099}
1100
1101#pragma mark ObjectContainer
1102
1119
1121 static ObjectContainerInstances g_instances;
1122 return g_instances;
1123}
1124
1126 llvm::StringRef name, llvm::StringRef description,
1127 ObjectContainerCreateInstance create_callback,
1128 ObjectFileGetModuleSpecifications get_module_specifications,
1129 ObjectContainerCreateMemoryInstance create_memory_callback) {
1131 name, description, create_callback, create_memory_callback,
1132 get_module_specifications);
1133}
1134
1136 ObjectContainerCreateInstance create_callback) {
1137 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1138}
1139
1140llvm::SmallVector<ObjectContainerCallbacks>
1142 auto instances = GetObjectContainerInstances().GetSnapshot();
1143 llvm::SmallVector<ObjectContainerCallbacks> result;
1144 result.reserve(instances.size());
1145 for (auto &instance : instances)
1146 result.push_back({instance.create_callback, instance.create_memory_callback,
1147 instance.get_module_specifications});
1148 return result;
1149}
1150
1151#pragma mark Platform
1152
1155
1157 static PlatformInstances g_platform_instances;
1158 return g_platform_instances;
1159}
1160
1162 llvm::StringRef name, llvm::StringRef description,
1163 PlatformCreateInstance create_callback,
1164 DebuggerInitializeCallback debugger_init_callback) {
1166 name, description, create_callback, debugger_init_callback);
1167}
1168
1170 return GetPlatformInstances().UnregisterPlugin(create_callback);
1171}
1172
1173llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1175}
1176
1177llvm::StringRef
1181
1186
1187llvm::SmallVector<PlatformCreateInstance>
1191
1193 CompletionRequest &request) {
1194 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1195 if (instance.name.starts_with(name))
1196 request.AddCompletion(instance.name);
1197 }
1198}
1199
1200#pragma mark Process
1201
1204
1206 static ProcessInstances g_instances;
1207 return g_instances;
1208}
1209
1211 llvm::StringRef name, llvm::StringRef description,
1212 ProcessCreateInstance create_callback,
1213 DebuggerInitializeCallback debugger_init_callback) {
1215 name, description, create_callback, debugger_init_callback);
1216}
1217
1219 return GetProcessInstances().UnregisterPlugin(create_callback);
1220}
1221
1222llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1223 return GetProcessInstances().GetNameAtIndex(idx);
1224}
1225
1226llvm::StringRef
1230
1235
1236llvm::SmallVector<ProcessCreateInstance>
1240
1242 CompletionRequest &request) {
1243 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1244 if (instance.name.starts_with(name))
1245 request.AddCompletion(instance.name, instance.description);
1246 }
1247}
1248
1249#pragma mark ProtocolServer
1250
1253
1255 static ProtocolServerInstances g_instances;
1256 return g_instances;
1257}
1258
1260 llvm::StringRef name, llvm::StringRef description,
1261 ProtocolServerCreateInstance create_callback) {
1262 return GetProtocolServerInstances().RegisterPlugin(name, description,
1263 create_callback);
1264}
1265
1267 ProtocolServerCreateInstance create_callback) {
1268 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1269}
1270
1271llvm::StringRef
1275
1280
1281#pragma mark RegisterTypeBuilder
1282
1284 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1289};
1290
1291typedef PluginInstances<RegisterTypeBuilderInstance>
1293
1295 static RegisterTypeBuilderInstances g_instances;
1296 return g_instances;
1297}
1298
1300 llvm::StringRef name, llvm::StringRef description,
1301 RegisterTypeBuilderCreateInstance create_callback) {
1302 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1303 create_callback);
1304}
1305
1310
1313 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1314 // type and is always present.
1316 assert(instance);
1317 return instance->create_callback(target);
1318}
1319
1320#pragma mark ScriptInterpreter
1321
1335
1337
1339 static ScriptInterpreterInstances g_instances;
1340 return g_instances;
1341}
1342
1344 llvm::StringRef name, llvm::StringRef description,
1345 lldb::ScriptLanguage script_language,
1346 ScriptInterpreterCreateInstance create_callback,
1347 ScriptInterpreterGetPath get_path_callback) {
1349 name, description, create_callback, script_language, get_path_callback);
1350}
1351
1356
1357llvm::SmallVector<ScriptInterpreterCreateInstance>
1361
1364 Debugger &debugger) {
1365 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1366 ScriptInterpreterCreateInstance none_instance = nullptr;
1367 for (const auto &instance : instances) {
1368 if (instance.language == lldb::eScriptLanguageNone)
1369 none_instance = instance.create_callback;
1370
1371 if (script_lang == instance.language)
1372 return instance.create_callback(debugger);
1373 }
1374
1375 // If we didn't find one, return the ScriptInterpreter for the null language.
1376 assert(none_instance != nullptr);
1377 return none_instance(debugger);
1378}
1379
1381 lldb::ScriptLanguage script_lang) {
1382 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1383 for (const auto &instance : instances) {
1384 if (instance.language == script_lang && instance.get_path_callback)
1385 return instance.get_path_callback();
1386 }
1387 return FileSpec();
1388}
1389
1390#pragma mark SyntheticFrameProvider
1391
1400
1402 static SyntheticFrameProviderInstances g_instances;
1403 return g_instances;
1404}
1405
1407 static ScriptedFrameProviderInstances g_instances;
1408 return g_instances;
1409}
1410
1412 llvm::StringRef name, llvm::StringRef description,
1413 SyntheticFrameProviderCreateInstance create_native_callback,
1414 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1415 if (create_native_callback)
1417 name, description, create_native_callback);
1418 else if (create_scripted_callback)
1420 name, description, create_scripted_callback);
1421 return false;
1422}
1423
1428
1433
1439
1440llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1444
1445#pragma mark StructuredDataPlugin
1446
1460
1463
1465 static StructuredDataPluginInstances g_instances;
1466 return g_instances;
1467}
1468
1470 llvm::StringRef name, llvm::StringRef description,
1471 StructuredDataPluginCreateInstance create_callback,
1472 DebuggerInitializeCallback debugger_init_callback,
1473 StructuredDataFilterLaunchInfo filter_callback) {
1475 name, description, create_callback, debugger_init_callback,
1476 filter_callback);
1477}
1478
1483
1484llvm::SmallVector<StructuredDataPluginCallbacks>
1486 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1487 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1488 result.reserve(instances.size());
1489 for (auto &instance : instances)
1490 result.push_back({instance.create_callback, instance.filter_callback});
1491 return result;
1492}
1493
1494#pragma mark SymbolFile
1495
1498
1500 static SymbolFileInstances g_instances;
1501 return g_instances;
1502}
1503
1505 llvm::StringRef name, llvm::StringRef description,
1506 SymbolFileCreateInstance create_callback,
1507 DebuggerInitializeCallback debugger_init_callback) {
1509 name, description, create_callback, debugger_init_callback);
1510}
1511
1513 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1514}
1515
1516llvm::SmallVector<SymbolFileCreateInstance>
1520
1521#pragma mark SymbolVendor
1522
1525
1527 static SymbolVendorInstances g_instances;
1528 return g_instances;
1529}
1530
1531bool PluginManager::RegisterPlugin(llvm::StringRef name,
1532 llvm::StringRef description,
1533 SymbolVendorCreateInstance create_callback) {
1534 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1535 create_callback);
1536}
1537
1539 SymbolVendorCreateInstance create_callback) {
1540 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1541}
1542
1543llvm::SmallVector<SymbolVendorCreateInstance>
1547
1548#pragma mark SymbolLocator
1549
1573
1575 static SymbolLocatorInstances g_instances;
1576 return g_instances;
1577}
1578
1580 llvm::StringRef name, llvm::StringRef description,
1581 SymbolLocatorCreateInstance create_callback,
1582 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1583 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1584 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1585 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1586 DebuggerInitializeCallback debugger_init_callback) {
1588 name, description, create_callback, locate_executable_object_file,
1589 locate_executable_symbol_file, download_object_symbol_file,
1590 find_symbol_file_in_bundle, debugger_init_callback);
1591}
1592
1594 SymbolLocatorCreateInstance create_callback) {
1595 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1596}
1597
1598llvm::SmallVector<SymbolLocatorCreateInstance>
1602
1605 StatisticsMap &map) {
1606 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1607 for (auto &instance : instances) {
1608 if (instance.locate_executable_object_file) {
1609 StatsDuration time;
1610 std::optional<ModuleSpec> result;
1611 {
1612 ElapsedTime elapsed(time);
1613 result = instance.locate_executable_object_file(module_spec);
1614 }
1615 map.add(instance.name, time.get().count());
1616 if (result)
1617 return *result;
1618 }
1619 }
1620 return {};
1621}
1622
1624 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1625 StatisticsMap &map) {
1626 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1627 for (auto &instance : instances) {
1628 if (instance.locate_executable_symbol_file) {
1629 StatsDuration time;
1630 std::optional<FileSpec> result;
1631 {
1632 ElapsedTime elapsed(time);
1633 result = instance.locate_executable_symbol_file(module_spec,
1634 default_search_paths);
1635 }
1636 map.add(instance.name, time.get().count());
1637 if (result)
1638 return *result;
1639 }
1640 }
1641 return {};
1642}
1643
1645 Status &error,
1646 bool force_lookup,
1647 bool copy_executable) {
1648 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1649 for (auto &instance : instances) {
1650 if (instance.download_object_symbol_file) {
1651 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1652 copy_executable))
1653 return true;
1654 }
1655 }
1656 return false;
1657}
1658
1660 const UUID *uuid,
1661 const ArchSpec *arch) {
1662 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1663 for (auto &instance : instances) {
1664 if (instance.find_symbol_file_in_bundle) {
1665 std::optional<FileSpec> result =
1666 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1667 if (result)
1668 return *result;
1669 }
1670 }
1671 return {};
1672}
1673
1674#pragma mark Trace
1675
1691
1693
1695 static TraceInstances g_instances;
1696 return g_instances;
1697}
1698
1700 llvm::StringRef name, llvm::StringRef description,
1701 TraceCreateInstanceFromBundle create_callback_from_bundle,
1702 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1703 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1705 name, description, create_callback_from_bundle,
1706 create_callback_for_live_process, schema, debugger_init_callback);
1707}
1708
1710 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1712 create_callback_from_bundle);
1713}
1714
1716PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1717 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1718}
1719
1722 llvm::StringRef plugin_name) {
1723 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1724 return instance->create_callback_for_live_process;
1725
1726 return nullptr;
1727}
1728
1729llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1730 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1731 return instance->schema;
1732 return llvm::StringRef();
1733}
1734
1735llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1736 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1737 return instance->schema;
1738 return llvm::StringRef();
1739}
1740
1741#pragma mark TraceExporter
1742
1756
1758
1760 static TraceExporterInstances g_instances;
1761 return g_instances;
1762}
1763
1765 llvm::StringRef name, llvm::StringRef description,
1766 TraceExporterCreateInstance create_callback,
1767 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1769 name, description, create_callback, create_thread_trace_export_command);
1770}
1771
1774 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1775}
1776
1778 TraceExporterCreateInstance create_callback) {
1779 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1780}
1781
1782llvm::SmallVector<TraceExporterCallbacks>
1784 auto instances = GetTraceExporterInstances().GetSnapshot();
1785 llvm::SmallVector<TraceExporterCallbacks> result;
1786 result.reserve(instances.size());
1787 for (auto &instance : instances)
1788 result.push_back({instance.name, instance.create_callback,
1789 instance.create_thread_trace_export_command});
1790 return result;
1791}
1792
1793#pragma mark UnwindAssembly
1794
1797
1799 static UnwindAssemblyInstances g_instances;
1800 return g_instances;
1801}
1802
1804 llvm::StringRef name, llvm::StringRef description,
1805 UnwindAssemblyCreateInstance create_callback) {
1806 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1807 create_callback);
1808}
1809
1811 UnwindAssemblyCreateInstance create_callback) {
1812 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1813}
1814
1815llvm::SmallVector<UnwindAssemblyCreateInstance>
1819
1820#pragma mark MemoryHistory
1821
1824
1826 static MemoryHistoryInstances g_instances;
1827 return g_instances;
1828}
1829
1831 llvm::StringRef name, llvm::StringRef description,
1832 MemoryHistoryCreateInstance create_callback) {
1833 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1834 create_callback);
1835}
1836
1838 MemoryHistoryCreateInstance create_callback) {
1839 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1840}
1841
1842llvm::SmallVector<MemoryHistoryCreateInstance>
1846
1847#pragma mark InstrumentationRuntime
1848
1861
1864
1866 static InstrumentationRuntimeInstances g_instances;
1867 return g_instances;
1868}
1869
1871 llvm::StringRef name, llvm::StringRef description,
1873 InstrumentationRuntimeGetType get_type_callback) {
1875 name, description, create_callback, get_type_callback);
1876}
1877
1882
1883llvm::SmallVector<InstrumentationRuntimeCallbacks>
1886 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1887 result.reserve(instances.size());
1888 for (auto &instance : instances)
1889 result.push_back({instance.create_callback, instance.get_type_callback});
1890 return result;
1891}
1892
1893#pragma mark TypeSystem
1894
1909
1911
1913 static TypeSystemInstances g_instances;
1914 return g_instances;
1915}
1916
1918 llvm::StringRef name, llvm::StringRef description,
1919 TypeSystemCreateInstance create_callback,
1920 LanguageSet supported_languages_for_types,
1921 LanguageSet supported_languages_for_expressions) {
1923 name, description, create_callback, supported_languages_for_types,
1924 supported_languages_for_expressions);
1925}
1926
1928 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
1929}
1930
1931llvm::SmallVector<TypeSystemCreateInstance>
1935
1937 const auto instances = GetTypeSystemInstances().GetSnapshot();
1938 LanguageSet all;
1939 for (unsigned i = 0; i < instances.size(); ++i)
1940 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
1941 return all;
1942}
1943
1945 const auto instances = GetTypeSystemInstances().GetSnapshot();
1946 LanguageSet all;
1947 for (unsigned i = 0; i < instances.size(); ++i)
1948 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
1949 return all;
1950}
1951
1952#pragma mark ScriptedInterfaces
1953
1967
1969
1971 static ScriptedInterfaceInstances g_instances;
1972 return g_instances;
1973}
1974
1976 llvm::StringRef name, llvm::StringRef description,
1977 ScriptedInterfaceCreateInstance create_callback,
1980 name, description, create_callback, language, usages);
1981}
1982
1987
1991
1992llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
1994}
1995
1996llvm::StringRef
2000
2003 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2004 return instance->language;
2006}
2007
2010 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2011 return instance->usages;
2012 return {};
2013}
2014
2015#pragma mark REPL
2016
2025
2027
2029 static REPLInstances g_instances;
2030 return g_instances;
2031}
2032
2033bool PluginManager::RegisterPlugin(llvm::StringRef name,
2034 llvm::StringRef description,
2035 REPLCreateInstance create_callback,
2036 LanguageSet supported_languages) {
2037 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2038 supported_languages);
2039}
2040
2042 return GetREPLInstances().UnregisterPlugin(create_callback);
2043}
2044
2045llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2046 auto instances = GetREPLInstances().GetSnapshot();
2047 llvm::SmallVector<REPLCallbacks> result;
2048 result.reserve(instances.size());
2049 for (auto &instance : instances)
2050 result.push_back({instance.create_callback, instance.supported_languages});
2051 return result;
2052}
2053
2055 const auto instances = GetREPLInstances().GetSnapshot();
2056 LanguageSet all;
2057 for (unsigned i = 0; i < instances.size(); ++i)
2058 all.bitvector |= instances[i].supported_languages.bitvector;
2059 return all;
2060}
2061
2062#pragma mark Highlighter
2063
2064struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2069};
2070
2072
2074 static HighlighterInstances g_instances;
2075 return g_instances;
2076}
2077
2078bool PluginManager::RegisterPlugin(llvm::StringRef name,
2079 llvm::StringRef description,
2080 HighlighterCreateInstance create_callback) {
2081 return GetHighlighterInstances().RegisterPlugin(name, description,
2082 create_callback);
2083}
2084
2086 HighlighterCreateInstance create_callback) {
2087 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2088}
2089
2090llvm::SmallVector<HighlighterCreateInstance>
2094
2095#pragma mark PluginManager
2096
2111
2112// This is the preferred new way to register plugin specific settings. e.g.
2113// This will put a plugin's settings under e.g.
2114// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2116 Debugger &debugger, llvm::StringRef plugin_type_name,
2117 llvm::StringRef plugin_type_desc, bool can_create) {
2118 lldb::OptionValuePropertiesSP parent_properties_sp(
2119 debugger.GetValueProperties());
2120 if (parent_properties_sp) {
2121 static constexpr llvm::StringLiteral g_property_name("plugin");
2122
2123 OptionValuePropertiesSP plugin_properties_sp =
2124 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2125 if (!plugin_properties_sp && can_create) {
2126 plugin_properties_sp =
2127 std::make_shared<OptionValueProperties>(g_property_name);
2128 plugin_properties_sp->SetExpectedPath("plugin");
2129 parent_properties_sp->AppendProperty(g_property_name,
2130 "Settings specify to plugins.", true,
2131 plugin_properties_sp);
2132 }
2133
2134 if (plugin_properties_sp) {
2135 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2136 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2137 if (!plugin_type_properties_sp && can_create) {
2138 plugin_type_properties_sp =
2139 std::make_shared<OptionValueProperties>(plugin_type_name);
2140 plugin_type_properties_sp->SetExpectedPath(
2141 ("plugin." + plugin_type_name).str());
2142 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2143 true, plugin_type_properties_sp);
2144 }
2145 return plugin_type_properties_sp;
2146 }
2147 }
2149}
2150
2151// This is deprecated way to register plugin specific settings. e.g.
2152// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2153// generic settings would be under "platform.SETTINGNAME".
2155 Debugger &debugger, llvm::StringRef plugin_type_name,
2156 llvm::StringRef plugin_type_desc, bool can_create) {
2157 static constexpr llvm::StringLiteral g_property_name("plugin");
2158 lldb::OptionValuePropertiesSP parent_properties_sp(
2159 debugger.GetValueProperties());
2160 if (parent_properties_sp) {
2161 OptionValuePropertiesSP plugin_properties_sp =
2162 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2163 if (!plugin_properties_sp && can_create) {
2164 plugin_properties_sp =
2165 std::make_shared<OptionValueProperties>(plugin_type_name);
2166 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2167 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2168 true, plugin_properties_sp);
2169 }
2170
2171 if (plugin_properties_sp) {
2172 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2173 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2174 if (!plugin_type_properties_sp && can_create) {
2175 plugin_type_properties_sp =
2176 std::make_shared<OptionValueProperties>(g_property_name);
2177 plugin_type_properties_sp->SetExpectedPath(
2178 (plugin_type_name + ".plugin").str());
2179 plugin_properties_sp->AppendProperty(g_property_name,
2180 "Settings specific to plugins",
2181 true, plugin_type_properties_sp);
2182 }
2183 return plugin_type_properties_sp;
2184 }
2185 }
2187}
2188
2189namespace {
2190
2192GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2193 bool can_create);
2194}
2195
2197GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2198 llvm::StringRef plugin_type_name,
2199 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2201 lldb::OptionValuePropertiesSP properties_sp;
2202 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2203 debugger, plugin_type_name,
2204 "", // not creating to so we don't need the description
2205 false));
2206 if (plugin_type_properties_sp)
2207 properties_sp =
2208 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2209 return properties_sp;
2210}
2211
2212static bool
2213CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2214 llvm::StringRef plugin_type_desc,
2215 const lldb::OptionValuePropertiesSP &properties_sp,
2216 llvm::StringRef description, bool is_global_property,
2217 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2219 if (properties_sp) {
2220 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2221 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2222 true));
2223 if (plugin_type_properties_sp) {
2224 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2225 description, is_global_property,
2226 properties_sp);
2227 return true;
2228 }
2229 }
2230 return false;
2231}
2232
2233static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2234static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2235static constexpr llvm::StringLiteral kProcessPluginName("process");
2236static constexpr llvm::StringLiteral kTracePluginName("trace");
2237static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2238static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2239static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2240static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2241static constexpr llvm::StringLiteral
2242 kStructuredDataPluginName("structured-data");
2243static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2244
2247 llvm::StringRef setting_name) {
2248 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2249}
2250
2252 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2253 llvm::StringRef description, bool is_global_property) {
2255 "Settings for dynamic loader plug-ins",
2256 properties_sp, description, is_global_property);
2257}
2258
2261 llvm::StringRef setting_name) {
2262 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2264}
2265
2267 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2268 llvm::StringRef description, bool is_global_property) {
2270 "Settings for platform plug-ins", properties_sp,
2271 description, is_global_property,
2273}
2274
2277 llvm::StringRef setting_name) {
2278 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2279}
2280
2282 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2283 llvm::StringRef description, bool is_global_property) {
2285 "Settings for process plug-ins", properties_sp,
2286 description, is_global_property);
2287}
2288
2291 llvm::StringRef setting_name) {
2292 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2293}
2294
2296 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2297 llvm::StringRef description, bool is_global_property) {
2299 "Settings for symbol locator plug-ins",
2300 properties_sp, description, is_global_property);
2301}
2302
2304 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2305 llvm::StringRef description, bool is_global_property) {
2307 "Settings for trace plug-ins", properties_sp,
2308 description, is_global_property);
2309}
2310
2313 llvm::StringRef setting_name) {
2314 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2315}
2316
2318 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2319 llvm::StringRef description, bool is_global_property) {
2321 "Settings for object file plug-ins",
2322 properties_sp, description, is_global_property);
2323}
2324
2327 llvm::StringRef setting_name) {
2328 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2329}
2330
2332 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2333 llvm::StringRef description, bool is_global_property) {
2335 "Settings for symbol file plug-ins",
2336 properties_sp, description, is_global_property);
2337}
2338
2341 llvm::StringRef setting_name) {
2342 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2343}
2344
2346 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2347 llvm::StringRef description, bool is_global_property) {
2349 "Settings for JIT loader plug-ins",
2350 properties_sp, description, is_global_property);
2351}
2352
2353static const char *kOperatingSystemPluginName("os");
2354
2356 Debugger &debugger, llvm::StringRef setting_name) {
2357 lldb::OptionValuePropertiesSP properties_sp;
2358 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2361 "", // not creating to so we don't need the description
2362 false));
2363 if (plugin_type_properties_sp)
2364 properties_sp =
2365 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2366 return properties_sp;
2367}
2368
2370 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2371 llvm::StringRef description, bool is_global_property) {
2372 if (properties_sp) {
2373 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2375 "Settings for operating system plug-ins",
2376 true));
2377 if (plugin_type_properties_sp) {
2378 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2379 description, is_global_property,
2380 properties_sp);
2381 return true;
2382 }
2383 }
2384 return false;
2385}
2386
2389 llvm::StringRef setting_name) {
2390 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2391}
2392
2394 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2395 llvm::StringRef description, bool is_global_property) {
2397 "Settings for structured data plug-ins",
2398 properties_sp, description, is_global_property);
2399}
2400
2403 Debugger &debugger, llvm::StringRef setting_name) {
2404 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2405}
2406
2408 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2409 llvm::StringRef description, bool is_global_property) {
2411 "Settings for CPlusPlus language plug-ins",
2412 properties_sp, description, is_global_property);
2413}
2414
2415//
2416// Plugin Info+Enable Implementations
2417//
2418llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2420}
2421bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2422 return GetABIInstances().SetInstanceEnabled(name, enable);
2423}
2424
2425llvm::SmallVector<RegisteredPluginInfo>
2430 bool enable) {
2431 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2432}
2433
2434llvm::SmallVector<RegisteredPluginInfo>
2439 bool enable) {
2440 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2441}
2442
2443llvm::SmallVector<RegisteredPluginInfo>
2448 bool enable) {
2449 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2450}
2451
2452llvm::SmallVector<RegisteredPluginInfo>
2457 bool enable) {
2459}
2460
2461llvm::SmallVector<RegisteredPluginInfo>
2466 bool enable) {
2468}
2469
2470llvm::SmallVector<RegisteredPluginInfo>
2475 bool enable) {
2476 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2477}
2478
2479llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2481}
2483 bool enable) {
2484 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2485}
2486
2487llvm::SmallVector<RegisteredPluginInfo>
2492 bool enable) {
2493 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2494}
2495
2496llvm::SmallVector<RegisteredPluginInfo>
2501 bool enable) {
2502 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2503}
2504
2505llvm::SmallVector<RegisteredPluginInfo>
2510 bool enable) {
2511 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2512}
2513
2514llvm::SmallVector<RegisteredPluginInfo>
2519 bool enable) {
2520 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2521}
2522
2523llvm::SmallVector<RegisteredPluginInfo>
2528 bool enable) {
2529 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2530}
2531
2532llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2534}
2536 bool enable) {
2537 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2538}
2539
2540llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2542}
2543bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2544 return GetProcessInstances().SetInstanceEnabled(name, enable);
2545}
2546
2547llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2549}
2550bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2551 return GetREPLInstances().SetInstanceEnabled(name, enable);
2552}
2553
2554llvm::SmallVector<RegisteredPluginInfo>
2559 bool enable) {
2561}
2562
2563llvm::SmallVector<RegisteredPluginInfo>
2568 bool enable) {
2570}
2571
2572llvm::SmallVector<RegisteredPluginInfo>
2577 bool enable) {
2579}
2580
2581llvm::SmallVector<RegisteredPluginInfo>
2586 bool enable) {
2588}
2589
2590llvm::SmallVector<RegisteredPluginInfo>
2595 bool enable) {
2596 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2597}
2598
2599llvm::SmallVector<RegisteredPluginInfo>
2604 bool enable) {
2605 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2606}
2607
2608llvm::SmallVector<RegisteredPluginInfo>
2613 bool enable) {
2614 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2615}
2616
2617llvm::SmallVector<RegisteredPluginInfo>
2622 bool enable) {
2623 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2624}
2625
2626llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2628}
2629bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2630 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2631}
2632
2633llvm::SmallVector<RegisteredPluginInfo>
2638 bool enable) {
2639 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2640}
2641
2642llvm::SmallVector<RegisteredPluginInfo>
2647 bool enable) {
2648 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2649}
2650
2651llvm::SmallVector<RegisteredPluginInfo>
2656 bool enable) {
2657 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2658}
2659
2661 CompletionRequest &request) {
2662 // Split the name into the namespace and the plugin name.
2663 // If there is no dot then the ns_name will be equal to name and
2664 // plugin_prefix will be empty.
2665 llvm::StringRef ns_name, plugin_prefix;
2666 std::tie(ns_name, plugin_prefix) = name.split('.');
2667
2668 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2669 // If the plugin namespace matches exactly then
2670 // add all the plugins in this namespace as completions if the
2671 // plugin names starts with the plugin_prefix. If the plugin_prefix
2672 // is empty then it will match all the plugins (empty string is a
2673 // prefix of everything).
2674 if (plugin_ns.name == ns_name) {
2675 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2676 llvm::SmallString<128> buf;
2677 if (plugin.name.starts_with(plugin_prefix))
2678 request.AddCompletion(
2679 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2680 }
2681 } else if (plugin_ns.name.starts_with(name) &&
2682 !plugin_ns.get_info().empty()) {
2683 // Otherwise check if the namespace is a prefix of the full name.
2684 // Use a partial completion here so that we can either operate on the full
2685 // namespace or tab-complete to the next level.
2686 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2687 }
2688 }
2689}
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:811
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:392
static DisassemblerInstances & GetDisassemblerInstances()
PluginInstances< ProtocolServerInstance > ProtocolServerInstances
static TraceInstances & GetTracePluginInstances()
static ObjectContainerInstances & GetObjectContainerInstances()
PluginInstances< JITLoaderInstance > JITLoaderInstances
static MemoryHistoryInstances & GetMemoryHistoryInstances()
PluginInstance< PlatformCreateInstance > PlatformInstance
PluginInstances< InstrumentationRuntimeInstance > InstrumentationRuntimeInstances
PluginInstances< HighlighterInstance > HighlighterInstances
static DynamicLoaderInstances & GetDynamicLoaderInstances()
PluginInstances< SymbolFileInstance > SymbolFileInstances
PluginInstances< TypeSystemInstance > TypeSystemInstances
PluginInstance< ABICreateInstance > ABIInstance
static SystemRuntimeInstances & GetSystemRuntimeInstances()
PluginInstances< TraceExporterInstance > TraceExporterInstances
static constexpr llvm::StringLiteral kPlatformPluginName("platform")
static constexpr llvm::StringLiteral g_plugin_prefix
PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
static ABIInstances & GetABIInstances()
static constexpr llvm::StringLiteral kProcessPluginName("process")
PluginInstances< SymbolVendorInstance > SymbolVendorInstances
static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader")
static lldb::OptionValuePropertiesSP GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name, llvm::StringRef plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static ScriptInterpreterInstances & GetScriptInterpreterInstances()
PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
PluginInstances< PlatformInstance > PlatformInstances
PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus")
PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
static TraceExporterInstances & GetTraceExporterInstances()
PluginInstance< LanguageCreateInstance > LanguageInstance
PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator")
PluginInstances< ObjectFileInstance > ObjectFileInstances
void(* PluginTermCallback)()
static StructuredDataPluginInstances & GetStructuredDataPluginInstances()
static constexpr llvm::StringLiteral kObjectFilePluginName("object-file")
PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
PluginInstances< LanguageInstance > LanguageInstances
PluginInstances< TraceInstance > TraceInstances
PluginInstances< ArchitectureInstance > ArchitectureInstances
PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
static constexpr llvm::StringLiteral kStructuredDataPluginName("structured-data")
PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
static const char * kOperatingSystemPluginName("os")
static SymbolLocatorInstances & GetSymbolLocatorInstances()
PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
static ObjectFileInstances & GetObjectFileInstances()
static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file")
PluginInstances< SymbolLocatorInstance > SymbolLocatorInstances
PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
static EmulateInstructionInstances & GetEmulateInstructionInstances()
PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
static LanguageInstances & GetLanguageInstances()
static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader")
static ScriptedFrameProviderInstances & GetScriptedFrameProviderInstances()
PluginInstances< OperatingSystemInstance > OperatingSystemInstances
static LanguageRuntimeInstances & GetLanguageRuntimeInstances()
PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances()
PluginInstances< ProcessInstance > ProcessInstances
PluginInstances< SyntheticFrameProviderInstance > SyntheticFrameProviderInstances
PluginInstances< REPLInstance > REPLInstances
static ArchitectureInstances & GetArchitectureInstances()
static DynamicPluginMap & GetPluginMap()
PluginInstances< ScriptedFrameProviderInstance > ScriptedFrameProviderInstances
static 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)
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 > GetInstanceForName(llvm::StringRef name)
std::optional< ABIInstance > GetInstanceAtIndex(uint32_t idx)
llvm::SmallVector< RegisteredPluginInfo > GetPluginInfoForAllInstances()
Instance::CallbackType GetCallbackForName(llvm::StringRef name)
bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, typename Instance::CallbackType callback, Args &&...args)
llvm::SmallVector< ABIInstance > GetSnapshot() const
void PerformDebuggerCallback(Debugger &debugger)
std::optional< ABIInstance > FindEnabledInstance(std::function< bool(const ABIInstance &)> predicate) const
bool SetInstanceEnabled(llvm::StringRef name, bool enable)
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
A class to manage flag bits.
Definition Debugger.h:87
A class that measures elapsed time in an exception safe way.
Definition Statistics.h:76
A file collection class.
A file utility class.
Definition FileSpec.h:57
const ConstString & GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:250
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.
Definition FileSpec.cpp:414
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition FileSpec.cpp:374
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
Definition FileSpec.cpp: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 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 bool SetTraceExporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetArchitecturePluginInfo()
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static bool SetInstrumentationRuntimePluginEnabled(llvm::StringRef name, bool enable)
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 void AutoCompleteProcessName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptInterpreterPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetABIPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguagePluginInfo()
static LanguageSet GetREPLAllTypeSystemSupportedLanguages()
static llvm::SmallVector< OperatingSystemCreateInstance > GetOperatingSystemCreateCallbacks()
static bool CreateSettingForTracePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetDynamicLoaderPluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< ProcessCreateInstance > GetProcessCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetObjectContainerPluginInfo()
static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Status &error, bool force_lookup=true, bool copy_executable=true)
static llvm::SmallVector< RegisteredPluginInfo > GetDisassemblerPluginInfo()
static llvm::SmallVector< LanguageRuntimeCallbacks > GetLanguageRuntimeCallbacks()
static llvm::SmallVector< SymbolFileCreateInstance > GetSymbolFileCreateCallbacks()
static bool SetLanguageRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetObjectFilePluginInfo()
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolLocatorPluginInfo()
static llvm::StringRef GetTraceSchema(llvm::StringRef plugin_name)
Get the JSON schema for a trace bundle description file corresponding to the given plugin.
static llvm::SmallVector< SymbolVendorCreateInstance > GetSymbolVendorCreateCallbacks()
static bool SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForCPlusPlusLanguagePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetDisassemblerPluginEnabled(llvm::StringRef name, bool enable)
static bool SetSystemRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetTracePluginInfo()
static llvm::SmallVector< JITLoaderCreateInstance > GetJITLoaderCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetProcessPluginInfo()
static TraceCreateInstanceForLiveProcess GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name)
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static llvm::SmallVector< DisassemblerCreateInstance > GetDisassemblerCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForSymbolLocatorPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetStructuredDataPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ObjectFileCallbacks > GetObjectFileCallbacks()
static uint32_t GetNumScriptedInterfaces()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguageRuntimePluginInfo()
static bool SetObjectContainerPluginEnabled(llvm::StringRef name, bool enable)
static bool CreateSettingForProcessPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetPlatformPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetMemoryHistoryPluginInfo()
static llvm::SmallVector< TypeSystemCreateInstance > GetTypeSystemCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolFilePluginInfo()
static SyntheticFrameProviderCreateInstance GetSyntheticFrameProviderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< SymbolLocatorCreateInstance > GetSymbolLocatorCreateCallbacks()
static llvm::ArrayRef< PluginNamespace > GetPluginNamespaces()
static bool SetTypeSystemPluginEnabled(llvm::StringRef name, bool enable)
static bool SetTracePluginEnabled(llvm::StringRef name, bool enable)
static Status SaveCore(lldb_private::SaveCoreOptions &core_options)
static llvm::SmallVector< RegisteredPluginInfo > GetTraceExporterPluginInfo()
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths, StatisticsMap &map)
static bool SetEmulateInstructionPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForJITLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static DisassemblerCreateInstance GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name)
static bool SetJITLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetInstrumentationRuntimePluginInfo()
static llvm::SmallVector< REPLCallbacks > GetREPLCallbacks()
static bool CreateSettingForSymbolFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static OperatingSystemCreateInstance GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name)
static bool SetSymbolFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ScriptInterpreterCreateInstance > GetScriptInterpreterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetRegisterTypeBuilderPluginInfo()
static EmulateInstructionCreateInstance GetEmulateInstructionCreateCallbackForPluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForStructuredDataPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForCPlusPlusLanguagePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< TraceExporterCallbacks > GetTraceExporterCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolVendorPluginInfo()
static DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
static PlatformCreateInstance GetPlatformCreateCallbackForPluginName(llvm::StringRef name)
static bool SetProcessPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< llvm::StringRef > GetSaveCorePluginNames()
static llvm::SmallVector< RegisteredPluginInfo > GetOperatingSystemPluginInfo()
static llvm::SmallVector< ScriptedFrameProviderCreateInstance > GetScriptedFrameProviderCreateCallbacks()
static bool SetABIPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptedInterfacePluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< InstrumentationRuntimeCallbacks > GetInstrumentationRuntimeCallbacks()
static ProcessCreateInstance GetProcessCreateCallbackForPluginName(llvm::StringRef name)
static void AutoCompletePluginName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProtocolServerPluginNameAtIndex(uint32_t idx)
static bool IsRegisteredObjectFilePluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetLanguagePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetREPLPluginInfo()
static bool SetREPLPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< HighlighterCreateInstance > GetHighlighterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetUnwindAssemblyPluginInfo()
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static bool SetSymbolVendorPluginEnabled(llvm::StringRef name, bool enable)
static TraceCreateInstanceFromBundle GetTraceCreateCallback(llvm::StringRef plugin_name)
static void DebuggerInitialize(Debugger &debugger)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static llvm::SmallVector< ObjectContainerCallbacks > GetObjectContainerCallbacks()
static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
static llvm::SmallVector< StructuredDataPluginCallbacks > GetStructuredDataPluginCallbacks()
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
static llvm::SmallVector< SystemRuntimeCreateInstance > GetSystemRuntimeCreateCallbacks()
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
static llvm::SmallVector< RegisteredPluginInfo > GetStructuredDataPluginInfo()
static bool SetSymbolLocatorPluginEnabled(llvm::StringRef name, bool enable)
static ProtocolServerCreateInstance GetProtocolCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< LanguageCreateInstance > GetLanguageCreateCallbacks()
static llvm::SmallVector< DynamicLoaderCreateInstance > GetDynamicLoaderCreateCallbacks()
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
static llvm::SmallVector< MemoryHistoryCreateInstance > GetMemoryHistoryCreateCallbacks()
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name)
static bool CreateSettingForSymbolLocatorPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetJITLoaderPluginInfo()
static bool SetObjectFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< PlatformCreateInstance > GetPlatformCreateCallbacks()
lldb::OptionValuePropertiesSP GetValueProperties() const
const std::optional< lldb_private::FileSpec > GetOutputFile() const
std::optional< std::string > GetPluginName() const
lldb::ProcessSP GetProcess() const
A class to count time for plugins.
Definition Statistics.h:94
void add(llvm::StringRef key, double value)
Definition Statistics.h:96
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
Represents UUID's of various sizes.
Definition UUID.h:27
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:332
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)
size_t(* ObjectFileGetModuleSpecifications)(const FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t length, ModuleSpecList &module_specs)
ObjectContainer *(* ObjectContainerCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
lldb::MemoryHistorySP(* MemoryHistoryCreateInstance)(const lldb::ProcessSP &process_sp)
ObjectFile *(* ObjectFileCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
SymbolLocator *(* SymbolLocatorCreateInstance)()
std::optional< ModuleSpec >(* SymbolLocatorLocateExecutableObjectFile)(const ModuleSpec &module_spec)
@ Partial
The current token has been partially completed.
lldb::CommandObjectSP(* LanguageRuntimeGetCommandObject)(CommandInterpreter &interpreter)
DynamicLoader *(* DynamicLoaderCreateInstance)(Process *process, bool force)
lldb::StructuredDataPluginSP(* StructuredDataPluginCreateInstance)(Process &process)
lldb::JITLoaderSP(* JITLoaderCreateInstance)(Process *process, bool force)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* SyntheticFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const std::vector< lldb_private::ThreadSpec > &thread_specs)
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
lldb::REPLSP(* REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
SymbolFile *(* SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp)
llvm::Expected< lldb::TraceExporterUP >(* TraceExporterCreateInstance)()
Highlighter *(* HighlighterCreateInstance)(lldb::LanguageType language)
std::optional< FileSpec >(* SymbolLocatorFindSymbolFileInBundle)(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
bool(* SymbolLocatorDownloadObjectAndSymbolFile)(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
Status(* StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, Target *target)
ObjectFile *(* ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* ScriptedFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const lldb_private::ScriptedFrameProviderDescriptor &descriptor)
lldb::CommandObjectSP(* ThreadTraceExportCommandCreator)(CommandInterpreter &interpreter)
lldb::InstrumentationRuntimeSP(* InstrumentationRuntimeCreateInstance)(const lldb::ProcessSP &process_sp)
ScriptLanguage
Script interpreter types.
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
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)
LanguageRuntimeGetExceptionPrecondition precondition_callback
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
LanguageRuntimeGetCommandObject command_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
ObjectContainerCreateMemoryInstance create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
ObjectFileSaveCore save_core
PluginDir(FileSpec path, LoadPolicy policy)
const LoadPolicy policy
Filter when looking for plugins.
const FileSpec path
The path to the plugin directory.
@ LoadOnlyWithLLDBPrefix
Only load shared libraries who's filename start with g_plugin_prefix.
@ LoadAnyDylib
Try to load anything that looks like a shared library.
PluginTermCallback plugin_term_callback
PluginInfo()=default
llvm::sys::DynamicLibrary library
PluginInfo & operator=(PluginInfo &&other)
PluginInitCallback plugin_init_callback
PluginInfo(const PluginInfo &)=delete
PluginInfo(PluginInfo &&other)
static llvm::Expected< PluginInfo > Create(const FileSpec &path)
PluginInfo & operator=(const PluginInfo &)=delete
DebuggerInitializeCallback debugger_init_callback
PluginInstance()=default
PluginInstance(llvm::StringRef name, llvm::StringRef description, Callback create_callback, DebuggerInitializeCallback debugger_init_callback=nullptr)
LanguageSet supported_languages
REPLInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages)
RegisterTypeBuilderInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, lldb::ScriptLanguage language, ScriptInterpreterGetPath get_path_callback)
lldb::ScriptLanguage language
ScriptInterpreterGetPath get_path_callback
ScriptedInterfaceUsages usages
lldb::ScriptLanguage language
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description, ScriptedInterfaceCreateInstance create_callback, lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
StructuredDataFilterLaunchInfo filter_callback
SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle
SymbolLocatorInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, SymbolLocatorLocateExecutableObjectFile locate_executable_object_file, SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file, SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file, SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle, DebuggerInitializeCallback debugger_init_callback)
SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file
SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file
SymbolLocatorLocateExecutableObjectFile locate_executable_object_file
ThreadTraceExportCommandCreator create_thread_trace_export_command
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
llvm::StringRef schema
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback)
TraceCreateInstanceForLiveProcess create_callback_for_live_process
LanguageSet supported_languages_for_expressions
LanguageSet supported_languages_for_types
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39