20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/DynamicLibrary.h"
22 #include "llvm/Support/FileSystem.h"
23 #include "llvm/Support/raw_ostream.h"
52 static std::recursive_mutex g_plugin_map_mutex;
53 return g_plugin_map_mutex;
64 return plugin_map.find(plugin_file_spec) != plugin_map.end();
71 assert(plugin_map.find(plugin_file_spec) == plugin_map.end());
72 plugin_map[plugin_file_spec] = plugin_info;
75 template <
typename FPtrTy>
static FPtrTy
CastToFPtr(
void *VPtr) {
76 return reinterpret_cast<FPtrTy
>(VPtr);
81 llvm::StringRef path) {
84 namespace fs = llvm::sys::fs;
89 if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
90 ft == fs::file_type::type_unknown) {
92 FileSystem::Instance().Resolve(plugin_file_spec);
95 return FileSystem::eEnumerateDirectoryResultNext;
100 plugin_info.
library = llvm::sys::DynamicLibrary::getPermanentLibrary(
101 plugin_file_spec.
GetPath().c_str(), &pluginLoadError);
102 if (plugin_info.
library.isValid()) {
103 bool success =
false;
105 plugin_info.
library.getAddressOfSymbol(
"LLDBPluginInitialize"));
114 plugin_info.
library.getAddressOfSymbol(
"LLDBPluginTerminate"));
127 return FileSystem::eEnumerateDirectoryResultNext;
132 if (ft == fs::file_type::directory_file ||
133 ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
138 return FileSystem::eEnumerateDirectoryResultEnter;
141 return FileSystem::eEnumerateDirectoryResultNext;
144 void PluginManager::Initialize() {
145 const bool find_directories =
true;
146 const bool find_files =
true;
147 const bool find_other =
true;
149 if (
FileSpec dir_spec = HostInfo::GetSystemPluginDir()) {
150 if (FileSystem::Instance().Exists(dir_spec) &&
151 dir_spec.GetPath(dir_path,
sizeof(dir_path))) {
152 FileSystem::Instance().EnumerateDirectory(dir_path, find_directories,
153 find_files, find_other,
158 if (
FileSpec dir_spec = HostInfo::GetUserPluginDir()) {
159 if (FileSystem::Instance().Exists(dir_spec) &&
160 dir_spec.GetPath(dir_path,
sizeof(dir_path))) {
161 FileSystem::Instance().EnumerateDirectory(dir_path, find_directories,
162 find_files, find_other,
168 void PluginManager::Terminate() {
172 PluginTerminateMap::const_iterator pos, end = plugin_map.end();
173 for (pos = plugin_map.begin(); pos != end; ++pos) {
176 if (pos->second.library.isValid()) {
177 if (pos->second.plugin_term_callback)
178 pos->second.plugin_term_callback();
189 Callback create_callback,
191 : name(name), description(description), create_callback(create_callback),
192 debugger_init_callback(debugger_init_callback) {}
202 template <
typename...
Args>
204 typename Instance::CallbackType callback,
208 assert(!name.empty());
210 Instance(name, description, callback, std::forward<Args>(args)...);
211 m_instances.push_back(instance);
218 auto pos = m_instances.begin();
219 auto end = m_instances.end();
220 for (; pos != end; ++pos) {
221 if (pos->create_callback == callback) {
222 m_instances.erase(pos);
230 if (Instance *instance = GetInstanceAtIndex(idx))
231 return instance->create_callback;
236 if (Instance *instance = GetInstanceAtIndex(idx))
237 return instance->description;
242 if (Instance *instance = GetInstanceAtIndex(idx))
243 return instance->name;
250 for (
auto &instance : m_instances) {
251 if (name == instance.name)
252 return instance.create_callback;
258 for (
auto &instance : m_instances) {
259 if (instance.debugger_init_callback)
260 instance.debugger_init_callback(debugger);
264 const std::vector<Instance> &
GetInstances()
const {
return m_instances; }
268 if (idx < m_instances.size())
269 return &m_instances[idx];
287 bool PluginManager::RegisterPlugin(llvm::StringRef name,
288 llvm::StringRef description,
289 ABICreateInstance create_callback) {
293 bool PluginManager::UnregisterPlugin(ABICreateInstance create_callback) {
297 ABICreateInstance PluginManager::GetABICreateCallbackAtIndex(
uint32_t idx) {
301 #pragma mark Architecture
311 void PluginManager::RegisterPlugin(llvm::StringRef name,
312 llvm::StringRef description,
313 ArchitectureCreateInstance create_callback) {
317 void PluginManager::UnregisterPlugin(
318 ArchitectureCreateInstance create_callback) {
321 for (
auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) {
322 if (pos->create_callback == create_callback) {
323 instances.erase(pos);
327 llvm_unreachable(
"Plugin not found");
330 std::unique_ptr<Architecture>
331 PluginManager::CreateArchitectureInstance(
const ArchSpec &arch) {
333 if (
auto plugin_up = instances.create_callback(arch))
339 #pragma mark Disassembler
349 bool PluginManager::RegisterPlugin(llvm::StringRef name,
350 llvm::StringRef description,
351 DisassemblerCreateInstance create_callback) {
356 bool PluginManager::UnregisterPlugin(
357 DisassemblerCreateInstance create_callback) {
361 DisassemblerCreateInstance
362 PluginManager::GetDisassemblerCreateCallbackAtIndex(
uint32_t idx) {
366 DisassemblerCreateInstance
367 PluginManager::GetDisassemblerCreateCallbackForPluginName(
368 llvm::StringRef name) {
372 #pragma mark DynamicLoader
382 bool PluginManager::RegisterPlugin(
383 llvm::StringRef name, llvm::StringRef description,
384 DynamicLoaderCreateInstance create_callback,
387 name, description, create_callback, debugger_init_callback);
390 bool PluginManager::UnregisterPlugin(
391 DynamicLoaderCreateInstance create_callback) {
395 DynamicLoaderCreateInstance
396 PluginManager::GetDynamicLoaderCreateCallbackAtIndex(
uint32_t idx) {
400 DynamicLoaderCreateInstance
401 PluginManager::GetDynamicLoaderCreateCallbackForPluginName(
402 llvm::StringRef name) {
406 #pragma mark JITLoader
416 bool PluginManager::RegisterPlugin(
417 llvm::StringRef name, llvm::StringRef description,
418 JITLoaderCreateInstance create_callback,
421 name, description, create_callback, debugger_init_callback);
424 bool PluginManager::UnregisterPlugin(JITLoaderCreateInstance create_callback) {
428 JITLoaderCreateInstance
429 PluginManager::GetJITLoaderCreateCallbackAtIndex(
uint32_t idx) {
433 #pragma mark EmulateInstruction
444 bool PluginManager::RegisterPlugin(
445 llvm::StringRef name, llvm::StringRef description,
446 EmulateInstructionCreateInstance create_callback) {
451 bool PluginManager::UnregisterPlugin(
452 EmulateInstructionCreateInstance create_callback) {
456 EmulateInstructionCreateInstance
457 PluginManager::GetEmulateInstructionCreateCallbackAtIndex(
uint32_t idx) {
461 EmulateInstructionCreateInstance
462 PluginManager::GetEmulateInstructionCreateCallbackForPluginName(
463 llvm::StringRef name) {
467 #pragma mark OperatingSystem
477 bool PluginManager::RegisterPlugin(
478 llvm::StringRef name, llvm::StringRef description,
479 OperatingSystemCreateInstance create_callback,
482 name, description, create_callback, debugger_init_callback);
485 bool PluginManager::UnregisterPlugin(
486 OperatingSystemCreateInstance create_callback) {
490 OperatingSystemCreateInstance
491 PluginManager::GetOperatingSystemCreateCallbackAtIndex(
uint32_t idx) {
495 OperatingSystemCreateInstance
496 PluginManager::GetOperatingSystemCreateCallbackForPluginName(
497 llvm::StringRef name) {
501 #pragma mark Language
511 bool PluginManager::RegisterPlugin(llvm::StringRef name,
512 llvm::StringRef description,
513 LanguageCreateInstance create_callback) {
518 bool PluginManager::UnregisterPlugin(LanguageCreateInstance create_callback) {
522 LanguageCreateInstance
523 PluginManager::GetLanguageCreateCallbackAtIndex(
uint32_t idx) {
527 #pragma mark LanguageRuntime
532 llvm::StringRef name, llvm::StringRef description,
535 LanguageRuntimeGetCommandObject command_callback,
536 LanguageRuntimeGetExceptionPrecondition precondition_callback)
538 name, description, create_callback, debugger_init_callback),
539 command_callback(command_callback),
540 precondition_callback(precondition_callback) {}
553 bool PluginManager::RegisterPlugin(
554 llvm::StringRef name, llvm::StringRef description,
556 LanguageRuntimeGetCommandObject command_callback,
557 LanguageRuntimeGetExceptionPrecondition precondition_callback) {
559 name, description, create_callback,
nullptr, command_callback,
560 precondition_callback);
563 bool PluginManager::UnregisterPlugin(
569 PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(
uint32_t idx) {
573 LanguageRuntimeGetCommandObject
574 PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex(
uint32_t idx) {
576 if (idx < instances.size())
577 return instances[idx].command_callback;
581 LanguageRuntimeGetExceptionPrecondition
582 PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(
uint32_t idx) {
584 if (idx < instances.size())
585 return instances[idx].precondition_callback;
589 #pragma mark SystemRuntime
599 bool PluginManager::RegisterPlugin(
600 llvm::StringRef name, llvm::StringRef description,
601 SystemRuntimeCreateInstance create_callback) {
606 bool PluginManager::UnregisterPlugin(
607 SystemRuntimeCreateInstance create_callback) {
611 SystemRuntimeCreateInstance
612 PluginManager::GetSystemRuntimeCreateCallbackAtIndex(
uint32_t idx) {
616 #pragma mark ObjectFile
620 llvm::StringRef name, llvm::StringRef description,
622 ObjectFileCreateMemoryInstance create_memory_callback,
623 ObjectFileGetModuleSpecifications get_module_specifications,
624 ObjectFileSaveCore save_core)
627 create_memory_callback(create_memory_callback),
628 get_module_specifications(get_module_specifications),
629 save_core(save_core) {}
642 bool PluginManager::RegisterPlugin(
643 llvm::StringRef name, llvm::StringRef description,
645 ObjectFileCreateMemoryInstance create_memory_callback,
646 ObjectFileGetModuleSpecifications get_module_specifications,
647 ObjectFileSaveCore save_core) {
649 name, description, create_callback, create_memory_callback,
650 get_module_specifications, save_core);
658 PluginManager::GetObjectFileCreateCallbackAtIndex(
uint32_t idx) {
662 ObjectFileCreateMemoryInstance
663 PluginManager::GetObjectFileCreateMemoryCallbackAtIndex(
uint32_t idx) {
665 if (idx < instances.size())
666 return instances[idx].create_memory_callback;
670 ObjectFileGetModuleSpecifications
671 PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(
674 if (idx < instances.size())
675 return instances[idx].get_module_specifications;
679 ObjectFileCreateMemoryInstance
680 PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
681 llvm::StringRef name) {
683 for (
auto &instance : instances) {
684 if (instance.name == name)
685 return instance.create_memory_callback;
690 Status PluginManager::SaveCore(
const lldb::ProcessSP &process_sp,
693 llvm::StringRef plugin_name) {
694 if (plugin_name.empty()) {
696 llvm::Expected<bool> ret = process_sp->SaveCore(outfile.
GetPath());
698 return Status(ret.takeError());
706 for (
auto &instance : instances) {
707 if (plugin_name.empty() || instance.name == plugin_name) {
708 if (instance.save_core &&
709 instance.save_core(process_sp, outfile, core_style,
error))
713 error.SetErrorString(
714 "no ObjectFile plugins were able to save a core for this process");
718 #pragma mark ObjectContainer
723 llvm::StringRef name, llvm::StringRef description,
725 ObjectFileGetModuleSpecifications get_module_specifications)
728 get_module_specifications(get_module_specifications) {}
739 bool PluginManager::RegisterPlugin(
740 llvm::StringRef name, llvm::StringRef description,
742 ObjectFileGetModuleSpecifications get_module_specifications) {
744 name, description, create_callback, get_module_specifications);
747 bool PluginManager::UnregisterPlugin(
753 PluginManager::GetObjectContainerCreateCallbackAtIndex(
uint32_t idx) {
757 ObjectFileGetModuleSpecifications
758 PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex(
761 if (idx < instances.size())
762 return instances[idx].get_module_specifications;
766 #pragma mark Platform
773 return g_platform_instances;
776 bool PluginManager::RegisterPlugin(
777 llvm::StringRef name, llvm::StringRef description,
778 PlatformCreateInstance create_callback,
781 name, description, create_callback, debugger_init_callback);
784 bool PluginManager::UnregisterPlugin(PlatformCreateInstance create_callback) {
788 llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(
uint32_t idx) {
793 PluginManager::GetPlatformPluginDescriptionAtIndex(
uint32_t idx) {
797 PlatformCreateInstance
798 PluginManager::GetPlatformCreateCallbackAtIndex(
uint32_t idx) {
802 PlatformCreateInstance
803 PluginManager::GetPlatformCreateCallbackForPluginName(llvm::StringRef name) {
807 void PluginManager::AutoCompletePlatformName(llvm::StringRef name,
810 if (instance.name.startswith(name))
825 bool PluginManager::RegisterPlugin(
826 llvm::StringRef name, llvm::StringRef description,
827 ProcessCreateInstance create_callback,
830 name, description, create_callback, debugger_init_callback);
833 bool PluginManager::UnregisterPlugin(ProcessCreateInstance create_callback) {
837 llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(
uint32_t idx) {
841 llvm::StringRef PluginManager::GetProcessPluginDescriptionAtIndex(
uint32_t idx) {
845 ProcessCreateInstance
846 PluginManager::GetProcessCreateCallbackAtIndex(
uint32_t idx) {
850 ProcessCreateInstance
851 PluginManager::GetProcessCreateCallbackForPluginName(llvm::StringRef name) {
855 void PluginManager::AutoCompleteProcessName(llvm::StringRef name,
858 if (instance.name.startswith(name))
863 #pragma mark ScriptInterpreter
872 language(language) {}
884 bool PluginManager::RegisterPlugin(
885 llvm::StringRef name, llvm::StringRef description,
889 name, description, create_callback, script_language);
892 bool PluginManager::UnregisterPlugin(
898 PluginManager::GetScriptInterpreterCreateCallbackAtIndex(
uint32_t idx) {
902 lldb::ScriptInterpreterSP
907 for (
const auto &instance : instances) {
909 none_instance = instance.create_callback;
911 if (script_lang == instance.language)
912 return instance.create_callback(debugger);
916 assert(none_instance !=
nullptr);
917 return none_instance(debugger);
920 #pragma mark StructuredDataPlugin
925 llvm::StringRef name, llvm::StringRef description,
928 StructuredDataFilterLaunchInfo filter_callback)
930 name, description, create_callback, debugger_init_callback),
931 filter_callback(filter_callback) {}
933 StructuredDataFilterLaunchInfo filter_callback =
nullptr;
944 bool PluginManager::RegisterPlugin(
945 llvm::StringRef name, llvm::StringRef description,
948 StructuredDataFilterLaunchInfo filter_callback) {
950 name, description, create_callback, debugger_init_callback,
954 bool PluginManager::UnregisterPlugin(
960 PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(
uint32_t idx) {
964 StructuredDataFilterLaunchInfo
965 PluginManager::GetStructuredDataFilterCallbackAtIndex(
966 uint32_t idx,
bool &iteration_complete) {
968 if (idx < instances.size()) {
969 iteration_complete =
false;
970 return instances[idx].filter_callback;
972 iteration_complete =
true;
977 #pragma mark SymbolFile
987 bool PluginManager::RegisterPlugin(
988 llvm::StringRef name, llvm::StringRef description,
989 SymbolFileCreateInstance create_callback,
992 name, description, create_callback, debugger_init_callback);
995 bool PluginManager::UnregisterPlugin(SymbolFileCreateInstance create_callback) {
999 SymbolFileCreateInstance
1000 PluginManager::GetSymbolFileCreateCallbackAtIndex(
uint32_t idx) {
1004 #pragma mark SymbolVendor
1014 bool PluginManager::RegisterPlugin(llvm::StringRef name,
1015 llvm::StringRef description,
1016 SymbolVendorCreateInstance create_callback) {
1021 bool PluginManager::UnregisterPlugin(
1022 SymbolVendorCreateInstance create_callback) {
1026 SymbolVendorCreateInstance
1027 PluginManager::GetSymbolVendorCreateCallbackAtIndex(
uint32_t idx) {
1036 llvm::StringRef name, llvm::StringRef description,
1038 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1039 llvm::StringRef schema)
1041 name, description, create_callback_for_session_file),
1043 create_callback_for_live_process(create_callback_for_live_process) {}
1056 bool PluginManager::RegisterPlugin(
1057 llvm::StringRef name, llvm::StringRef description,
1059 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1060 llvm::StringRef schema) {
1062 name, description, create_callback_for_session_file,
1063 create_callback_for_live_process, schema);
1066 bool PluginManager::UnregisterPlugin(
1069 create_callback_for_session_file);
1073 PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1077 TraceCreateInstanceForLiveProcess
1078 PluginManager::GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name) {
1080 if (instance.name == plugin_name)
1081 return instance.create_callback_for_live_process;
1085 llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1087 if (instance.name == plugin_name)
1088 return instance.schema;
1089 return llvm::StringRef();
1092 llvm::StringRef PluginManager::GetTraceSchema(
size_t index) {
1095 return instance->schema;
1096 return llvm::StringRef();
1099 #pragma mark TraceExporter
1104 llvm::StringRef name, llvm::StringRef description,
1106 ThreadTraceExportCommandCreator create_thread_trace_export_command)
1109 create_thread_trace_export_command(create_thread_trace_export_command) {
1122 bool PluginManager::RegisterPlugin(
1123 llvm::StringRef name, llvm::StringRef description,
1125 ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1127 name, description, create_callback, create_thread_trace_export_command);
1131 PluginManager::GetTraceExporterCreateCallback(llvm::StringRef plugin_name) {
1135 bool PluginManager::UnregisterPlugin(
1140 ThreadTraceExportCommandCreator
1141 PluginManager::GetThreadTraceExportCommandCreatorAtIndex(
uint32_t index) {
1144 return instance->create_thread_trace_export_command;
1149 PluginManager::GetTraceExporterPluginNameAtIndex(
uint32_t index) {
1153 #pragma mark UnwindAssembly
1163 bool PluginManager::RegisterPlugin(
1164 llvm::StringRef name, llvm::StringRef description,
1165 UnwindAssemblyCreateInstance create_callback) {
1170 bool PluginManager::UnregisterPlugin(
1171 UnwindAssemblyCreateInstance create_callback) {
1175 UnwindAssemblyCreateInstance
1176 PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(
uint32_t idx) {
1180 #pragma mark MemoryHistory
1190 bool PluginManager::RegisterPlugin(
1191 llvm::StringRef name, llvm::StringRef description,
1192 MemoryHistoryCreateInstance create_callback) {
1197 bool PluginManager::UnregisterPlugin(
1198 MemoryHistoryCreateInstance create_callback) {
1202 MemoryHistoryCreateInstance
1203 PluginManager::GetMemoryHistoryCreateCallbackAtIndex(
uint32_t idx) {
1207 #pragma mark InstrumentationRuntime
1212 llvm::StringRef name, llvm::StringRef description,
1214 InstrumentationRuntimeGetType get_type_callback)
1217 get_type_callback(get_type_callback) {}
1219 InstrumentationRuntimeGetType get_type_callback =
nullptr;
1230 bool PluginManager::RegisterPlugin(
1231 llvm::StringRef name, llvm::StringRef description,
1233 InstrumentationRuntimeGetType get_type_callback) {
1235 name, description, create_callback, get_type_callback);
1238 bool PluginManager::UnregisterPlugin(
1243 InstrumentationRuntimeGetType
1244 PluginManager::GetInstrumentationRuntimeGetTypeCallbackAtIndex(
uint32_t idx) {
1246 if (idx < instances.size())
1247 return instances[idx].get_type_callback;
1252 PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(
uint32_t idx) {
1256 #pragma mark TypeSystem
1265 supported_languages_for_types(supported_languages_for_types),
1266 supported_languages_for_expressions(
1267 supported_languages_for_expressions) {}
1280 bool PluginManager::RegisterPlugin(
1281 llvm::StringRef name, llvm::StringRef description,
1284 LanguageSet supported_languages_for_expressions) {
1286 name, description, create_callback, supported_languages_for_types,
1287 supported_languages_for_expressions);
1295 PluginManager::GetTypeSystemCreateCallbackAtIndex(
uint32_t idx) {
1299 LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForTypes() {
1302 for (
unsigned i = 0; i < instances.size(); ++i)
1303 all.
bitvector |= instances[i].supported_languages_for_types.bitvector;
1307 LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForExpressions() {
1310 for (
unsigned i = 0; i < instances.size(); ++i)
1311 all.
bitvector |= instances[i].supported_languages_for_expressions.bitvector;
1321 supported_languages(supported_languages) {}
1333 bool PluginManager::RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
1337 supported_languages);
1350 return idx < instances.size() ? instances[idx].supported_languages
1357 for (
unsigned i = 0; i < instances.size(); ++i)
1358 all.
bitvector |= instances[i].supported_languages.bitvector;
1362 #pragma mark PluginManager
1364 void PluginManager::DebuggerInitialize(
Debugger &debugger) {
1378 static lldb::OptionValuePropertiesSP
1381 lldb::OptionValuePropertiesSP parent_properties_sp(
1383 if (parent_properties_sp) {
1386 OptionValuePropertiesSP plugin_properties_sp =
1387 parent_properties_sp->GetSubProperty(
nullptr, g_property_name);
1388 if (!plugin_properties_sp && can_create) {
1389 plugin_properties_sp =
1390 std::make_shared<OptionValueProperties>(g_property_name);
1391 parent_properties_sp->AppendProperty(
1392 g_property_name,
ConstString(
"Settings specify to plugins."),
true,
1393 plugin_properties_sp);
1396 if (plugin_properties_sp) {
1397 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
1398 plugin_properties_sp->GetSubProperty(
nullptr, plugin_type_name);
1399 if (!plugin_type_properties_sp && can_create) {
1400 plugin_type_properties_sp =
1401 std::make_shared<OptionValueProperties>(plugin_type_name);
1402 plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
1403 true, plugin_type_properties_sp);
1405 return plugin_type_properties_sp;
1408 return lldb::OptionValuePropertiesSP();
1418 lldb::OptionValuePropertiesSP parent_properties_sp(
1420 if (parent_properties_sp) {
1421 OptionValuePropertiesSP plugin_properties_sp =
1422 parent_properties_sp->GetSubProperty(
nullptr, plugin_type_name);
1423 if (!plugin_properties_sp && can_create) {
1424 plugin_properties_sp =
1425 std::make_shared<OptionValueProperties>(plugin_type_name);
1426 parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
1427 true, plugin_properties_sp);
1430 if (plugin_properties_sp) {
1431 lldb::OptionValuePropertiesSP plugin_type_properties_sp =
1432 plugin_properties_sp->GetSubProperty(
nullptr, g_property_name);
1433 if (!plugin_type_properties_sp && can_create) {
1434 plugin_type_properties_sp =
1435 std::make_shared<OptionValueProperties>(g_property_name);
1436 plugin_properties_sp->AppendProperty(
1437 g_property_name,
ConstString(
"Settings specific to plugins"),
true,
1438 plugin_type_properties_sp);
1440 return plugin_type_properties_sp;
1443 return lldb::OptionValuePropertiesSP();
1448 typedef lldb::OptionValuePropertiesSP
1453 static lldb::OptionValuePropertiesSP
1456 GetDebuggerPropertyForPluginsPtr get_debugger_property =
1458 lldb::OptionValuePropertiesSP properties_sp;
1459 lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
1460 debugger, plugin_type_name,
1463 if (plugin_type_properties_sp)
1465 plugin_type_properties_sp->GetSubProperty(
nullptr, setting_name);
1466 return properties_sp;
1472 const lldb::OptionValuePropertiesSP &properties_sp,
1474 GetDebuggerPropertyForPluginsPtr get_debugger_property =
1476 if (properties_sp) {
1477 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1478 get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
1480 if (plugin_type_properties_sp) {
1481 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
1482 description, is_global_property,
1497 lldb::OptionValuePropertiesSP
1498 PluginManager::GetSettingForDynamicLoaderPlugin(
Debugger &debugger,
1504 bool PluginManager::CreateSettingForDynamicLoaderPlugin(
1505 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1506 ConstString description,
bool is_global_property) {
1509 ConstString(
"Settings for dynamic loader plug-ins"), properties_sp,
1510 description, is_global_property);
1513 lldb::OptionValuePropertiesSP
1514 PluginManager::GetSettingForPlatformPlugin(
Debugger &debugger,
1521 bool PluginManager::CreateSettingForPlatformPlugin(
1522 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1523 ConstString description,
bool is_global_property) {
1526 properties_sp, description, is_global_property,
1530 lldb::OptionValuePropertiesSP
1531 PluginManager::GetSettingForProcessPlugin(
Debugger &debugger,
1537 bool PluginManager::CreateSettingForProcessPlugin(
1538 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1539 ConstString description,
bool is_global_property) {
1542 properties_sp, description, is_global_property);
1545 lldb::OptionValuePropertiesSP
1546 PluginManager::GetSettingForSymbolFilePlugin(
Debugger &debugger,
1552 bool PluginManager::CreateSettingForSymbolFilePlugin(
1553 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1554 ConstString description,
bool is_global_property) {
1557 ConstString(
"Settings for symbol file plug-ins"), properties_sp,
1558 description, is_global_property);
1561 lldb::OptionValuePropertiesSP
1562 PluginManager::GetSettingForJITLoaderPlugin(
Debugger &debugger,
1568 bool PluginManager::CreateSettingForJITLoaderPlugin(
1569 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1570 ConstString description,
bool is_global_property) {
1573 properties_sp, description, is_global_property);
1578 lldb::OptionValuePropertiesSP
1579 PluginManager::GetSettingForOperatingSystemPlugin(
Debugger &debugger,
1581 lldb::OptionValuePropertiesSP properties_sp;
1582 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1587 if (plugin_type_properties_sp)
1589 plugin_type_properties_sp->GetSubProperty(
nullptr, setting_name);
1590 return properties_sp;
1593 bool PluginManager::CreateSettingForOperatingSystemPlugin(
1594 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1595 ConstString description,
bool is_global_property) {
1596 if (properties_sp) {
1597 lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1600 ConstString(
"Settings for operating system plug-ins"),
true));
1601 if (plugin_type_properties_sp) {
1602 plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
1603 description, is_global_property,
1611 lldb::OptionValuePropertiesSP
1612 PluginManager::GetSettingForStructuredDataPlugin(
Debugger &debugger,
1618 bool PluginManager::CreateSettingForStructuredDataPlugin(
1619 Debugger &debugger,
const lldb::OptionValuePropertiesSP &properties_sp,
1620 ConstString description,
bool is_global_property) {
1623 ConstString(
"Settings for structured data plug-ins"), properties_sp,
1624 description, is_global_property);