1 //===-- PluginManager.cpp ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/lldb-python.h"
12 #include "lldb/Core/PluginManager.h"
19 #include "lldb/Core/Debugger.h"
20 #include "lldb/Core/Error.h"
21 #include "lldb/Host/FileSpec.h"
22 #include "lldb/Host/Host.h"
23 #include "lldb/Host/Mutex.h"
24 #include "lldb/Interpreter/OptionValueProperties.h"
26 #include "llvm/ADT/StringRef.h"
29 using namespace lldb_private;
33 ePluginRegisterInstance,
34 ePluginUnregisterInstance,
35 ePluginGetInstanceAtIndex
39 typedef bool (*PluginInitCallback) (void);
40 typedef void (*PluginTermCallback) (void);
45 PluginInitCallback plugin_init_callback;
46 PluginTermCallback plugin_term_callback;
49 typedef std::map<FileSpec, PluginInfo> PluginTerminateMap;
54 static Mutex g_plugin_map_mutex (Mutex::eMutexTypeRecursive);
55 return g_plugin_map_mutex;
58 static PluginTerminateMap &
61 static PluginTerminateMap g_plugin_map;
66 PluginIsLoaded (const FileSpec &plugin_file_spec)
68 Mutex::Locker locker (GetPluginMapMutex ());
69 PluginTerminateMap &plugin_map = GetPluginMap ();
70 return plugin_map.find (plugin_file_spec) != plugin_map.end();
74 SetPluginInfo (const FileSpec &plugin_file_spec, const PluginInfo &plugin_info)
76 Mutex::Locker locker (GetPluginMapMutex ());
77 PluginTerminateMap &plugin_map = GetPluginMap ();
78 assert (plugin_map.find (plugin_file_spec) == plugin_map.end());
79 plugin_map[plugin_file_spec] = plugin_info;
83 static FileSpec::EnumerateDirectoryResult
87 FileSpec::FileType file_type,
88 const FileSpec &file_spec
91 // PluginManager *plugin_manager = (PluginManager *)baton;
94 // If we have a regular file, a symbolic link or unknown file type, try
95 // and process the file. We must handle unknown as sometimes the directory
96 // enumeration might be enumerating a file system that doesn't have correct
97 // file type information.
98 if (file_type == FileSpec::eFileTypeRegular ||
99 file_type == FileSpec::eFileTypeSymbolicLink ||
100 file_type == FileSpec::eFileTypeUnknown )
102 FileSpec plugin_file_spec (file_spec);
103 plugin_file_spec.ResolvePath();
105 if (PluginIsLoaded (plugin_file_spec))
106 return FileSpec::eEnumerateDirectoryResultNext;
109 PluginInfo plugin_info = { NULL, NULL, NULL };
110 uint32_t flags = Host::eDynamicLibraryOpenOptionLazy |
111 Host::eDynamicLibraryOpenOptionLocal |
112 Host::eDynamicLibraryOpenOptionLimitGetSymbol;
114 plugin_info.plugin_handle = Host::DynamicLibraryOpen (plugin_file_spec, flags, error);
115 if (plugin_info.plugin_handle)
117 bool success = false;
118 plugin_info.plugin_init_callback = (PluginInitCallback)Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginInitialize", error);
119 if (plugin_info.plugin_init_callback)
121 // Call the plug-in "bool LLDBPluginInitialize(void)" function
122 success = plugin_info.plugin_init_callback();
127 // It is ok for the "LLDBPluginTerminate" symbol to be NULL
128 plugin_info.plugin_term_callback = (PluginTermCallback)Host::DynamicLibraryGetSymbol (plugin_info.plugin_handle, "LLDBPluginTerminate", error);
132 // The initialize function returned FALSE which means the
133 // plug-in might not be compatible, or might be too new or
134 // too old, or might not want to run on this machine.
135 Host::DynamicLibraryClose (plugin_info.plugin_handle);
136 plugin_info.plugin_handle = NULL;
137 plugin_info.plugin_init_callback = NULL;
140 // Regardless of success or failure, cache the plug-in load
141 // in our plug-in info so we don't try to load it again and
143 SetPluginInfo (plugin_file_spec, plugin_info);
145 return FileSpec::eEnumerateDirectoryResultNext;
150 if (file_type == FileSpec::eFileTypeUnknown ||
151 file_type == FileSpec::eFileTypeDirectory ||
152 file_type == FileSpec::eFileTypeSymbolicLink )
154 // Try and recurse into anything that a directory or symbolic link.
155 // We must also do this for unknown as sometimes the directory enumeration
156 // might be enurating a file system that doesn't have correct file type
158 return FileSpec::eEnumerateDirectoryResultEnter;
161 return FileSpec::eEnumerateDirectoryResultNext;
166 PluginManager::Initialize ()
170 const bool find_directories = true;
171 const bool find_files = true;
172 const bool find_other = true;
173 char dir_path[PATH_MAX];
174 if (Host::GetLLDBPath (ePathTypeLLDBSystemPlugins, dir_spec))
176 if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path)))
178 FileSpec::EnumerateDirectory (dir_path,
187 if (Host::GetLLDBPath (ePathTypeLLDBUserPlugins, dir_spec))
189 if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path)))
191 FileSpec::EnumerateDirectory (dir_path,
203 PluginManager::Terminate ()
205 Mutex::Locker locker (GetPluginMapMutex ());
206 PluginTerminateMap &plugin_map = GetPluginMap ();
208 PluginTerminateMap::const_iterator pos, end = plugin_map.end();
209 for (pos = plugin_map.begin(); pos != end; ++pos)
211 // Call the plug-in "void LLDBPluginTerminate (void)" function if there
212 // is one (if the symbol was not NULL).
213 if (pos->second.plugin_handle)
215 if (pos->second.plugin_term_callback)
216 pos->second.plugin_term_callback();
217 Host::DynamicLibraryClose (pos->second.plugin_handle);
232 create_callback(NULL)
237 std::string description;
238 ABICreateInstance create_callback;
241 typedef std::vector<ABIInstance> ABIInstances;
244 GetABIInstancesMutex ()
246 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
247 return g_instances_mutex;
250 static ABIInstances &
253 static ABIInstances g_instances;
258 PluginManager::RegisterPlugin
260 const ConstString &name,
261 const char *description,
262 ABICreateInstance create_callback
267 ABIInstance instance;
269 instance.name = name;
270 if (description && description[0])
271 instance.description = description;
272 instance.create_callback = create_callback;
273 Mutex::Locker locker (GetABIInstancesMutex ());
274 GetABIInstances ().push_back (instance);
281 PluginManager::UnregisterPlugin (ABICreateInstance create_callback)
285 Mutex::Locker locker (GetABIInstancesMutex ());
286 ABIInstances &instances = GetABIInstances ();
288 ABIInstances::iterator pos, end = instances.end();
289 for (pos = instances.begin(); pos != end; ++ pos)
291 if (pos->create_callback == create_callback)
293 instances.erase(pos);
302 PluginManager::GetABICreateCallbackAtIndex (uint32_t idx)
304 Mutex::Locker locker (GetABIInstancesMutex ());
305 ABIInstances &instances = GetABIInstances ();
306 if (idx < instances.size())
307 return instances[idx].create_callback;
312 PluginManager::GetABICreateCallbackForPluginName (const ConstString &name)
316 Mutex::Locker locker (GetABIInstancesMutex ());
317 ABIInstances &instances = GetABIInstances ();
319 ABIInstances::iterator pos, end = instances.end();
320 for (pos = instances.begin(); pos != end; ++ pos)
322 if (name == pos->name)
323 return pos->create_callback;
330 #pragma mark Disassembler
333 struct DisassemblerInstance
335 DisassemblerInstance() :
338 create_callback(NULL)
343 std::string description;
344 DisassemblerCreateInstance create_callback;
347 typedef std::vector<DisassemblerInstance> DisassemblerInstances;
350 GetDisassemblerMutex ()
352 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
353 return g_instances_mutex;
356 static DisassemblerInstances &
357 GetDisassemblerInstances ()
359 static DisassemblerInstances g_instances;
364 PluginManager::RegisterPlugin
366 const ConstString &name,
367 const char *description,
368 DisassemblerCreateInstance create_callback
373 DisassemblerInstance instance;
375 instance.name = name;
376 if (description && description[0])
377 instance.description = description;
378 instance.create_callback = create_callback;
379 Mutex::Locker locker (GetDisassemblerMutex ());
380 GetDisassemblerInstances ().push_back (instance);
387 PluginManager::UnregisterPlugin (DisassemblerCreateInstance create_callback)
391 Mutex::Locker locker (GetDisassemblerMutex ());
392 DisassemblerInstances &instances = GetDisassemblerInstances ();
394 DisassemblerInstances::iterator pos, end = instances.end();
395 for (pos = instances.begin(); pos != end; ++ pos)
397 if (pos->create_callback == create_callback)
399 instances.erase(pos);
407 DisassemblerCreateInstance
408 PluginManager::GetDisassemblerCreateCallbackAtIndex (uint32_t idx)
410 Mutex::Locker locker (GetDisassemblerMutex ());
411 DisassemblerInstances &instances = GetDisassemblerInstances ();
412 if (idx < instances.size())
413 return instances[idx].create_callback;
417 DisassemblerCreateInstance
418 PluginManager::GetDisassemblerCreateCallbackForPluginName (const ConstString &name)
422 Mutex::Locker locker (GetDisassemblerMutex ());
423 DisassemblerInstances &instances = GetDisassemblerInstances ();
425 DisassemblerInstances::iterator pos, end = instances.end();
426 for (pos = instances.begin(); pos != end; ++ pos)
428 if (name == pos->name)
429 return pos->create_callback;
437 #pragma mark DynamicLoader
440 struct DynamicLoaderInstance
442 DynamicLoaderInstance() :
445 create_callback(NULL),
446 debugger_init_callback (NULL)
451 std::string description;
452 DynamicLoaderCreateInstance create_callback;
453 DebuggerInitializeCallback debugger_init_callback;
456 typedef std::vector<DynamicLoaderInstance> DynamicLoaderInstances;
460 GetDynamicLoaderMutex ()
462 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
463 return g_instances_mutex;
466 static DynamicLoaderInstances &
467 GetDynamicLoaderInstances ()
469 static DynamicLoaderInstances g_instances;
475 PluginManager::RegisterPlugin
477 const ConstString &name,
478 const char *description,
479 DynamicLoaderCreateInstance create_callback,
480 DebuggerInitializeCallback debugger_init_callback
485 DynamicLoaderInstance instance;
487 instance.name = name;
488 if (description && description[0])
489 instance.description = description;
490 instance.create_callback = create_callback;
491 instance.debugger_init_callback = debugger_init_callback;
492 Mutex::Locker locker (GetDynamicLoaderMutex ());
493 GetDynamicLoaderInstances ().push_back (instance);
499 PluginManager::UnregisterPlugin (DynamicLoaderCreateInstance create_callback)
503 Mutex::Locker locker (GetDynamicLoaderMutex ());
504 DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
506 DynamicLoaderInstances::iterator pos, end = instances.end();
507 for (pos = instances.begin(); pos != end; ++ pos)
509 if (pos->create_callback == create_callback)
511 instances.erase(pos);
519 DynamicLoaderCreateInstance
520 PluginManager::GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx)
522 Mutex::Locker locker (GetDynamicLoaderMutex ());
523 DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
524 if (idx < instances.size())
525 return instances[idx].create_callback;
529 DynamicLoaderCreateInstance
530 PluginManager::GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name)
534 Mutex::Locker locker (GetDynamicLoaderMutex ());
535 DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
537 DynamicLoaderInstances::iterator pos, end = instances.end();
538 for (pos = instances.begin(); pos != end; ++ pos)
540 if (name == pos->name)
541 return pos->create_callback;
547 #pragma mark EmulateInstruction
550 struct EmulateInstructionInstance
552 EmulateInstructionInstance() :
555 create_callback(NULL)
560 std::string description;
561 EmulateInstructionCreateInstance create_callback;
564 typedef std::vector<EmulateInstructionInstance> EmulateInstructionInstances;
567 GetEmulateInstructionMutex ()
569 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
570 return g_instances_mutex;
573 static EmulateInstructionInstances &
574 GetEmulateInstructionInstances ()
576 static EmulateInstructionInstances g_instances;
582 PluginManager::RegisterPlugin
584 const ConstString &name,
585 const char *description,
586 EmulateInstructionCreateInstance create_callback
591 EmulateInstructionInstance instance;
593 instance.name = name;
594 if (description && description[0])
595 instance.description = description;
596 instance.create_callback = create_callback;
597 Mutex::Locker locker (GetEmulateInstructionMutex ());
598 GetEmulateInstructionInstances ().push_back (instance);
604 PluginManager::UnregisterPlugin (EmulateInstructionCreateInstance create_callback)
608 Mutex::Locker locker (GetEmulateInstructionMutex ());
609 EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
611 EmulateInstructionInstances::iterator pos, end = instances.end();
612 for (pos = instances.begin(); pos != end; ++ pos)
614 if (pos->create_callback == create_callback)
616 instances.erase(pos);
624 EmulateInstructionCreateInstance
625 PluginManager::GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx)
627 Mutex::Locker locker (GetEmulateInstructionMutex ());
628 EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
629 if (idx < instances.size())
630 return instances[idx].create_callback;
634 EmulateInstructionCreateInstance
635 PluginManager::GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name)
639 Mutex::Locker locker (GetEmulateInstructionMutex ());
640 EmulateInstructionInstances &instances = GetEmulateInstructionInstances ();
642 EmulateInstructionInstances::iterator pos, end = instances.end();
643 for (pos = instances.begin(); pos != end; ++ pos)
645 if (name == pos->name)
646 return pos->create_callback;
651 #pragma mark OperatingSystem
654 struct OperatingSystemInstance
656 OperatingSystemInstance() :
659 create_callback(NULL)
664 std::string description;
665 OperatingSystemCreateInstance create_callback;
668 typedef std::vector<OperatingSystemInstance> OperatingSystemInstances;
671 GetOperatingSystemMutex ()
673 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
674 return g_instances_mutex;
677 static OperatingSystemInstances &
678 GetOperatingSystemInstances ()
680 static OperatingSystemInstances g_instances;
685 PluginManager::RegisterPlugin (const ConstString &name,
686 const char *description,
687 OperatingSystemCreateInstance create_callback)
691 OperatingSystemInstance instance;
693 instance.name = name;
694 if (description && description[0])
695 instance.description = description;
696 instance.create_callback = create_callback;
697 Mutex::Locker locker (GetOperatingSystemMutex ());
698 GetOperatingSystemInstances ().push_back (instance);
704 PluginManager::UnregisterPlugin (OperatingSystemCreateInstance create_callback)
708 Mutex::Locker locker (GetOperatingSystemMutex ());
709 OperatingSystemInstances &instances = GetOperatingSystemInstances ();
711 OperatingSystemInstances::iterator pos, end = instances.end();
712 for (pos = instances.begin(); pos != end; ++ pos)
714 if (pos->create_callback == create_callback)
716 instances.erase(pos);
724 OperatingSystemCreateInstance
725 PluginManager::GetOperatingSystemCreateCallbackAtIndex (uint32_t idx)
727 Mutex::Locker locker (GetOperatingSystemMutex ());
728 OperatingSystemInstances &instances = GetOperatingSystemInstances ();
729 if (idx < instances.size())
730 return instances[idx].create_callback;
734 OperatingSystemCreateInstance
735 PluginManager::GetOperatingSystemCreateCallbackForPluginName (const ConstString &name)
739 Mutex::Locker locker (GetOperatingSystemMutex ());
740 OperatingSystemInstances &instances = GetOperatingSystemInstances ();
742 OperatingSystemInstances::iterator pos, end = instances.end();
743 for (pos = instances.begin(); pos != end; ++ pos)
745 if (name == pos->name)
746 return pos->create_callback;
753 #pragma mark LanguageRuntime
756 struct LanguageRuntimeInstance
758 LanguageRuntimeInstance() :
761 create_callback(NULL)
766 std::string description;
767 LanguageRuntimeCreateInstance create_callback;
770 typedef std::vector<LanguageRuntimeInstance> LanguageRuntimeInstances;
773 GetLanguageRuntimeMutex ()
775 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
776 return g_instances_mutex;
779 static LanguageRuntimeInstances &
780 GetLanguageRuntimeInstances ()
782 static LanguageRuntimeInstances g_instances;
787 PluginManager::RegisterPlugin
789 const ConstString &name,
790 const char *description,
791 LanguageRuntimeCreateInstance create_callback
796 LanguageRuntimeInstance instance;
798 instance.name = name;
799 if (description && description[0])
800 instance.description = description;
801 instance.create_callback = create_callback;
802 Mutex::Locker locker (GetLanguageRuntimeMutex ());
803 GetLanguageRuntimeInstances ().push_back (instance);
809 PluginManager::UnregisterPlugin (LanguageRuntimeCreateInstance create_callback)
813 Mutex::Locker locker (GetLanguageRuntimeMutex ());
814 LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
816 LanguageRuntimeInstances::iterator pos, end = instances.end();
817 for (pos = instances.begin(); pos != end; ++ pos)
819 if (pos->create_callback == create_callback)
821 instances.erase(pos);
829 LanguageRuntimeCreateInstance
830 PluginManager::GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx)
832 Mutex::Locker locker (GetLanguageRuntimeMutex ());
833 LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
834 if (idx < instances.size())
835 return instances[idx].create_callback;
839 LanguageRuntimeCreateInstance
840 PluginManager::GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name)
844 Mutex::Locker locker (GetLanguageRuntimeMutex ());
845 LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances ();
847 LanguageRuntimeInstances::iterator pos, end = instances.end();
848 for (pos = instances.begin(); pos != end; ++ pos)
850 if (name == pos->name)
851 return pos->create_callback;
857 #pragma mark SystemRuntime
860 struct SystemRuntimeInstance
862 SystemRuntimeInstance() :
865 create_callback(NULL)
870 std::string description;
871 SystemRuntimeCreateInstance create_callback;
874 typedef std::vector<SystemRuntimeInstance> SystemRuntimeInstances;
877 GetSystemRuntimeMutex ()
879 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
880 return g_instances_mutex;
883 static SystemRuntimeInstances &
884 GetSystemRuntimeInstances ()
886 static SystemRuntimeInstances g_instances;
891 PluginManager::RegisterPlugin
893 const ConstString &name,
894 const char *description,
895 SystemRuntimeCreateInstance create_callback
900 SystemRuntimeInstance instance;
902 instance.name = name;
903 if (description && description[0])
904 instance.description = description;
905 instance.create_callback = create_callback;
906 Mutex::Locker locker (GetSystemRuntimeMutex ());
907 GetSystemRuntimeInstances ().push_back (instance);
913 PluginManager::UnregisterPlugin (SystemRuntimeCreateInstance create_callback)
917 Mutex::Locker locker (GetSystemRuntimeMutex ());
918 SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
920 SystemRuntimeInstances::iterator pos, end = instances.end();
921 for (pos = instances.begin(); pos != end; ++ pos)
923 if (pos->create_callback == create_callback)
925 instances.erase(pos);
933 SystemRuntimeCreateInstance
934 PluginManager::GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx)
936 Mutex::Locker locker (GetSystemRuntimeMutex ());
937 SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
938 if (idx < instances.size())
939 return instances[idx].create_callback;
943 SystemRuntimeCreateInstance
944 PluginManager::GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name)
948 Mutex::Locker locker (GetSystemRuntimeMutex ());
949 SystemRuntimeInstances &instances = GetSystemRuntimeInstances ();
951 SystemRuntimeInstances::iterator pos, end = instances.end();
952 for (pos = instances.begin(); pos != end; ++ pos)
954 if (name == pos->name)
955 return pos->create_callback;
962 #pragma mark ObjectFile
964 struct ObjectFileInstance
966 ObjectFileInstance() :
969 create_callback(NULL),
970 create_memory_callback (NULL),
971 get_module_specifications (NULL)
976 std::string description;
977 ObjectFileCreateInstance create_callback;
978 ObjectFileCreateMemoryInstance create_memory_callback;
979 ObjectFileGetModuleSpecifications get_module_specifications;
982 typedef std::vector<ObjectFileInstance> ObjectFileInstances;
985 GetObjectFileMutex ()
987 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
988 return g_instances_mutex;
991 static ObjectFileInstances &
992 GetObjectFileInstances ()
994 static ObjectFileInstances g_instances;
1000 PluginManager::RegisterPlugin (const ConstString &name,
1001 const char *description,
1002 ObjectFileCreateInstance create_callback,
1003 ObjectFileCreateMemoryInstance create_memory_callback,
1004 ObjectFileGetModuleSpecifications get_module_specifications)
1006 if (create_callback)
1008 ObjectFileInstance instance;
1009 assert ((bool)name);
1010 instance.name = name;
1011 if (description && description[0])
1012 instance.description = description;
1013 instance.create_callback = create_callback;
1014 instance.create_memory_callback = create_memory_callback;
1015 instance.get_module_specifications = get_module_specifications;
1016 Mutex::Locker locker (GetObjectFileMutex ());
1017 GetObjectFileInstances ().push_back (instance);
1023 PluginManager::UnregisterPlugin (ObjectFileCreateInstance create_callback)
1025 if (create_callback)
1027 Mutex::Locker locker (GetObjectFileMutex ());
1028 ObjectFileInstances &instances = GetObjectFileInstances ();
1030 ObjectFileInstances::iterator pos, end = instances.end();
1031 for (pos = instances.begin(); pos != end; ++ pos)
1033 if (pos->create_callback == create_callback)
1035 instances.erase(pos);
1043 ObjectFileCreateInstance
1044 PluginManager::GetObjectFileCreateCallbackAtIndex (uint32_t idx)
1046 Mutex::Locker locker (GetObjectFileMutex ());
1047 ObjectFileInstances &instances = GetObjectFileInstances ();
1048 if (idx < instances.size())
1049 return instances[idx].create_callback;
1054 ObjectFileCreateMemoryInstance
1055 PluginManager::GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx)
1057 Mutex::Locker locker (GetObjectFileMutex ());
1058 ObjectFileInstances &instances = GetObjectFileInstances ();
1059 if (idx < instances.size())
1060 return instances[idx].create_memory_callback;
1064 ObjectFileGetModuleSpecifications
1065 PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
1067 Mutex::Locker locker (GetObjectFileMutex ());
1068 ObjectFileInstances &instances = GetObjectFileInstances ();
1069 if (idx < instances.size())
1070 return instances[idx].get_module_specifications;
1074 ObjectFileCreateInstance
1075 PluginManager::GetObjectFileCreateCallbackForPluginName (const ConstString &name)
1079 Mutex::Locker locker (GetObjectFileMutex ());
1080 ObjectFileInstances &instances = GetObjectFileInstances ();
1082 ObjectFileInstances::iterator pos, end = instances.end();
1083 for (pos = instances.begin(); pos != end; ++ pos)
1085 if (name == pos->name)
1086 return pos->create_callback;
1093 ObjectFileCreateMemoryInstance
1094 PluginManager::GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name)
1098 Mutex::Locker locker (GetObjectFileMutex ());
1099 ObjectFileInstances &instances = GetObjectFileInstances ();
1101 ObjectFileInstances::iterator pos, end = instances.end();
1102 for (pos = instances.begin(); pos != end; ++ pos)
1104 if (name == pos->name)
1105 return pos->create_memory_callback;
1113 #pragma mark ObjectContainer
1115 struct ObjectContainerInstance
1117 ObjectContainerInstance() :
1120 create_callback (NULL),
1121 get_module_specifications (NULL)
1126 std::string description;
1127 ObjectContainerCreateInstance create_callback;
1128 ObjectFileGetModuleSpecifications get_module_specifications;
1132 typedef std::vector<ObjectContainerInstance> ObjectContainerInstances;
1135 GetObjectContainerMutex ()
1137 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1138 return g_instances_mutex;
1141 static ObjectContainerInstances &
1142 GetObjectContainerInstances ()
1144 static ObjectContainerInstances g_instances;
1149 PluginManager::RegisterPlugin (const ConstString &name,
1150 const char *description,
1151 ObjectContainerCreateInstance create_callback,
1152 ObjectFileGetModuleSpecifications get_module_specifications)
1154 if (create_callback)
1156 ObjectContainerInstance instance;
1157 assert ((bool)name);
1158 instance.name = name;
1159 if (description && description[0])
1160 instance.description = description;
1161 instance.create_callback = create_callback;
1162 instance.get_module_specifications = get_module_specifications;
1163 Mutex::Locker locker (GetObjectContainerMutex ());
1164 GetObjectContainerInstances ().push_back (instance);
1170 PluginManager::UnregisterPlugin (ObjectContainerCreateInstance create_callback)
1172 if (create_callback)
1174 Mutex::Locker locker (GetObjectContainerMutex ());
1175 ObjectContainerInstances &instances = GetObjectContainerInstances ();
1177 ObjectContainerInstances::iterator pos, end = instances.end();
1178 for (pos = instances.begin(); pos != end; ++ pos)
1180 if (pos->create_callback == create_callback)
1182 instances.erase(pos);
1190 ObjectContainerCreateInstance
1191 PluginManager::GetObjectContainerCreateCallbackAtIndex (uint32_t idx)
1193 Mutex::Locker locker (GetObjectContainerMutex ());
1194 ObjectContainerInstances &instances = GetObjectContainerInstances ();
1195 if (idx < instances.size())
1196 return instances[idx].create_callback;
1200 ObjectContainerCreateInstance
1201 PluginManager::GetObjectContainerCreateCallbackForPluginName (const ConstString &name)
1205 Mutex::Locker locker (GetObjectContainerMutex ());
1206 ObjectContainerInstances &instances = GetObjectContainerInstances ();
1208 ObjectContainerInstances::iterator pos, end = instances.end();
1209 for (pos = instances.begin(); pos != end; ++ pos)
1211 if (name == pos->name)
1212 return pos->create_callback;
1218 ObjectFileGetModuleSpecifications
1219 PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx)
1221 Mutex::Locker locker (GetObjectContainerMutex ());
1222 ObjectContainerInstances &instances = GetObjectContainerInstances ();
1223 if (idx < instances.size())
1224 return instances[idx].get_module_specifications;
1228 #pragma mark LogChannel
1235 create_callback(NULL)
1240 std::string description;
1241 LogChannelCreateInstance create_callback;
1244 typedef std::vector<LogInstance> LogInstances;
1249 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1250 return g_instances_mutex;
1253 static LogInstances &
1256 static LogInstances g_instances;
1263 PluginManager::RegisterPlugin
1265 const ConstString &name,
1266 const char *description,
1267 LogChannelCreateInstance create_callback
1270 if (create_callback)
1272 LogInstance instance;
1273 assert ((bool)name);
1274 instance.name = name;
1275 if (description && description[0])
1276 instance.description = description;
1277 instance.create_callback = create_callback;
1278 Mutex::Locker locker (GetLogMutex ());
1279 GetLogInstances ().push_back (instance);
1285 PluginManager::UnregisterPlugin (LogChannelCreateInstance create_callback)
1287 if (create_callback)
1289 Mutex::Locker locker (GetLogMutex ());
1290 LogInstances &instances = GetLogInstances ();
1292 LogInstances::iterator pos, end = instances.end();
1293 for (pos = instances.begin(); pos != end; ++ pos)
1295 if (pos->create_callback == create_callback)
1297 instances.erase(pos);
1306 PluginManager::GetLogChannelCreateNameAtIndex (uint32_t idx)
1308 Mutex::Locker locker (GetLogMutex ());
1309 LogInstances &instances = GetLogInstances ();
1310 if (idx < instances.size())
1311 return instances[idx].name.GetCString();
1316 LogChannelCreateInstance
1317 PluginManager::GetLogChannelCreateCallbackAtIndex (uint32_t idx)
1319 Mutex::Locker locker (GetLogMutex ());
1320 LogInstances &instances = GetLogInstances ();
1321 if (idx < instances.size())
1322 return instances[idx].create_callback;
1326 LogChannelCreateInstance
1327 PluginManager::GetLogChannelCreateCallbackForPluginName (const ConstString &name)
1331 Mutex::Locker locker (GetLogMutex ());
1332 LogInstances &instances = GetLogInstances ();
1334 LogInstances::iterator pos, end = instances.end();
1335 for (pos = instances.begin(); pos != end; ++ pos)
1337 if (name == pos->name)
1338 return pos->create_callback;
1344 #pragma mark Platform
1346 struct PlatformInstance
1348 PlatformInstance() :
1351 create_callback(NULL),
1352 debugger_init_callback (NULL)
1357 std::string description;
1358 PlatformCreateInstance create_callback;
1359 DebuggerInitializeCallback debugger_init_callback;
1362 typedef std::vector<PlatformInstance> PlatformInstances;
1365 GetPlatformInstancesMutex ()
1367 static Mutex g_platform_instances_mutex (Mutex::eMutexTypeRecursive);
1368 return g_platform_instances_mutex;
1371 static PlatformInstances &
1372 GetPlatformInstances ()
1374 static PlatformInstances g_platform_instances;
1375 return g_platform_instances;
1380 PluginManager::RegisterPlugin (const ConstString &name,
1381 const char *description,
1382 PlatformCreateInstance create_callback,
1383 DebuggerInitializeCallback debugger_init_callback)
1385 if (create_callback)
1387 Mutex::Locker locker (GetPlatformInstancesMutex ());
1389 PlatformInstance instance;
1390 assert ((bool)name);
1391 instance.name = name;
1392 if (description && description[0])
1393 instance.description = description;
1394 instance.create_callback = create_callback;
1395 instance.debugger_init_callback = debugger_init_callback;
1396 GetPlatformInstances ().push_back (instance);
1404 PluginManager::GetPlatformPluginNameAtIndex (uint32_t idx)
1406 Mutex::Locker locker (GetPlatformInstancesMutex ());
1407 PlatformInstances &instances = GetPlatformInstances ();
1408 if (idx < instances.size())
1409 return instances[idx].name.GetCString();
1414 PluginManager::GetPlatformPluginDescriptionAtIndex (uint32_t idx)
1416 Mutex::Locker locker (GetPlatformInstancesMutex ());
1417 PlatformInstances &instances = GetPlatformInstances ();
1418 if (idx < instances.size())
1419 return instances[idx].description.c_str();
1424 PluginManager::UnregisterPlugin (PlatformCreateInstance create_callback)
1426 if (create_callback)
1428 Mutex::Locker locker (GetPlatformInstancesMutex ());
1429 PlatformInstances &instances = GetPlatformInstances ();
1431 PlatformInstances::iterator pos, end = instances.end();
1432 for (pos = instances.begin(); pos != end; ++ pos)
1434 if (pos->create_callback == create_callback)
1436 instances.erase(pos);
1444 PlatformCreateInstance
1445 PluginManager::GetPlatformCreateCallbackAtIndex (uint32_t idx)
1447 Mutex::Locker locker (GetPlatformInstancesMutex ());
1448 PlatformInstances &instances = GetPlatformInstances ();
1449 if (idx < instances.size())
1450 return instances[idx].create_callback;
1454 PlatformCreateInstance
1455 PluginManager::GetPlatformCreateCallbackForPluginName (const ConstString &name)
1459 Mutex::Locker locker (GetPlatformInstancesMutex ());
1460 PlatformInstances &instances = GetPlatformInstances ();
1462 PlatformInstances::iterator pos, end = instances.end();
1463 for (pos = instances.begin(); pos != end; ++ pos)
1465 if (name == pos->name)
1466 return pos->create_callback;
1473 PluginManager::AutoCompletePlatformName (const char *name, StringList &matches)
1477 Mutex::Locker locker (GetPlatformInstancesMutex ());
1478 PlatformInstances &instances = GetPlatformInstances ();
1479 llvm::StringRef name_sref(name);
1481 PlatformInstances::iterator pos, end = instances.end();
1482 for (pos = instances.begin(); pos != end; ++ pos)
1484 llvm::StringRef plugin_name (pos->name.GetCString());
1485 if (plugin_name.startswith(name_sref))
1486 matches.AppendString (plugin_name.data());
1489 return matches.GetSize();
1491 #pragma mark Process
1493 struct ProcessInstance
1498 create_callback(NULL),
1499 debugger_init_callback(NULL)
1504 std::string description;
1505 ProcessCreateInstance create_callback;
1506 DebuggerInitializeCallback debugger_init_callback;
1509 typedef std::vector<ProcessInstance> ProcessInstances;
1514 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1515 return g_instances_mutex;
1518 static ProcessInstances &
1519 GetProcessInstances ()
1521 static ProcessInstances g_instances;
1527 PluginManager::RegisterPlugin (const ConstString &name,
1528 const char *description,
1529 ProcessCreateInstance create_callback,
1530 DebuggerInitializeCallback debugger_init_callback)
1532 if (create_callback)
1534 ProcessInstance instance;
1535 assert ((bool)name);
1536 instance.name = name;
1537 if (description && description[0])
1538 instance.description = description;
1539 instance.create_callback = create_callback;
1540 instance.debugger_init_callback = debugger_init_callback;
1541 Mutex::Locker locker (GetProcessMutex ());
1542 GetProcessInstances ().push_back (instance);
1548 PluginManager::GetProcessPluginNameAtIndex (uint32_t idx)
1550 Mutex::Locker locker (GetProcessMutex ());
1551 ProcessInstances &instances = GetProcessInstances ();
1552 if (idx < instances.size())
1553 return instances[idx].name.GetCString();
1558 PluginManager::GetProcessPluginDescriptionAtIndex (uint32_t idx)
1560 Mutex::Locker locker (GetProcessMutex ());
1561 ProcessInstances &instances = GetProcessInstances ();
1562 if (idx < instances.size())
1563 return instances[idx].description.c_str();
1568 PluginManager::UnregisterPlugin (ProcessCreateInstance create_callback)
1570 if (create_callback)
1572 Mutex::Locker locker (GetProcessMutex ());
1573 ProcessInstances &instances = GetProcessInstances ();
1575 ProcessInstances::iterator pos, end = instances.end();
1576 for (pos = instances.begin(); pos != end; ++ pos)
1578 if (pos->create_callback == create_callback)
1580 instances.erase(pos);
1588 ProcessCreateInstance
1589 PluginManager::GetProcessCreateCallbackAtIndex (uint32_t idx)
1591 Mutex::Locker locker (GetProcessMutex ());
1592 ProcessInstances &instances = GetProcessInstances ();
1593 if (idx < instances.size())
1594 return instances[idx].create_callback;
1599 ProcessCreateInstance
1600 PluginManager::GetProcessCreateCallbackForPluginName (const ConstString &name)
1604 Mutex::Locker locker (GetProcessMutex ());
1605 ProcessInstances &instances = GetProcessInstances ();
1607 ProcessInstances::iterator pos, end = instances.end();
1608 for (pos = instances.begin(); pos != end; ++ pos)
1610 if (name == pos->name)
1611 return pos->create_callback;
1617 #pragma mark SymbolFile
1619 struct SymbolFileInstance
1621 SymbolFileInstance() :
1624 create_callback(NULL)
1629 std::string description;
1630 SymbolFileCreateInstance create_callback;
1633 typedef std::vector<SymbolFileInstance> SymbolFileInstances;
1636 GetSymbolFileMutex ()
1638 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1639 return g_instances_mutex;
1642 static SymbolFileInstances &
1643 GetSymbolFileInstances ()
1645 static SymbolFileInstances g_instances;
1651 PluginManager::RegisterPlugin
1653 const ConstString &name,
1654 const char *description,
1655 SymbolFileCreateInstance create_callback
1658 if (create_callback)
1660 SymbolFileInstance instance;
1661 assert ((bool)name);
1662 instance.name = name;
1663 if (description && description[0])
1664 instance.description = description;
1665 instance.create_callback = create_callback;
1666 Mutex::Locker locker (GetSymbolFileMutex ());
1667 GetSymbolFileInstances ().push_back (instance);
1673 PluginManager::UnregisterPlugin (SymbolFileCreateInstance create_callback)
1675 if (create_callback)
1677 Mutex::Locker locker (GetSymbolFileMutex ());
1678 SymbolFileInstances &instances = GetSymbolFileInstances ();
1680 SymbolFileInstances::iterator pos, end = instances.end();
1681 for (pos = instances.begin(); pos != end; ++ pos)
1683 if (pos->create_callback == create_callback)
1685 instances.erase(pos);
1693 SymbolFileCreateInstance
1694 PluginManager::GetSymbolFileCreateCallbackAtIndex (uint32_t idx)
1696 Mutex::Locker locker (GetSymbolFileMutex ());
1697 SymbolFileInstances &instances = GetSymbolFileInstances ();
1698 if (idx < instances.size())
1699 return instances[idx].create_callback;
1703 SymbolFileCreateInstance
1704 PluginManager::GetSymbolFileCreateCallbackForPluginName (const ConstString &name)
1708 Mutex::Locker locker (GetSymbolFileMutex ());
1709 SymbolFileInstances &instances = GetSymbolFileInstances ();
1711 SymbolFileInstances::iterator pos, end = instances.end();
1712 for (pos = instances.begin(); pos != end; ++ pos)
1714 if (name == pos->name)
1715 return pos->create_callback;
1723 #pragma mark SymbolVendor
1725 struct SymbolVendorInstance
1727 SymbolVendorInstance() :
1730 create_callback(NULL)
1735 std::string description;
1736 SymbolVendorCreateInstance create_callback;
1739 typedef std::vector<SymbolVendorInstance> SymbolVendorInstances;
1742 GetSymbolVendorMutex ()
1744 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1745 return g_instances_mutex;
1748 static SymbolVendorInstances &
1749 GetSymbolVendorInstances ()
1751 static SymbolVendorInstances g_instances;
1756 PluginManager::RegisterPlugin
1758 const ConstString &name,
1759 const char *description,
1760 SymbolVendorCreateInstance create_callback
1763 if (create_callback)
1765 SymbolVendorInstance instance;
1766 assert ((bool)name);
1767 instance.name = name;
1768 if (description && description[0])
1769 instance.description = description;
1770 instance.create_callback = create_callback;
1771 Mutex::Locker locker (GetSymbolVendorMutex ());
1772 GetSymbolVendorInstances ().push_back (instance);
1778 PluginManager::UnregisterPlugin (SymbolVendorCreateInstance create_callback)
1780 if (create_callback)
1782 Mutex::Locker locker (GetSymbolVendorMutex ());
1783 SymbolVendorInstances &instances = GetSymbolVendorInstances ();
1785 SymbolVendorInstances::iterator pos, end = instances.end();
1786 for (pos = instances.begin(); pos != end; ++ pos)
1788 if (pos->create_callback == create_callback)
1790 instances.erase(pos);
1798 SymbolVendorCreateInstance
1799 PluginManager::GetSymbolVendorCreateCallbackAtIndex (uint32_t idx)
1801 Mutex::Locker locker (GetSymbolVendorMutex ());
1802 SymbolVendorInstances &instances = GetSymbolVendorInstances ();
1803 if (idx < instances.size())
1804 return instances[idx].create_callback;
1809 SymbolVendorCreateInstance
1810 PluginManager::GetSymbolVendorCreateCallbackForPluginName (const ConstString &name)
1814 Mutex::Locker locker (GetSymbolVendorMutex ());
1815 SymbolVendorInstances &instances = GetSymbolVendorInstances ();
1817 SymbolVendorInstances::iterator pos, end = instances.end();
1818 for (pos = instances.begin(); pos != end; ++ pos)
1820 if (name == pos->name)
1821 return pos->create_callback;
1828 #pragma mark UnwindAssembly
1830 struct UnwindAssemblyInstance
1832 UnwindAssemblyInstance() :
1835 create_callback(NULL)
1840 std::string description;
1841 UnwindAssemblyCreateInstance create_callback;
1844 typedef std::vector<UnwindAssemblyInstance> UnwindAssemblyInstances;
1847 GetUnwindAssemblyMutex ()
1849 static Mutex g_instances_mutex (Mutex::eMutexTypeRecursive);
1850 return g_instances_mutex;
1853 static UnwindAssemblyInstances &
1854 GetUnwindAssemblyInstances ()
1856 static UnwindAssemblyInstances g_instances;
1861 PluginManager::RegisterPlugin
1863 const ConstString &name,
1864 const char *description,
1865 UnwindAssemblyCreateInstance create_callback
1868 if (create_callback)
1870 UnwindAssemblyInstance instance;
1871 assert ((bool)name);
1872 instance.name = name;
1873 if (description && description[0])
1874 instance.description = description;
1875 instance.create_callback = create_callback;
1876 Mutex::Locker locker (GetUnwindAssemblyMutex ());
1877 GetUnwindAssemblyInstances ().push_back (instance);
1883 PluginManager::UnregisterPlugin (UnwindAssemblyCreateInstance create_callback)
1885 if (create_callback)
1887 Mutex::Locker locker (GetUnwindAssemblyMutex ());
1888 UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
1890 UnwindAssemblyInstances::iterator pos, end = instances.end();
1891 for (pos = instances.begin(); pos != end; ++ pos)
1893 if (pos->create_callback == create_callback)
1895 instances.erase(pos);
1903 UnwindAssemblyCreateInstance
1904 PluginManager::GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx)
1906 Mutex::Locker locker (GetUnwindAssemblyMutex ());
1907 UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
1908 if (idx < instances.size())
1909 return instances[idx].create_callback;
1914 UnwindAssemblyCreateInstance
1915 PluginManager::GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name)
1919 Mutex::Locker locker (GetUnwindAssemblyMutex ());
1920 UnwindAssemblyInstances &instances = GetUnwindAssemblyInstances ();
1922 UnwindAssemblyInstances::iterator pos, end = instances.end();
1923 for (pos = instances.begin(); pos != end; ++ pos)
1925 if (name == pos->name)
1926 return pos->create_callback;
1933 PluginManager::DebuggerInitialize (Debugger &debugger)
1935 // Initialize the DynamicLoader plugins
1937 Mutex::Locker locker (GetDynamicLoaderMutex ());
1938 DynamicLoaderInstances &instances = GetDynamicLoaderInstances ();
1940 DynamicLoaderInstances::iterator pos, end = instances.end();
1941 for (pos = instances.begin(); pos != end; ++ pos)
1943 if (pos->debugger_init_callback)
1944 pos->debugger_init_callback (debugger);
1948 // Initialize the Platform plugins
1950 Mutex::Locker locker (GetPlatformInstancesMutex ());
1951 PlatformInstances &instances = GetPlatformInstances ();
1953 PlatformInstances::iterator pos, end = instances.end();
1954 for (pos = instances.begin(); pos != end; ++ pos)
1956 if (pos->debugger_init_callback)
1957 pos->debugger_init_callback (debugger);
1961 // Initialize the Process plugins
1963 Mutex::Locker locker (GetProcessMutex());
1964 ProcessInstances &instances = GetProcessInstances();
1966 ProcessInstances::iterator pos, end = instances.end();
1967 for (pos = instances.begin(); pos != end; ++ pos)
1969 if (pos->debugger_init_callback)
1970 pos->debugger_init_callback (debugger);
1976 // This is the preferred new way to register plugin specific settings. e.g.
1977 // This will put a plugin's settings under e.g. "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
1978 static lldb::OptionValuePropertiesSP
1979 GetDebuggerPropertyForPlugins (Debugger &debugger,
1980 const ConstString &plugin_type_name,
1981 const ConstString &plugin_type_desc,
1984 lldb::OptionValuePropertiesSP parent_properties_sp (debugger.GetValueProperties());
1985 if (parent_properties_sp)
1987 static ConstString g_property_name("plugin");
1989 OptionValuePropertiesSP plugin_properties_sp = parent_properties_sp->GetSubProperty (NULL, g_property_name);
1990 if (!plugin_properties_sp && can_create)
1992 plugin_properties_sp.reset (new OptionValueProperties (g_property_name));
1993 parent_properties_sp->AppendProperty (g_property_name,
1994 ConstString("Settings specify to plugins."),
1996 plugin_properties_sp);
1999 if (plugin_properties_sp)
2001 lldb::OptionValuePropertiesSP plugin_type_properties_sp = plugin_properties_sp->GetSubProperty (NULL, plugin_type_name);
2002 if (!plugin_type_properties_sp && can_create)
2004 plugin_type_properties_sp.reset (new OptionValueProperties (plugin_type_name));
2005 plugin_properties_sp->AppendProperty (plugin_type_name,
2008 plugin_type_properties_sp);
2010 return plugin_type_properties_sp;
2013 return lldb::OptionValuePropertiesSP();
2016 // This is deprecated way to register plugin specific settings. e.g.
2017 // "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME"
2018 // and Platform generic settings would be under "platform.SETTINGNAME".
2019 static lldb::OptionValuePropertiesSP
2020 GetDebuggerPropertyForPluginsOldStyle (Debugger &debugger,
2021 const ConstString &plugin_type_name,
2022 const ConstString &plugin_type_desc,
2025 static ConstString g_property_name("plugin");
2026 lldb::OptionValuePropertiesSP parent_properties_sp (debugger.GetValueProperties());
2027 if (parent_properties_sp)
2029 OptionValuePropertiesSP plugin_properties_sp = parent_properties_sp->GetSubProperty (NULL, plugin_type_name);
2030 if (!plugin_properties_sp && can_create)
2032 plugin_properties_sp.reset (new OptionValueProperties (plugin_type_name));
2033 parent_properties_sp->AppendProperty (plugin_type_name,
2036 plugin_properties_sp);
2039 if (plugin_properties_sp)
2041 lldb::OptionValuePropertiesSP plugin_type_properties_sp = plugin_properties_sp->GetSubProperty (NULL, g_property_name);
2042 if (!plugin_type_properties_sp && can_create)
2044 plugin_type_properties_sp.reset (new OptionValueProperties (g_property_name));
2045 plugin_properties_sp->AppendProperty (g_property_name,
2046 ConstString("Settings specific to plugins"),
2048 plugin_type_properties_sp);
2050 return plugin_type_properties_sp;
2053 return lldb::OptionValuePropertiesSP();
2057 lldb::OptionValuePropertiesSP
2058 PluginManager::GetSettingForDynamicLoaderPlugin (Debugger &debugger, const ConstString &setting_name)
2060 lldb::OptionValuePropertiesSP properties_sp;
2061 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
2062 ConstString("dynamic-loader"),
2063 ConstString(), // not creating to so we don't need the description
2065 if (plugin_type_properties_sp)
2066 properties_sp = plugin_type_properties_sp->GetSubProperty (NULL, setting_name);
2067 return properties_sp;
2071 PluginManager::CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
2072 const lldb::OptionValuePropertiesSP &properties_sp,
2073 const ConstString &description,
2074 bool is_global_property)
2078 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
2079 ConstString("dynamic-loader"),
2080 ConstString("Settings for dynamic loader plug-ins"),
2082 if (plugin_type_properties_sp)
2084 plugin_type_properties_sp->AppendProperty (properties_sp->GetName(),
2095 lldb::OptionValuePropertiesSP
2096 PluginManager::GetSettingForPlatformPlugin (Debugger &debugger, const ConstString &setting_name)
2098 lldb::OptionValuePropertiesSP properties_sp;
2099 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
2100 ConstString("platform"),
2101 ConstString(), // not creating to so we don't need the description
2103 if (plugin_type_properties_sp)
2104 properties_sp = plugin_type_properties_sp->GetSubProperty (NULL, setting_name);
2105 return properties_sp;
2109 PluginManager::CreateSettingForPlatformPlugin (Debugger &debugger,
2110 const lldb::OptionValuePropertiesSP &properties_sp,
2111 const ConstString &description,
2112 bool is_global_property)
2116 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPluginsOldStyle (debugger,
2117 ConstString("platform"),
2118 ConstString("Settings for platform plug-ins"),
2120 if (plugin_type_properties_sp)
2122 plugin_type_properties_sp->AppendProperty (properties_sp->GetName(),
2133 lldb::OptionValuePropertiesSP
2134 PluginManager::GetSettingForProcessPlugin (Debugger &debugger, const ConstString &setting_name)
2136 lldb::OptionValuePropertiesSP properties_sp;
2137 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
2138 ConstString("process"),
2139 ConstString(), // not creating to so we don't need the description
2141 if (plugin_type_properties_sp)
2142 properties_sp = plugin_type_properties_sp->GetSubProperty (NULL, setting_name);
2143 return properties_sp;
2147 PluginManager::CreateSettingForProcessPlugin (Debugger &debugger,
2148 const lldb::OptionValuePropertiesSP &properties_sp,
2149 const ConstString &description,
2150 bool is_global_property)
2154 lldb::OptionValuePropertiesSP plugin_type_properties_sp (GetDebuggerPropertyForPlugins (debugger,
2155 ConstString("process"),
2156 ConstString("Settings for process plug-ins"),
2158 if (plugin_type_properties_sp)
2160 plugin_type_properties_sp->AppendProperty (properties_sp->GetName(),