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(bool enabled_only = true) 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 (!enabled_only || 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 bool enabled_only = true) {
595 if (name.empty())
596 return std::nullopt;
597
598 auto predicate = [&](const Instance &instance) {
599 return instance.name == name;
600 };
601 if (enabled_only)
602 return FindEnabledInstance(predicate);
603
604 return FindInstance(predicate);
605 }
606
607 std::optional<Instance>
608 FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
609 for (const auto &instance : GetSnapshot()) {
610 if (predicate(instance))
611 return instance;
612 }
613 return std::nullopt;
614 }
615
616 std::optional<Instance>
617 FindInstance(std::function<bool(const Instance &)> predicate) const {
618 std::lock_guard<std::mutex> guard(m_mutex);
619 for (const auto &instance : m_instances) {
620 if (predicate(instance))
621 return instance;
622 }
623 return std::nullopt;
624 }
625
626 // Return a list of all the registered plugin instances. This includes both
627 // enabled and disabled instances. The instances are listed in the order they
628 // were registered which is the order they would be queried if they were all
629 // enabled.
630 llvm::SmallVector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
631 std::lock_guard<std::mutex> guard(m_mutex);
632
633 // Lookup the plugin info for each instance in the sorted order.
634 llvm::SmallVector<RegisteredPluginInfo> plugin_infos;
635 plugin_infos.reserve(m_instances.size());
636
637 for (const Instance &instance : m_instances)
638 plugin_infos.push_back(
639 {instance.name, instance.description, instance.enabled});
640
641 return plugin_infos;
642 }
643
644 bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
645 std::lock_guard<std::mutex> guard(m_mutex);
646 auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
647 return instance.name == name;
648 });
649
650 if (it == m_instances.end())
651 return false;
652
653 it->enabled = enable;
654 return true;
655 }
656
657private:
658 mutable std::mutex m_mutex;
659 llvm::SmallVector<Instance> m_instances;
660};
661
662#pragma mark ABI
663
666
668 static ABIInstances g_instances;
669 return g_instances;
670}
671
672bool PluginManager::RegisterPlugin(llvm::StringRef name,
673 llvm::StringRef description,
674 ABICreateInstance create_callback) {
675 return GetABIInstances().RegisterPlugin(name, description, create_callback);
676}
677
679 return GetABIInstances().UnregisterPlugin(create_callback);
680}
681
682llvm::SmallVector<ABICreateInstance> PluginManager::GetABICreateCallbacks() {
684}
685
686#pragma mark Architecture
687
690
692 static ArchitectureInstances g_instances;
693 return g_instances;
694}
695
696void PluginManager::RegisterPlugin(llvm::StringRef name,
697 llvm::StringRef description,
698 ArchitectureCreateInstance create_callback) {
699 GetArchitectureInstances().RegisterPlugin(name, description, create_callback);
700}
701
703 ArchitectureCreateInstance create_callback) {
704 auto &instances = GetArchitectureInstances();
705 instances.UnregisterPlugin(create_callback);
706}
707
708std::unique_ptr<Architecture>
710 for (const auto &instances : GetArchitectureInstances().GetSnapshot()) {
711 if (auto plugin_up = instances.create_callback(arch))
712 return plugin_up;
713 }
714 return nullptr;
715}
716
717#pragma mark Disassembler
718
721
723 static DisassemblerInstances g_instances;
724 return g_instances;
725}
726
727bool PluginManager::RegisterPlugin(llvm::StringRef name,
728 llvm::StringRef description,
729 DisassemblerCreateInstance create_callback) {
730 return GetDisassemblerInstances().RegisterPlugin(name, description,
731 create_callback);
732}
733
735 DisassemblerCreateInstance create_callback) {
736 return GetDisassemblerInstances().UnregisterPlugin(create_callback);
737}
738
739llvm::SmallVector<DisassemblerCreateInstance>
743
749
750#pragma mark DynamicLoader
751
754
756 static DynamicLoaderInstances g_instances;
757 return g_instances;
758}
759
761 llvm::StringRef name, llvm::StringRef description,
762 DynamicLoaderCreateInstance create_callback,
763 DebuggerInitializeCallback debugger_init_callback) {
765 name, description, create_callback, debugger_init_callback);
766}
767
769 DynamicLoaderCreateInstance create_callback) {
770 return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
771}
772
773llvm::SmallVector<DynamicLoaderCreateInstance>
777
783
784#pragma mark JITLoader
785
788
790 static JITLoaderInstances g_instances;
791 return g_instances;
792}
793
795 llvm::StringRef name, llvm::StringRef description,
796 JITLoaderCreateInstance create_callback,
797 DebuggerInitializeCallback debugger_init_callback) {
799 name, description, create_callback, debugger_init_callback);
800}
801
803 return GetJITLoaderInstances().UnregisterPlugin(create_callback);
804}
805
806llvm::SmallVector<JITLoaderCreateInstance>
810
811#pragma mark EmulateInstruction
812
816
818 static EmulateInstructionInstances g_instances;
819 return g_instances;
820}
821
823 llvm::StringRef name, llvm::StringRef description,
824 EmulateInstructionCreateInstance create_callback) {
825 return GetEmulateInstructionInstances().RegisterPlugin(name, description,
826 create_callback);
827}
828
833
834llvm::SmallVector<EmulateInstructionCreateInstance>
838
844
845#pragma mark OperatingSystem
846
849
851 static OperatingSystemInstances g_instances;
852 return g_instances;
853}
854
856 llvm::StringRef name, llvm::StringRef description,
857 OperatingSystemCreateInstance create_callback,
858 DebuggerInitializeCallback debugger_init_callback) {
860 name, description, create_callback, debugger_init_callback);
861}
862
867
868llvm::SmallVector<OperatingSystemCreateInstance>
872
878
879#pragma mark Language
880
883
885 static LanguageInstances g_instances;
886 return g_instances;
887}
888
890 llvm::StringRef name, llvm::StringRef description,
891 LanguageCreateInstance create_callback,
892 DebuggerInitializeCallback debugger_init_callback) {
894 name, description, create_callback, debugger_init_callback);
895}
896
898 return GetLanguageInstances().UnregisterPlugin(create_callback);
899}
900
901llvm::SmallVector<LanguageCreateInstance>
905
906#pragma mark LanguageRuntime
907
924
926
928 static LanguageRuntimeInstances g_instances;
929 return g_instances;
930}
931
933 llvm::StringRef name, llvm::StringRef description,
934 LanguageRuntimeCreateInstance create_callback,
935 LanguageRuntimeGetCommandObject command_callback,
936 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
938 name, description, create_callback, nullptr, command_callback,
939 precondition_callback);
940}
941
946
947llvm::SmallVector<LanguageRuntimeCallbacks>
949 auto instances = GetLanguageRuntimeInstances().GetSnapshot();
950 llvm::SmallVector<LanguageRuntimeCallbacks> result;
951 result.reserve(instances.size());
952 for (auto &instance : instances)
953 result.push_back({instance.create_callback, instance.command_callback,
954 instance.precondition_callback});
955 return result;
956}
957
958#pragma mark SystemRuntime
959
962
964 static SystemRuntimeInstances g_instances;
965 return g_instances;
966}
967
969 llvm::StringRef name, llvm::StringRef description,
970 SystemRuntimeCreateInstance create_callback) {
971 return GetSystemRuntimeInstances().RegisterPlugin(name, description,
972 create_callback);
973}
974
976 SystemRuntimeCreateInstance create_callback) {
977 return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
978}
979
980llvm::SmallVector<SystemRuntimeCreateInstance>
984
985#pragma mark ObjectFile
986
1006
1008 static ObjectFileInstances g_instances;
1009 return g_instances;
1010}
1011
1013 if (name.empty())
1014 return false;
1015
1016 return GetObjectFileInstances().GetInstanceForName(name).has_value();
1017}
1018
1020 llvm::StringRef name, llvm::StringRef description,
1021 ObjectFileCreateInstance create_callback,
1022 ObjectFileCreateMemoryInstance create_memory_callback,
1023 ObjectFileGetModuleSpecifications get_module_specifications,
1024 ObjectFileSaveCore save_core,
1025 DebuggerInitializeCallback debugger_init_callback) {
1027 name, description, create_callback, create_memory_callback,
1028 get_module_specifications, save_core, debugger_init_callback);
1029}
1030
1032 return GetObjectFileInstances().UnregisterPlugin(create_callback);
1033}
1034
1035llvm::SmallVector<ObjectFileCallbacks> PluginManager::GetObjectFileCallbacks() {
1036 auto instances = GetObjectFileInstances().GetSnapshot();
1037 llvm::SmallVector<ObjectFileCallbacks> result;
1038 result.reserve(instances.size());
1039 for (auto &instance : instances)
1040 result.push_back({instance.create_callback, instance.create_memory_callback,
1041 instance.get_module_specifications, instance.save_core});
1042 return result;
1043}
1044
1047 llvm::StringRef name) {
1048 if (auto instance = GetObjectFileInstances().GetInstanceForName(name))
1049 return instance->create_memory_callback;
1050 return nullptr;
1051}
1052
1054 Status error;
1055 if (!options.GetOutputFile()) {
1056 error = Status::FromErrorString("No output file specified");
1057 return error;
1058 }
1059
1060 if (!options.GetProcess()) {
1061 error = Status::FromErrorString("Invalid process");
1062 return error;
1063 }
1064
1065 error = options.EnsureValidConfiguration();
1066 if (error.Fail())
1067 return error;
1068
1069 if (!options.GetPluginName().has_value()) {
1070 // Try saving core directly from the process plugin first.
1071 llvm::Expected<bool> ret =
1072 options.GetProcess()->SaveCore(options.GetOutputFile()->GetPath());
1073 if (!ret)
1074 return Status::FromError(ret.takeError());
1075 if (ret.get())
1076 return Status();
1077 }
1078
1079 // Fall back to object plugins.
1080 const auto &plugin_name = options.GetPluginName().value_or("");
1081 auto instances = GetObjectFileInstances().GetSnapshot();
1082 for (auto &instance : instances) {
1083 if (plugin_name.empty() || instance.name == plugin_name) {
1084 // TODO: Refactor the instance.save_core() to not require a process and
1085 // get it from options instead.
1086 if (instance.save_core &&
1087 instance.save_core(options.GetProcess(), options, error))
1088 return error;
1089 }
1090 }
1091
1092 // Check to see if any of the object file plugins tried and failed to save.
1093 // if any failure, return the error message.
1094 if (error.Fail())
1095 return error;
1096
1097 // Report only for the plugin that was specified.
1098 if (!plugin_name.empty())
1100 "The \"{}\" plugin is not able to save a core for this process.",
1101 plugin_name);
1102
1104 "no ObjectFile plugins were able to save a core for this process");
1105}
1106
1107llvm::SmallVector<llvm::StringRef> PluginManager::GetSaveCorePluginNames() {
1108 llvm::SmallVector<llvm::StringRef> plugin_names;
1109 auto instances = GetObjectFileInstances().GetSnapshot();
1110 for (auto &instance : instances) {
1111 if (instance.save_core)
1112 plugin_names.emplace_back(instance.name);
1113 }
1114 return plugin_names;
1115}
1116
1117#pragma mark ObjectContainer
1118
1135
1137 static ObjectContainerInstances g_instances;
1138 return g_instances;
1139}
1140
1142 llvm::StringRef name, llvm::StringRef description,
1143 ObjectContainerCreateInstance create_callback,
1144 ObjectFileGetModuleSpecifications get_module_specifications,
1145 ObjectContainerCreateMemoryInstance create_memory_callback) {
1147 name, description, create_callback, create_memory_callback,
1148 get_module_specifications);
1149}
1150
1152 ObjectContainerCreateInstance create_callback) {
1153 return GetObjectContainerInstances().UnregisterPlugin(create_callback);
1154}
1155
1156llvm::SmallVector<ObjectContainerCallbacks>
1158 auto instances = GetObjectContainerInstances().GetSnapshot();
1159 llvm::SmallVector<ObjectContainerCallbacks> result;
1160 result.reserve(instances.size());
1161 for (auto &instance : instances)
1162 result.push_back({instance.create_callback, instance.create_memory_callback,
1163 instance.get_module_specifications});
1164 return result;
1165}
1166
1167#pragma mark Platform
1168
1171
1173 static PlatformInstances g_platform_instances;
1174 return g_platform_instances;
1175}
1176
1178 llvm::StringRef name, llvm::StringRef description,
1179 PlatformCreateInstance create_callback,
1180 DebuggerInitializeCallback debugger_init_callback) {
1182 name, description, create_callback, debugger_init_callback);
1183}
1184
1186 return GetPlatformInstances().UnregisterPlugin(create_callback);
1187}
1188
1189llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
1191}
1192
1193llvm::StringRef
1197
1202
1203llvm::SmallVector<PlatformCreateInstance>
1207
1209 CompletionRequest &request) {
1210 for (const auto &instance : GetPlatformInstances().GetSnapshot()) {
1211 if (instance.name.starts_with(name))
1212 request.AddCompletion(instance.name);
1213 }
1214}
1215
1216#pragma mark Process
1217
1220
1222 static ProcessInstances g_instances;
1223 return g_instances;
1224}
1225
1227 llvm::StringRef name, llvm::StringRef description,
1228 ProcessCreateInstance create_callback,
1229 DebuggerInitializeCallback debugger_init_callback) {
1231 name, description, create_callback, debugger_init_callback);
1232}
1233
1235 return GetProcessInstances().UnregisterPlugin(create_callback);
1236}
1237
1238llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
1239 return GetProcessInstances().GetNameAtIndex(idx);
1240}
1241
1242llvm::StringRef
1246
1251
1252llvm::SmallVector<ProcessCreateInstance>
1256
1258 CompletionRequest &request) {
1259 for (const auto &instance : GetProcessInstances().GetSnapshot()) {
1260 if (instance.name.starts_with(name))
1261 request.AddCompletion(instance.name, instance.description);
1262 }
1263}
1264
1265#pragma mark ProtocolServer
1266
1269
1271 static ProtocolServerInstances g_instances;
1272 return g_instances;
1273}
1274
1276 llvm::StringRef name, llvm::StringRef description,
1277 ProtocolServerCreateInstance create_callback) {
1278 return GetProtocolServerInstances().RegisterPlugin(name, description,
1279 create_callback);
1280}
1281
1283 ProtocolServerCreateInstance create_callback) {
1284 return GetProtocolServerInstances().UnregisterPlugin(create_callback);
1285}
1286
1287llvm::StringRef
1291
1296
1297#pragma mark RegisterTypeBuilder
1298
1300 : public PluginInstance<RegisterTypeBuilderCreateInstance> {
1305};
1306
1307typedef PluginInstances<RegisterTypeBuilderInstance>
1309
1311 static RegisterTypeBuilderInstances g_instances;
1312 return g_instances;
1313}
1314
1316 llvm::StringRef name, llvm::StringRef description,
1317 RegisterTypeBuilderCreateInstance create_callback) {
1318 return GetRegisterTypeBuilderInstances().RegisterPlugin(name, description,
1319 create_callback);
1320}
1321
1326
1329 // We assume that RegisterTypeBuilderClang is the only instance of this plugin
1330 // type and is always present.
1332 assert(instance);
1333 return instance->create_callback(target);
1334}
1335
1336#pragma mark ScriptInterpreter
1337
1351
1353
1355 static ScriptInterpreterInstances g_instances;
1356 return g_instances;
1357}
1358
1360 llvm::StringRef name, llvm::StringRef description,
1361 lldb::ScriptLanguage script_language,
1362 ScriptInterpreterCreateInstance create_callback,
1363 ScriptInterpreterGetPath get_path_callback) {
1365 name, description, create_callback, script_language, get_path_callback);
1366}
1367
1372
1373llvm::SmallVector<ScriptInterpreterCreateInstance>
1377
1380 Debugger &debugger) {
1381 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1382 ScriptInterpreterCreateInstance none_instance = nullptr;
1383 for (const auto &instance : instances) {
1384 if (instance.language == lldb::eScriptLanguageNone)
1385 none_instance = instance.create_callback;
1386
1387 if (script_lang == instance.language)
1388 return instance.create_callback(debugger);
1389 }
1390
1391 // If we didn't find one, return the ScriptInterpreter for the null language.
1392 assert(none_instance != nullptr);
1393 return none_instance(debugger);
1394}
1395
1397 lldb::ScriptLanguage script_lang) {
1398 const auto instances = GetScriptInterpreterInstances().GetSnapshot();
1399 for (const auto &instance : instances) {
1400 if (instance.language == script_lang && instance.get_path_callback)
1401 return instance.get_path_callback();
1402 }
1403 return FileSpec();
1404}
1405
1406#pragma mark SyntheticFrameProvider
1407
1416
1418 static SyntheticFrameProviderInstances g_instances;
1419 return g_instances;
1420}
1421
1423 static ScriptedFrameProviderInstances g_instances;
1424 return g_instances;
1425}
1426
1428 llvm::StringRef name, llvm::StringRef description,
1429 SyntheticFrameProviderCreateInstance create_native_callback,
1430 ScriptedFrameProviderCreateInstance create_scripted_callback) {
1431 if (create_native_callback)
1433 name, description, create_native_callback);
1434 else if (create_scripted_callback)
1436 name, description, create_scripted_callback);
1437 return false;
1438}
1439
1444
1449
1455
1456llvm::SmallVector<ScriptedFrameProviderCreateInstance>
1460
1461#pragma mark StructuredDataPlugin
1462
1476
1479
1481 static StructuredDataPluginInstances g_instances;
1482 return g_instances;
1483}
1484
1486 llvm::StringRef name, llvm::StringRef description,
1487 StructuredDataPluginCreateInstance create_callback,
1488 DebuggerInitializeCallback debugger_init_callback,
1489 StructuredDataFilterLaunchInfo filter_callback) {
1491 name, description, create_callback, debugger_init_callback,
1492 filter_callback);
1493}
1494
1499
1500llvm::SmallVector<StructuredDataPluginCallbacks>
1502 auto instances = GetStructuredDataPluginInstances().GetSnapshot();
1503 llvm::SmallVector<StructuredDataPluginCallbacks> result;
1504 result.reserve(instances.size());
1505 for (auto &instance : instances)
1506 result.push_back({instance.create_callback, instance.filter_callback});
1507 return result;
1508}
1509
1510#pragma mark SymbolFile
1511
1514
1516 static SymbolFileInstances g_instances;
1517 return g_instances;
1518}
1519
1521 llvm::StringRef name, llvm::StringRef description,
1522 SymbolFileCreateInstance create_callback,
1523 DebuggerInitializeCallback debugger_init_callback) {
1525 name, description, create_callback, debugger_init_callback);
1526}
1527
1529 return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1530}
1531
1532llvm::SmallVector<SymbolFileCreateInstance>
1536
1537#pragma mark SymbolVendor
1538
1541
1543 static SymbolVendorInstances g_instances;
1544 return g_instances;
1545}
1546
1547bool PluginManager::RegisterPlugin(llvm::StringRef name,
1548 llvm::StringRef description,
1549 SymbolVendorCreateInstance create_callback) {
1550 return GetSymbolVendorInstances().RegisterPlugin(name, description,
1551 create_callback);
1552}
1553
1555 SymbolVendorCreateInstance create_callback) {
1556 return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1557}
1558
1559llvm::SmallVector<SymbolVendorCreateInstance>
1563
1564#pragma mark SymbolLocator
1565
1589
1591 static SymbolLocatorInstances g_instances;
1592 return g_instances;
1593}
1594
1596 llvm::StringRef name, llvm::StringRef description,
1597 SymbolLocatorCreateInstance create_callback,
1598 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file,
1599 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file,
1600 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file,
1601 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle,
1602 DebuggerInitializeCallback debugger_init_callback) {
1604 name, description, create_callback, locate_executable_object_file,
1605 locate_executable_symbol_file, download_object_symbol_file,
1606 find_symbol_file_in_bundle, debugger_init_callback);
1607}
1608
1610 SymbolLocatorCreateInstance create_callback) {
1611 return GetSymbolLocatorInstances().UnregisterPlugin(create_callback);
1612}
1613
1614llvm::SmallVector<SymbolLocatorCreateInstance>
1618
1621 StatisticsMap &map) {
1622 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1623 for (auto &instance : instances) {
1624 if (instance.locate_executable_object_file) {
1625 StatsDuration time;
1626 std::optional<ModuleSpec> result;
1627 {
1628 ElapsedTime elapsed(time);
1629 result = instance.locate_executable_object_file(module_spec);
1630 }
1631 map.add(instance.name, time.get().count());
1632 if (result)
1633 return *result;
1634 }
1635 }
1636 return {};
1637}
1638
1640 const ModuleSpec &module_spec, const FileSpecList &default_search_paths,
1641 StatisticsMap &map) {
1642 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1643 for (auto &instance : instances) {
1644 if (instance.locate_executable_symbol_file) {
1645 StatsDuration time;
1646 std::optional<FileSpec> result;
1647 {
1648 ElapsedTime elapsed(time);
1649 result = instance.locate_executable_symbol_file(module_spec,
1650 default_search_paths);
1651 }
1652 map.add(instance.name, time.get().count());
1653 if (result)
1654 return *result;
1655 }
1656 }
1657 return {};
1658}
1659
1661 Status &error,
1662 bool force_lookup,
1663 bool copy_executable) {
1664 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1665 for (auto &instance : instances) {
1666 if (instance.download_object_symbol_file) {
1667 if (instance.download_object_symbol_file(module_spec, error, force_lookup,
1668 copy_executable))
1669 return true;
1670 }
1671 }
1672 return false;
1673}
1674
1676 const UUID *uuid,
1677 const ArchSpec *arch) {
1678 auto instances = GetSymbolLocatorInstances().GetSnapshot();
1679 for (auto &instance : instances) {
1680 if (instance.find_symbol_file_in_bundle) {
1681 std::optional<FileSpec> result =
1682 instance.find_symbol_file_in_bundle(symfile_bundle, uuid, arch);
1683 if (result)
1684 return *result;
1685 }
1686 }
1687 return {};
1688}
1689
1690#pragma mark Trace
1691
1707
1709
1711 static TraceInstances g_instances;
1712 return g_instances;
1713}
1714
1716 llvm::StringRef name, llvm::StringRef description,
1717 TraceCreateInstanceFromBundle create_callback_from_bundle,
1718 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1719 llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback) {
1721 name, description, create_callback_from_bundle,
1722 create_callback_for_live_process, schema, debugger_init_callback);
1723}
1724
1726 TraceCreateInstanceFromBundle create_callback_from_bundle) {
1728 create_callback_from_bundle);
1729}
1730
1732PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1733 return GetTracePluginInstances().GetCallbackForName(plugin_name);
1734}
1735
1738 llvm::StringRef plugin_name) {
1739 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1740 return instance->create_callback_for_live_process;
1741
1742 return nullptr;
1743}
1744
1745llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1746 if (auto instance = GetTracePluginInstances().GetInstanceForName(plugin_name))
1747 return instance->schema;
1748 return llvm::StringRef();
1749}
1750
1751llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1752 if (auto instance = GetTracePluginInstances().GetInstanceAtIndex(index))
1753 return instance->schema;
1754 return llvm::StringRef();
1755}
1756
1757#pragma mark TraceExporter
1758
1772
1774
1776 static TraceExporterInstances g_instances;
1777 return g_instances;
1778}
1779
1781 llvm::StringRef name, llvm::StringRef description,
1782 TraceExporterCreateInstance create_callback,
1783 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1785 name, description, create_callback, create_thread_trace_export_command);
1786}
1787
1790 return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1791}
1792
1794 TraceExporterCreateInstance create_callback) {
1795 return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1796}
1797
1798llvm::SmallVector<TraceExporterCallbacks>
1800 auto instances = GetTraceExporterInstances().GetSnapshot();
1801 llvm::SmallVector<TraceExporterCallbacks> result;
1802 result.reserve(instances.size());
1803 for (auto &instance : instances)
1804 result.push_back({instance.name, instance.create_callback,
1805 instance.create_thread_trace_export_command});
1806 return result;
1807}
1808
1809#pragma mark UnwindAssembly
1810
1813
1815 static UnwindAssemblyInstances g_instances;
1816 return g_instances;
1817}
1818
1820 llvm::StringRef name, llvm::StringRef description,
1821 UnwindAssemblyCreateInstance create_callback) {
1822 return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1823 create_callback);
1824}
1825
1827 UnwindAssemblyCreateInstance create_callback) {
1828 return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1829}
1830
1831llvm::SmallVector<UnwindAssemblyCreateInstance>
1835
1836#pragma mark MemoryHistory
1837
1840
1842 static MemoryHistoryInstances g_instances;
1843 return g_instances;
1844}
1845
1847 llvm::StringRef name, llvm::StringRef description,
1848 MemoryHistoryCreateInstance create_callback) {
1849 return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1850 create_callback);
1851}
1852
1854 MemoryHistoryCreateInstance create_callback) {
1855 return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1856}
1857
1858llvm::SmallVector<MemoryHistoryCreateInstance>
1862
1863#pragma mark InstrumentationRuntime
1864
1877
1879 : public PluginInstances<InstrumentationRuntimeInstance> {
1880
1882 bool enabled_only) {
1883 if (auto instance = GetInstanceForName(name, enabled_only))
1884 return instance->get_type_callback;
1885 return nullptr;
1886 }
1887};
1888
1890 static InstrumentationRuntimeInstances g_instances;
1891 return g_instances;
1892}
1893
1895 llvm::StringRef name, llvm::StringRef description,
1897 InstrumentationRuntimeGetType get_type_callback) {
1899 name, description, create_callback, get_type_callback);
1900}
1901
1906
1907llvm::SmallVector<InstrumentationRuntimeCallbacks>
1909 auto instances =
1911 llvm::SmallVector<InstrumentationRuntimeCallbacks> result;
1912 result.reserve(instances.size());
1913 for (auto &instance : instances)
1914 result.push_back({instance.create_callback, instance.get_type_callback});
1915 return result;
1916}
1917
1918#pragma mark TypeSystem
1919
1934
1936
1938 static TypeSystemInstances g_instances;
1939 return g_instances;
1940}
1941
1943 llvm::StringRef name, llvm::StringRef description,
1944 TypeSystemCreateInstance create_callback,
1945 LanguageSet supported_languages_for_types,
1946 LanguageSet supported_languages_for_expressions) {
1948 name, description, create_callback, supported_languages_for_types,
1949 supported_languages_for_expressions);
1950}
1951
1953 return GetTypeSystemInstances().UnregisterPlugin(create_callback);
1954}
1955
1956llvm::SmallVector<TypeSystemCreateInstance>
1960
1962 const auto instances = GetTypeSystemInstances().GetSnapshot();
1963 LanguageSet all;
1964 for (unsigned i = 0; i < instances.size(); ++i)
1965 all.bitvector |= instances[i].supported_languages_for_types.bitvector;
1966 return all;
1967}
1968
1970 const auto instances = GetTypeSystemInstances().GetSnapshot();
1971 LanguageSet all;
1972 for (unsigned i = 0; i < instances.size(); ++i)
1973 all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
1974 return all;
1975}
1976
1977#pragma mark ScriptedInterfaces
1978
1992
1994
1996 static ScriptedInterfaceInstances g_instances;
1997 return g_instances;
1998}
1999
2001 llvm::StringRef name, llvm::StringRef description,
2002 ScriptedInterfaceCreateInstance create_callback,
2005 name, description, create_callback, language, usages);
2006}
2007
2012
2016
2017llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
2019}
2020
2021llvm::StringRef
2025
2028 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2029 return instance->language;
2031}
2032
2035 if (auto instance = GetScriptedInterfaceInstances().GetInstanceAtIndex(idx))
2036 return instance->usages;
2037 return {};
2038}
2039
2040#pragma mark REPL
2041
2050
2052
2054 static REPLInstances g_instances;
2055 return g_instances;
2056}
2057
2058bool PluginManager::RegisterPlugin(llvm::StringRef name,
2059 llvm::StringRef description,
2060 REPLCreateInstance create_callback,
2061 LanguageSet supported_languages) {
2062 return GetREPLInstances().RegisterPlugin(name, description, create_callback,
2063 supported_languages);
2064}
2065
2067 return GetREPLInstances().UnregisterPlugin(create_callback);
2068}
2069
2070llvm::SmallVector<REPLCallbacks> PluginManager::GetREPLCallbacks() {
2071 auto instances = GetREPLInstances().GetSnapshot();
2072 llvm::SmallVector<REPLCallbacks> result;
2073 result.reserve(instances.size());
2074 for (auto &instance : instances)
2075 result.push_back({instance.create_callback, instance.supported_languages});
2076 return result;
2077}
2078
2080 const auto instances = GetREPLInstances().GetSnapshot();
2081 LanguageSet all;
2082 for (unsigned i = 0; i < instances.size(); ++i)
2083 all.bitvector |= instances[i].supported_languages.bitvector;
2084 return all;
2085}
2086
2087#pragma mark Highlighter
2088
2089struct HighlighterInstance : public PluginInstance<HighlighterCreateInstance> {
2094};
2095
2097
2099 static HighlighterInstances g_instances;
2100 return g_instances;
2101}
2102
2103bool PluginManager::RegisterPlugin(llvm::StringRef name,
2104 llvm::StringRef description,
2105 HighlighterCreateInstance create_callback) {
2106 return GetHighlighterInstances().RegisterPlugin(name, description,
2107 create_callback);
2108}
2109
2111 HighlighterCreateInstance create_callback) {
2112 return GetHighlighterInstances().UnregisterPlugin(create_callback);
2113}
2114
2115llvm::SmallVector<HighlighterCreateInstance>
2119
2120#pragma mark PluginManager
2121
2136
2137// This is the preferred new way to register plugin specific settings. e.g.
2138// This will put a plugin's settings under e.g.
2139// "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
2141 Debugger &debugger, llvm::StringRef plugin_type_name,
2142 llvm::StringRef plugin_type_desc, bool can_create) {
2143 lldb::OptionValuePropertiesSP parent_properties_sp(
2144 debugger.GetValueProperties());
2145 if (parent_properties_sp) {
2146 static constexpr llvm::StringLiteral g_property_name("plugin");
2147
2148 OptionValuePropertiesSP plugin_properties_sp =
2149 parent_properties_sp->GetSubProperty(nullptr, g_property_name);
2150 if (!plugin_properties_sp && can_create) {
2151 plugin_properties_sp =
2152 std::make_shared<OptionValueProperties>(g_property_name);
2153 plugin_properties_sp->SetExpectedPath("plugin");
2154 parent_properties_sp->AppendProperty(g_property_name,
2155 "Settings specify to plugins.", true,
2156 plugin_properties_sp);
2157 }
2158
2159 if (plugin_properties_sp) {
2160 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2161 plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2162 if (!plugin_type_properties_sp && can_create) {
2163 plugin_type_properties_sp =
2164 std::make_shared<OptionValueProperties>(plugin_type_name);
2165 plugin_type_properties_sp->SetExpectedPath(
2166 ("plugin." + plugin_type_name).str());
2167 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2168 true, plugin_type_properties_sp);
2169 }
2170 return plugin_type_properties_sp;
2171 }
2172 }
2174}
2175
2176// This is deprecated way to register plugin specific settings. e.g.
2177// "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
2178// generic settings would be under "platform.SETTINGNAME".
2180 Debugger &debugger, llvm::StringRef plugin_type_name,
2181 llvm::StringRef plugin_type_desc, bool can_create) {
2182 static constexpr llvm::StringLiteral g_property_name("plugin");
2183 lldb::OptionValuePropertiesSP parent_properties_sp(
2184 debugger.GetValueProperties());
2185 if (parent_properties_sp) {
2186 OptionValuePropertiesSP plugin_properties_sp =
2187 parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
2188 if (!plugin_properties_sp && can_create) {
2189 plugin_properties_sp =
2190 std::make_shared<OptionValueProperties>(plugin_type_name);
2191 plugin_properties_sp->SetExpectedPath(plugin_type_name.str());
2192 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
2193 true, plugin_properties_sp);
2194 }
2195
2196 if (plugin_properties_sp) {
2197 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
2198 plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
2199 if (!plugin_type_properties_sp && can_create) {
2200 plugin_type_properties_sp =
2201 std::make_shared<OptionValueProperties>(g_property_name);
2202 plugin_type_properties_sp->SetExpectedPath(
2203 (plugin_type_name + ".plugin").str());
2204 plugin_properties_sp->AppendProperty(g_property_name,
2205 "Settings specific to plugins",
2206 true, plugin_type_properties_sp);
2207 }
2208 return plugin_type_properties_sp;
2209 }
2210 }
2212}
2213
2214namespace {
2215
2217GetDebuggerPropertyForPluginsPtr(Debugger &, llvm::StringRef, llvm::StringRef,
2218 bool can_create);
2219}
2220
2222GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name,
2223 llvm::StringRef plugin_type_name,
2224 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2226 lldb::OptionValuePropertiesSP properties_sp;
2227 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
2228 debugger, plugin_type_name,
2229 "", // not creating to so we don't need the description
2230 false));
2231 if (plugin_type_properties_sp)
2232 properties_sp =
2233 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2234 return properties_sp;
2235}
2236
2237static bool
2238CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name,
2239 llvm::StringRef plugin_type_desc,
2240 const lldb::OptionValuePropertiesSP &properties_sp,
2241 llvm::StringRef description, bool is_global_property,
2242 GetDebuggerPropertyForPluginsPtr get_debugger_property =
2244 if (properties_sp) {
2245 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2246 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
2247 true));
2248 if (plugin_type_properties_sp) {
2249 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2250 description, is_global_property,
2251 properties_sp);
2252 return true;
2253 }
2254 }
2255 return false;
2256}
2257
2258static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader");
2259static constexpr llvm::StringLiteral kPlatformPluginName("platform");
2260static constexpr llvm::StringLiteral kProcessPluginName("process");
2261static constexpr llvm::StringLiteral kTracePluginName("trace");
2262static constexpr llvm::StringLiteral kObjectFilePluginName("object-file");
2263static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file");
2264static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator");
2265static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader");
2266static constexpr llvm::StringLiteral
2267 kStructuredDataPluginName("structured-data");
2268static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus");
2269
2272 llvm::StringRef setting_name) {
2273 return GetSettingForPlugin(debugger, setting_name, kDynamicLoaderPluginName);
2274}
2275
2277 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2278 llvm::StringRef description, bool is_global_property) {
2280 "Settings for dynamic loader plug-ins",
2281 properties_sp, description, is_global_property);
2282}
2283
2286 llvm::StringRef setting_name) {
2287 return GetSettingForPlugin(debugger, setting_name, kPlatformPluginName,
2289}
2290
2292 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2293 llvm::StringRef description, bool is_global_property) {
2295 "Settings for platform plug-ins", properties_sp,
2296 description, is_global_property,
2298}
2299
2302 llvm::StringRef setting_name) {
2303 return GetSettingForPlugin(debugger, setting_name, kProcessPluginName);
2304}
2305
2307 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2308 llvm::StringRef description, bool is_global_property) {
2310 "Settings for process plug-ins", properties_sp,
2311 description, is_global_property);
2312}
2313
2316 llvm::StringRef setting_name) {
2317 return GetSettingForPlugin(debugger, setting_name, kSymbolLocatorPluginName);
2318}
2319
2321 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2322 llvm::StringRef description, bool is_global_property) {
2324 "Settings for symbol locator plug-ins",
2325 properties_sp, description, is_global_property);
2326}
2327
2329 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2330 llvm::StringRef description, bool is_global_property) {
2332 "Settings for trace plug-ins", properties_sp,
2333 description, is_global_property);
2334}
2335
2338 llvm::StringRef setting_name) {
2339 return GetSettingForPlugin(debugger, setting_name, kObjectFilePluginName);
2340}
2341
2343 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2344 llvm::StringRef description, bool is_global_property) {
2346 "Settings for object file plug-ins",
2347 properties_sp, description, is_global_property);
2348}
2349
2352 llvm::StringRef setting_name) {
2353 return GetSettingForPlugin(debugger, setting_name, kSymbolFilePluginName);
2354}
2355
2357 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2358 llvm::StringRef description, bool is_global_property) {
2360 "Settings for symbol file plug-ins",
2361 properties_sp, description, is_global_property);
2362}
2363
2366 llvm::StringRef setting_name) {
2367 return GetSettingForPlugin(debugger, setting_name, kJITLoaderPluginName);
2368}
2369
2371 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2372 llvm::StringRef description, bool is_global_property) {
2374 "Settings for JIT loader plug-ins",
2375 properties_sp, description, is_global_property);
2376}
2377
2378static const char *kOperatingSystemPluginName("os");
2379
2381 Debugger &debugger, llvm::StringRef setting_name) {
2382 lldb::OptionValuePropertiesSP properties_sp;
2383 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2386 "", // not creating to so we don't need the description
2387 false));
2388 if (plugin_type_properties_sp)
2389 properties_sp =
2390 plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
2391 return properties_sp;
2392}
2393
2395 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2396 llvm::StringRef description, bool is_global_property) {
2397 if (properties_sp) {
2398 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
2400 "Settings for operating system plug-ins",
2401 true));
2402 if (plugin_type_properties_sp) {
2403 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
2404 description, is_global_property,
2405 properties_sp);
2406 return true;
2407 }
2408 }
2409 return false;
2410}
2411
2414 llvm::StringRef setting_name) {
2415 return GetSettingForPlugin(debugger, setting_name, kStructuredDataPluginName);
2416}
2417
2419 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2420 llvm::StringRef description, bool is_global_property) {
2422 "Settings for structured data plug-ins",
2423 properties_sp, description, is_global_property);
2424}
2425
2428 Debugger &debugger, llvm::StringRef setting_name) {
2429 return GetSettingForPlugin(debugger, setting_name, kCPlusPlusLanguagePlugin);
2430}
2431
2433 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
2434 llvm::StringRef description, bool is_global_property) {
2436 "Settings for CPlusPlus language plug-ins",
2437 properties_sp, description, is_global_property);
2438}
2439
2440//
2441// Plugin Info+Enable Implementations
2442//
2443llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetABIPluginInfo() {
2445}
2446bool PluginManager::SetABIPluginEnabled(llvm::StringRef name, bool enable) {
2447 return GetABIInstances().SetInstanceEnabled(name, enable);
2448}
2449
2450llvm::SmallVector<RegisteredPluginInfo>
2455 bool enable) {
2456 return GetArchitectureInstances().SetInstanceEnabled(name, enable);
2457}
2458
2459llvm::SmallVector<RegisteredPluginInfo>
2464 bool enable) {
2465 return GetDisassemblerInstances().SetInstanceEnabled(name, enable);
2466}
2467
2468llvm::SmallVector<RegisteredPluginInfo>
2473 bool enable) {
2474 return GetDynamicLoaderInstances().SetInstanceEnabled(name, enable);
2475}
2476
2477llvm::SmallVector<RegisteredPluginInfo>
2482 bool enable) {
2484}
2485
2486llvm::SmallVector<RegisteredPluginInfo>
2490
2492 switch (kind) {
2494 return "global";
2496 return "debugger";
2498 return "target";
2499 }
2500 llvm_unreachable("unhandled PluginDomainKind");
2501}
2502
2504 llvm::StringRef name, bool enable, Debugger &requesting_debugger,
2505 PluginDomainKind domain) {
2506 if (domain != lldb::ePluginDomainKindGlobal)
2507 return llvm::createStringErrorV("{} domain is not supported",
2508 PluginDomainKindToStr(domain));
2509 if (!GetInstrumentationRuntimeInstances().SetInstanceEnabled(name, enable))
2510 return llvm::createStringError("plugin could not be found");
2511
2512 return llvm::Error::success();
2513}
2514
2515llvm::SmallVector<RegisteredPluginInfo>
2520 bool enable) {
2521 return GetJITLoaderInstances().SetInstanceEnabled(name, enable);
2522}
2523
2524llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetLanguagePluginInfo() {
2526}
2528 bool enable) {
2529 return GetLanguageInstances().SetInstanceEnabled(name, enable);
2530}
2531
2532llvm::SmallVector<RegisteredPluginInfo>
2537 bool enable) {
2538 return GetLanguageRuntimeInstances().SetInstanceEnabled(name, enable);
2539}
2540
2541llvm::SmallVector<RegisteredPluginInfo>
2546 bool enable) {
2547 return GetMemoryHistoryInstances().SetInstanceEnabled(name, enable);
2548}
2549
2550llvm::SmallVector<RegisteredPluginInfo>
2555 bool enable) {
2556 return GetObjectContainerInstances().SetInstanceEnabled(name, enable);
2557}
2558
2559llvm::SmallVector<RegisteredPluginInfo>
2564 bool enable) {
2565 return GetObjectFileInstances().SetInstanceEnabled(name, enable);
2566}
2567
2568llvm::SmallVector<RegisteredPluginInfo>
2573 bool enable) {
2574 return GetOperatingSystemInstances().SetInstanceEnabled(name, enable);
2575}
2576
2577llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetPlatformPluginInfo() {
2579}
2581 bool enable) {
2582 return GetPlatformInstances().SetInstanceEnabled(name, enable);
2583}
2584
2585llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetProcessPluginInfo() {
2587}
2588bool PluginManager::SetProcessPluginEnabled(llvm::StringRef name, bool enable) {
2589 return GetProcessInstances().SetInstanceEnabled(name, enable);
2590}
2591
2592llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetREPLPluginInfo() {
2594}
2595bool PluginManager::SetREPLPluginEnabled(llvm::StringRef name, bool enable) {
2596 return GetREPLInstances().SetInstanceEnabled(name, enable);
2597}
2598
2599llvm::SmallVector<RegisteredPluginInfo>
2604 bool enable) {
2606}
2607
2608llvm::SmallVector<RegisteredPluginInfo>
2613 bool enable) {
2615}
2616
2617llvm::SmallVector<RegisteredPluginInfo>
2622 bool enable) {
2624}
2625
2626llvm::SmallVector<RegisteredPluginInfo>
2631 bool enable) {
2633}
2634
2635llvm::SmallVector<RegisteredPluginInfo>
2640 bool enable) {
2641 return GetSymbolFileInstances().SetInstanceEnabled(name, enable);
2642}
2643
2644llvm::SmallVector<RegisteredPluginInfo>
2649 bool enable) {
2650 return GetSymbolLocatorInstances().SetInstanceEnabled(name, enable);
2651}
2652
2653llvm::SmallVector<RegisteredPluginInfo>
2658 bool enable) {
2659 return GetSymbolVendorInstances().SetInstanceEnabled(name, enable);
2660}
2661
2662llvm::SmallVector<RegisteredPluginInfo>
2667 bool enable) {
2668 return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
2669}
2670
2671llvm::SmallVector<RegisteredPluginInfo> PluginManager::GetTracePluginInfo() {
2673}
2674bool PluginManager::SetTracePluginEnabled(llvm::StringRef name, bool enable) {
2675 return GetTracePluginInstances().SetInstanceEnabled(name, enable);
2676}
2677
2678llvm::SmallVector<RegisteredPluginInfo>
2683 bool enable) {
2684 return GetTraceExporterInstances().SetInstanceEnabled(name, enable);
2685}
2686
2687llvm::SmallVector<RegisteredPluginInfo>
2692 bool enable) {
2693 return GetTypeSystemInstances().SetInstanceEnabled(name, enable);
2694}
2695
2696llvm::SmallVector<RegisteredPluginInfo>
2701 bool enable) {
2702 return GetUnwindAssemblyInstances().SetInstanceEnabled(name, enable);
2703}
2704
2706 CompletionRequest &request) {
2707 // Split the name into the namespace and the plugin name.
2708 // If there is no dot then the ns_name will be equal to name and
2709 // plugin_prefix will be empty.
2710 llvm::StringRef ns_name, plugin_prefix;
2711 std::tie(ns_name, plugin_prefix) = name.split('.');
2712
2713 for (const PluginNamespace &plugin_ns : GetPluginNamespaces()) {
2714 // If the plugin namespace matches exactly then
2715 // add all the plugins in this namespace as completions if the
2716 // plugin names starts with the plugin_prefix. If the plugin_prefix
2717 // is empty then it will match all the plugins (empty string is a
2718 // prefix of everything).
2719 if (plugin_ns.name == ns_name) {
2720 for (const RegisteredPluginInfo &plugin : plugin_ns.get_info()) {
2721 llvm::SmallString<128> buf;
2722 if (plugin.name.starts_with(plugin_prefix))
2723 request.AddCompletion(
2724 (plugin_ns.name + "." + plugin.name).toStringRef(buf));
2725 }
2726 } else if (plugin_ns.name.starts_with(name) &&
2727 !plugin_ns.get_info().empty()) {
2728 // Otherwise check if the namespace is a prefix of the full name.
2729 // Use a partial completion here so that we can either operate on the full
2730 // namespace or tab-complete to the next level.
2731 request.AddCompletion(plugin_ns.name, "", CompletionMode::Partial);
2732 }
2733 }
2734}
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:852
#define LLDB_LOG_ERROR(log, error,...)
Definition Log.h:394
static DisassemblerInstances & GetDisassemblerInstances()
PluginInstances< ProtocolServerInstance > ProtocolServerInstances
static TraceInstances & GetTracePluginInstances()
static ObjectContainerInstances & GetObjectContainerInstances()
PluginInstances< JITLoaderInstance > JITLoaderInstances
static MemoryHistoryInstances & GetMemoryHistoryInstances()
PluginInstance< PlatformCreateInstance > PlatformInstance
PluginInstances< HighlighterInstance > HighlighterInstances
static DynamicLoaderInstances & GetDynamicLoaderInstances()
PluginInstances< SymbolFileInstance > SymbolFileInstances
PluginInstances< TypeSystemInstance > TypeSystemInstances
PluginInstance< ABICreateInstance > ABIInstance
static SystemRuntimeInstances & GetSystemRuntimeInstances()
PluginInstances< TraceExporterInstance > TraceExporterInstances
static constexpr llvm::StringLiteral kPlatformPluginName("platform")
static constexpr llvm::StringLiteral g_plugin_prefix
PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
static ABIInstances & GetABIInstances()
static constexpr llvm::StringLiteral kProcessPluginName("process")
PluginInstances< SymbolVendorInstance > SymbolVendorInstances
static constexpr llvm::StringLiteral kDynamicLoaderPluginName("dynamic-loader")
static lldb::OptionValuePropertiesSP GetSettingForPlugin(Debugger &debugger, llvm::StringRef setting_name, llvm::StringRef plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
static ScriptInterpreterInstances & GetScriptInterpreterInstances()
PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
PluginInstances< PlatformInstance > PlatformInstances
PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
static constexpr llvm::StringLiteral kCPlusPlusLanguagePlugin("cplusplus")
PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
static TraceExporterInstances & GetTraceExporterInstances()
PluginInstance< LanguageCreateInstance > LanguageInstance
PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
static constexpr llvm::StringLiteral kSymbolLocatorPluginName("symbol-locator")
PluginInstances< ObjectFileInstance > ObjectFileInstances
void(* PluginTermCallback)()
static StructuredDataPluginInstances & GetStructuredDataPluginInstances()
static constexpr llvm::StringLiteral kObjectFilePluginName("object-file")
PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create)
PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
PluginInstances< LanguageInstance > LanguageInstances
PluginInstances< TraceInstance > TraceInstances
PluginInstances< ArchitectureInstance > ArchitectureInstances
PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
static constexpr llvm::StringLiteral kStructuredDataPluginName("structured-data")
PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
static const char * kOperatingSystemPluginName("os")
static SymbolLocatorInstances & GetSymbolLocatorInstances()
PluginInstance< ProtocolServerCreateInstance > ProtocolServerInstance
PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
static ObjectFileInstances & GetObjectFileInstances()
static constexpr llvm::StringLiteral kSymbolFilePluginName("symbol-file")
PluginInstances< SymbolLocatorInstance > SymbolLocatorInstances
PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
static EmulateInstructionInstances & GetEmulateInstructionInstances()
PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
static LanguageInstances & GetLanguageInstances()
static constexpr llvm::StringLiteral kJITLoaderPluginName("jit-loader")
static ScriptedFrameProviderInstances & GetScriptedFrameProviderInstances()
PluginInstances< OperatingSystemInstance > OperatingSystemInstances
static LanguageRuntimeInstances & GetLanguageRuntimeInstances()
PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances()
PluginInstances< ProcessInstance > ProcessInstances
PluginInstances< SyntheticFrameProviderInstance > SyntheticFrameProviderInstances
PluginInstances< REPLInstance > REPLInstances
static ArchitectureInstances & GetArchitectureInstances()
static DynamicPluginMap & GetPluginMap()
PluginInstances< ScriptedFrameProviderInstance > ScriptedFrameProviderInstances
static RegisterTypeBuilderInstances & GetRegisterTypeBuilderInstances()
static std::recursive_mutex & GetPluginMapMutex()
llvm::SmallDenseMap< FileSpec, PluginInfo > DynamicPluginMap
static HighlighterInstances & GetHighlighterInstances()
static TypeSystemInstances & GetTypeSystemInstances()
static PlatformInstances & GetPlatformInstances()
static ScriptedInterfaceInstances & GetScriptedInterfaceInstances()
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
PluginInstances< EmulateInstructionInstance > EmulateInstructionInstances
PluginInstance< SyntheticFrameProviderCreateInstance > SyntheticFrameProviderInstance
static JITLoaderInstances & GetJITLoaderInstances()
PluginInstances< DisassemblerInstance > DisassemblerInstances
PluginInstance< ProcessCreateInstance > ProcessInstance
static UnwindAssemblyInstances & GetUnwindAssemblyInstances()
static void SetPluginInfo(const FileSpec &plugin_file_spec, PluginInfo plugin_info)
PluginInstances< ScriptedInterfaceInstance > ScriptedInterfaceInstances
PluginInstances< UnwindAssemblyInstance > UnwindAssemblyInstances
static SymbolFileInstances & GetSymbolFileInstances()
static bool CreateSettingForPlugin(Debugger &debugger, llvm::StringRef plugin_type_name, llvm::StringRef plugin_type_desc, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
PluginInstances< ABIInstance > ABIInstances
static FPtrTy CastToFPtr(void *VPtr)
static ProcessInstances & GetProcessInstances()
static bool PluginIsLoaded(const FileSpec &plugin_file_spec)
static OperatingSystemInstances & GetOperatingSystemInstances()
static constexpr llvm::StringLiteral kTracePluginName("trace")
PluginInstance< ScriptedFrameProviderCreateInstance > ScriptedFrameProviderInstance
PluginInstances< ScriptInterpreterInstance > ScriptInterpreterInstances
static SyntheticFrameProviderInstances & GetSyntheticFrameProviderInstances()
bool(* PluginInitCallback)()
PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
static SymbolVendorInstances & GetSymbolVendorInstances()
PluginInstances< ObjectContainerInstance > ObjectContainerInstances
static ProtocolServerInstances & GetProtocolServerInstances()
PluginInstances< RegisterTypeBuilderInstance > RegisterTypeBuilderInstances
static REPLInstances & GetREPLInstances()
static double elapsed(const StatsTimepoint &start, const StatsTimepoint &end)
bool UnregisterPlugin(typename Instance::CallbackType callback)
std::optional< ABIInstance > FindInstance(std::function< bool(const ABIInstance &)> predicate) const
llvm::StringRef GetNameAtIndex(uint32_t idx)
llvm::SmallVector< ABIInstance > m_instances
llvm::StringRef GetDescriptionAtIndex(uint32_t idx)
llvm::SmallVector< typename Instance::CallbackType > GetCreateCallbacks()
std::optional< ABIInstance > GetInstanceAtIndex(uint32_t idx)
llvm::SmallVector< RegisteredPluginInfo > GetPluginInfoForAllInstances()
Instance::CallbackType GetCallbackForName(llvm::StringRef name)
llvm::SmallVector< ABIInstance > GetSnapshot(bool enabled_only=true) const
bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, typename Instance::CallbackType callback, Args &&...args)
void PerformDebuggerCallback(Debugger &debugger)
std::optional< ABIInstance > FindEnabledInstance(std::function< bool(const ABIInstance &)> predicate) const
std::optional< ABIInstance > GetInstanceForName(llvm::StringRef name, bool enabled_only=true)
bool SetInstanceEnabled(llvm::StringRef name, bool enable)
An architecture specification class.
Definition ArchSpec.h:32
A command line argument class.
Definition Args.h:33
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
A class to manage flag bits.
Definition Debugger.h:100
A class that measures elapsed time in an exception safe way.
Definition Statistics.h:76
A file collection class.
A file utility class.
Definition FileSpec.h:57
const ConstString & GetFilename() const
Filename string const get accessor.
Definition FileSpec.h:250
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 llvm::StringRef PluginDomainKindToStr(lldb::PluginDomainKind kind)
static bool SetTraceExporterPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetArchitecturePluginInfo()
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< UnwindAssemblyCreateInstance > GetUnwindAssemblyCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForObjectFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetEmulateInstructionPluginInfo()
static void AutoCompletePlatformName(llvm::StringRef partial_name, CompletionRequest &request)
static TraceExporterCreateInstance GetTraceExporterCreateCallback(llvm::StringRef plugin_name)
static bool SetDynamicLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::json::Object GetJSON(llvm::StringRef pattern="")
static bool CreateSettingForObjectFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetScriptedInterfacePluginEnabled(llvm::StringRef name, bool enable)
static bool SetOperatingSystemPluginEnabled(llvm::StringRef name, bool enable)
static lldb::ScriptInterpreterSP GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang, Debugger &debugger)
static llvm::SmallVector< ABICreateInstance > GetABICreateCallbacks()
static llvm::SmallVector< InstrumentationRuntimeCallbacks > GetInstrumentationRuntimeCallbacks(bool enabled_only=true)
static void AutoCompleteProcessName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptInterpreterPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetABIPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguagePluginInfo()
static LanguageSet GetREPLAllTypeSystemSupportedLanguages()
static llvm::SmallVector< OperatingSystemCreateInstance > GetOperatingSystemCreateCallbacks()
static bool CreateSettingForTracePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetDynamicLoaderPluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::Error SetInstrumentationRuntimePluginEnabled(llvm::StringRef name, bool enable, Debugger &requesting_debugger, lldb::PluginDomainKind domain)
static llvm::SmallVector< ProcessCreateInstance > GetProcessCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetObjectContainerPluginInfo()
static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Status &error, bool force_lookup=true, bool copy_executable=true)
static llvm::SmallVector< RegisteredPluginInfo > GetDisassemblerPluginInfo()
static llvm::SmallVector< LanguageRuntimeCallbacks > GetLanguageRuntimeCallbacks()
static llvm::SmallVector< SymbolFileCreateInstance > GetSymbolFileCreateCallbacks()
static bool SetLanguageRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetObjectFilePluginInfo()
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolLocatorPluginInfo()
static llvm::StringRef GetTraceSchema(llvm::StringRef plugin_name)
Get the JSON schema for a trace bundle description file corresponding to the given plugin.
static llvm::SmallVector< SymbolVendorCreateInstance > GetSymbolVendorCreateCallbacks()
static bool SetUnwindAssemblyPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForCPlusPlusLanguagePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetDisassemblerPluginEnabled(llvm::StringRef name, bool enable)
static bool SetSystemRuntimePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetTracePluginInfo()
static llvm::SmallVector< JITLoaderCreateInstance > GetJITLoaderCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetProcessPluginInfo()
static TraceCreateInstanceForLiveProcess GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name)
static std::unique_ptr< Architecture > CreateArchitectureInstance(const ArchSpec &arch)
static llvm::SmallVector< DisassemblerCreateInstance > GetDisassemblerCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForSymbolLocatorPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool SetStructuredDataPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ObjectFileCallbacks > GetObjectFileCallbacks()
static uint32_t GetNumScriptedInterfaces()
static llvm::SmallVector< RegisteredPluginInfo > GetLanguageRuntimePluginInfo()
static bool SetObjectContainerPluginEnabled(llvm::StringRef name, bool enable)
static bool CreateSettingForProcessPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetPlatformPluginInfo()
static llvm::SmallVector< RegisteredPluginInfo > GetMemoryHistoryPluginInfo()
static llvm::SmallVector< TypeSystemCreateInstance > GetTypeSystemCreateCallbacks()
static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name)
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolFilePluginInfo()
static SyntheticFrameProviderCreateInstance GetSyntheticFrameProviderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< SymbolLocatorCreateInstance > GetSymbolLocatorCreateCallbacks()
static llvm::ArrayRef< PluginNamespace > GetPluginNamespaces()
static bool SetTypeSystemPluginEnabled(llvm::StringRef name, bool enable)
static bool SetTracePluginEnabled(llvm::StringRef name, bool enable)
static Status SaveCore(lldb_private::SaveCoreOptions &core_options)
static llvm::SmallVector< RegisteredPluginInfo > GetTraceExporterPluginInfo()
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths, StatisticsMap &map)
static bool SetEmulateInstructionPluginEnabled(llvm::StringRef name, bool enable)
static lldb::OptionValuePropertiesSP GetSettingForJITLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static DisassemblerCreateInstance GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name)
static bool SetJITLoaderPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetInstrumentationRuntimePluginInfo()
static llvm::SmallVector< REPLCallbacks > GetREPLCallbacks()
static bool CreateSettingForSymbolFilePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static OperatingSystemCreateInstance GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name)
static bool SetSymbolFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< ScriptInterpreterCreateInstance > GetScriptInterpreterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetRegisterTypeBuilderPluginInfo()
static EmulateInstructionCreateInstance GetEmulateInstructionCreateCallbackForPluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForSymbolFilePlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForStructuredDataPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool CreateSettingForCPlusPlusLanguagePlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< TraceExporterCallbacks > GetTraceExporterCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetSymbolVendorPluginInfo()
static DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< EmulateInstructionCreateInstance > GetEmulateInstructionCreateCallbacks()
static PlatformCreateInstance GetPlatformCreateCallbackForPluginName(llvm::StringRef name)
static bool SetProcessPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< llvm::StringRef > GetSaveCorePluginNames()
static llvm::SmallVector< RegisteredPluginInfo > GetOperatingSystemPluginInfo()
static llvm::SmallVector< ScriptedFrameProviderCreateInstance > GetScriptedFrameProviderCreateCallbacks()
static bool SetABIPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetScriptedInterfacePluginInfo()
static lldb::OptionValuePropertiesSP GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name)
static ProcessCreateInstance GetProcessCreateCallbackForPluginName(llvm::StringRef name)
static void AutoCompletePluginName(llvm::StringRef partial_name, CompletionRequest &request)
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetProtocolServerPluginNameAtIndex(uint32_t idx)
static bool IsRegisteredObjectFilePluginName(llvm::StringRef name)
static lldb::OptionValuePropertiesSP GetSettingForDynamicLoaderPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForDynamicLoaderPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool SetLanguagePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< RegisteredPluginInfo > GetREPLPluginInfo()
static bool SetREPLPluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< HighlighterCreateInstance > GetHighlighterCreateCallbacks()
static llvm::SmallVector< RegisteredPluginInfo > GetUnwindAssemblyPluginInfo()
static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx)
static bool SetSymbolVendorPluginEnabled(llvm::StringRef name, bool enable)
static TraceCreateInstanceFromBundle GetTraceCreateCallback(llvm::StringRef plugin_name)
static void DebuggerInitialize(Debugger &debugger)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static llvm::SmallVector< ObjectContainerCallbacks > GetObjectContainerCallbacks()
static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx)
static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec, StatisticsMap &map)
static llvm::SmallVector< StructuredDataPluginCallbacks > GetStructuredDataPluginCallbacks()
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
static llvm::SmallVector< SystemRuntimeCreateInstance > GetSystemRuntimeCreateCallbacks()
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
static llvm::SmallVector< RegisteredPluginInfo > GetStructuredDataPluginInfo()
static bool SetSymbolLocatorPluginEnabled(llvm::StringRef name, bool enable)
static ProtocolServerCreateInstance GetProtocolCreateCallbackForPluginName(llvm::StringRef name)
static llvm::SmallVector< LanguageCreateInstance > GetLanguageCreateCallbacks()
static llvm::SmallVector< DynamicLoaderCreateInstance > GetDynamicLoaderCreateCallbacks()
static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target)
static llvm::SmallVector< MemoryHistoryCreateInstance > GetMemoryHistoryCreateCallbacks()
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name)
static bool CreateSettingForSymbolLocatorPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static llvm::SmallVector< RegisteredPluginInfo > GetJITLoaderPluginInfo()
static bool SetObjectFilePluginEnabled(llvm::StringRef name, bool enable)
static llvm::SmallVector< PlatformCreateInstance > GetPlatformCreateCallbacks()
lldb::OptionValuePropertiesSP GetValueProperties() const
const std::optional< lldb_private::FileSpec > GetOutputFile() const
std::optional< std::string > GetPluginName() const
lldb::ProcessSP GetProcess() const
A class to count time for plugins.
Definition Statistics.h:94
void add(llvm::StringRef key, double value)
Definition Statistics.h:96
An error handling class.
Definition Status.h:118
static Status FromErrorString(const char *str)
Definition Status.h:141
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
Definition Status.h:151
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition Status.cpp:136
Represents UUID's of various sizes.
Definition UUID.h:27
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition Log.h:327
SymbolVendor *(* SymbolVendorCreateInstance)(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
bool(* ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, lldb_private::SaveCoreOptions &options, Status &error)
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceForLiveProcess)(Process &process)
FileSpec(* ScriptInterpreterGetPath)()
lldb::RegisterTypeBuilderSP(* RegisterTypeBuilderCreateInstance)(Target &target)
lldb::ProtocolServerUP(* ProtocolServerCreateInstance)()
LanguageRuntime *(* LanguageRuntimeCreateInstance)(Process *process, lldb::LanguageType language)
lldb::InstrumentationRuntimeType(* InstrumentationRuntimeGetType)()
llvm::Expected< lldb::TraceSP >(* TraceCreateInstanceFromBundle)(const llvm::json::Value &trace_bundle_description, llvm::StringRef session_file_dir, lldb_private::Debugger &debugger)
Trace.
lldb::DisassemblerSP(* DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor, const char *cpu, const char *features)
std::optional< FileSpec >(* SymbolLocatorLocateExecutableSymbolFile)(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
EmulateInstruction *(* EmulateInstructionCreateInstance)(const ArchSpec &arch, InstructionType inst_type)
ObjectContainer *(* ObjectContainerCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
void(* DebuggerInitializeCallback)(Debugger &debugger)
std::unique_ptr< Architecture >(* ArchitectureCreateInstance)(const ArchSpec &arch)
lldb::ScriptInterpreterSP(* ScriptInterpreterCreateInstance)(Debugger &debugger)
lldb::PlatformSP(* PlatformCreateInstance)(bool force, const ArchSpec *arch)
bool(* ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
SystemRuntime *(* SystemRuntimeCreateInstance)(Process *process)
lldb::ProcessSP(* ProcessCreateInstance)(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
UnwindAssembly *(* UnwindAssemblyCreateInstance)(const ArchSpec &arch)
lldb::TypeSystemSP(* TypeSystemCreateInstance)(lldb::LanguageType language, Module *module, Target *target)
lldb::BreakpointPreconditionSP(* LanguageRuntimeGetExceptionPrecondition)(lldb::LanguageType language, bool throw_bp)
ObjectContainer *(* ObjectContainerCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t offset, lldb::offset_t length)
lldb::MemoryHistorySP(* MemoryHistoryCreateInstance)(const lldb::ProcessSP &process_sp)
ObjectFile *(* ObjectFileCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
SymbolLocator *(* SymbolLocatorCreateInstance)()
std::optional< ModuleSpec >(* SymbolLocatorLocateExecutableObjectFile)(const ModuleSpec &module_spec)
@ Partial
The current token has been partially completed.
lldb::CommandObjectSP(* LanguageRuntimeGetCommandObject)(CommandInterpreter &interpreter)
DynamicLoader *(* DynamicLoaderCreateInstance)(Process *process, bool force)
lldb::StructuredDataPluginSP(* StructuredDataPluginCreateInstance)(Process &process)
lldb::JITLoaderSP(* JITLoaderCreateInstance)(Process *process, bool force)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* SyntheticFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const std::vector< lldb_private::ThreadSpec > &thread_specs)
OperatingSystem *(* OperatingSystemCreateInstance)(Process *process, bool force)
lldb::REPLSP(* REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options)
SymbolFile *(* SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp)
llvm::Expected< lldb::TraceExporterUP >(* TraceExporterCreateInstance)()
Highlighter *(* HighlighterCreateInstance)(lldb::LanguageType language)
std::optional< FileSpec >(* SymbolLocatorFindSymbolFileInBundle)(const FileSpec &dsym_bundle_fspec, const UUID *uuid, const ArchSpec *arch)
bool(* SymbolLocatorDownloadObjectAndSymbolFile)(ModuleSpec &module_spec, Status &error, bool force_lookup, bool copy_executable)
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
Status(* StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, Target *target)
ObjectFile *(* ObjectFileCreateInstance)(const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
ModuleSpecList(* ObjectFileGetModuleSpecifications)(const FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t file_offset, lldb::offset_t length)
lldb::ABISP(* ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch)
llvm::Expected< lldb::SyntheticFrameProviderSP >(* ScriptedFrameProviderCreateInstance)(lldb::StackFrameListSP input_frames, const lldb_private::ScriptedFrameProviderDescriptor &descriptor)
lldb::CommandObjectSP(* ThreadTraceExportCommandCreator)(CommandInterpreter &interpreter)
lldb::InstrumentationRuntimeSP(* InstrumentationRuntimeCreateInstance)(const lldb::ProcessSP &process_sp)
ScriptLanguage
Script interpreter types.
@ eScriptLanguageNone
std::shared_ptr< lldb_private::OptionValueProperties > OptionValuePropertiesSP
std::shared_ptr< lldb_private::ScriptInterpreter > ScriptInterpreterSP
@ ePluginDomainKindTarget
@ ePluginDomainKindGlobal
@ ePluginDomainKindDebugger
std::shared_ptr< lldb_private::RegisterTypeBuilder > RegisterTypeBuilderSP
HighlighterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
InstrumentationRuntimeGetType get_type_callback
InstrumentationRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, InstrumentationRuntimeGetType get_type_callback)
InstrumentationRuntimeGetType GetTypeCallbackForName(llvm::StringRef name, bool enabled_only)
LanguageRuntimeGetExceptionPrecondition precondition_callback
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
LanguageRuntimeGetCommandObject command_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
ObjectContainerCreateMemoryInstance create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
ObjectFileGetModuleSpecifications get_module_specifications
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
ObjectFileSaveCore save_core
PluginDir(FileSpec path, LoadPolicy policy)
const LoadPolicy policy
Filter when looking for plugins.
const FileSpec path
The path to the plugin directory.
@ LoadOnlyWithLLDBPrefix
Only load shared libraries who's filename start with g_plugin_prefix.
@ LoadAnyDylib
Try to load anything that looks like a shared library.
PluginTermCallback plugin_term_callback
PluginInfo()=default
llvm::sys::DynamicLibrary library
PluginInfo & operator=(PluginInfo &&other)
PluginInitCallback plugin_init_callback
PluginInfo(const PluginInfo &)=delete
PluginInfo(PluginInfo &&other)
static llvm::Expected< PluginInfo > Create(const FileSpec &path)
PluginInfo & operator=(const PluginInfo &)=delete
DebuggerInitializeCallback debugger_init_callback
PluginInstance()=default
PluginInstance(llvm::StringRef name, llvm::StringRef description, Callback create_callback, DebuggerInitializeCallback debugger_init_callback=nullptr)
LanguageSet supported_languages
REPLInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages)
RegisterTypeBuilderInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback)
ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, lldb::ScriptLanguage language, ScriptInterpreterGetPath get_path_callback)
lldb::ScriptLanguage language
ScriptInterpreterGetPath get_path_callback
ScriptedInterfaceUsages usages
lldb::ScriptLanguage language
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description, ScriptedInterfaceCreateInstance create_callback, lldb::ScriptLanguage language, ScriptedInterfaceUsages usages)
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
StructuredDataFilterLaunchInfo filter_callback
SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle
SymbolLocatorInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, SymbolLocatorLocateExecutableObjectFile locate_executable_object_file, SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file, SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file, SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle, DebuggerInitializeCallback debugger_init_callback)
SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file
SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file
SymbolLocatorLocateExecutableObjectFile locate_executable_object_file
ThreadTraceExportCommandCreator create_thread_trace_export_command
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
llvm::StringRef schema
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema, DebuggerInitializeCallback debugger_init_callback)
TraceCreateInstanceForLiveProcess create_callback_for_live_process
LanguageSet supported_languages_for_expressions
LanguageSet supported_languages_for_types
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition Type.h:38
llvm::SmallBitVector bitvector
Definition Type.h:39