PluginManager.h revision 263363
1//===-- PluginManager.h -----------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10 11#ifndef liblldb_PluginManager_h_ 12#define liblldb_PluginManager_h_ 13 14#include "lldb/lldb-private.h" 15#include "lldb/Host/FileSpec.h" 16 17namespace lldb_private { 18 19class PluginManager 20{ 21public: 22 static void 23 Initialize (); 24 25 static void 26 Terminate (); 27 28 //------------------------------------------------------------------ 29 // ABI 30 //------------------------------------------------------------------ 31 static bool 32 RegisterPlugin (const ConstString &name, 33 const char *description, 34 ABICreateInstance create_callback); 35 36 static bool 37 UnregisterPlugin (ABICreateInstance create_callback); 38 39 static ABICreateInstance 40 GetABICreateCallbackAtIndex (uint32_t idx); 41 42 static ABICreateInstance 43 GetABICreateCallbackForPluginName (const ConstString &name); 44 45 46 //------------------------------------------------------------------ 47 // Disassembler 48 //------------------------------------------------------------------ 49 static bool 50 RegisterPlugin (const ConstString &name, 51 const char *description, 52 DisassemblerCreateInstance create_callback); 53 54 static bool 55 UnregisterPlugin (DisassemblerCreateInstance create_callback); 56 57 static DisassemblerCreateInstance 58 GetDisassemblerCreateCallbackAtIndex (uint32_t idx); 59 60 static DisassemblerCreateInstance 61 GetDisassemblerCreateCallbackForPluginName (const ConstString &name); 62 63 64 //------------------------------------------------------------------ 65 // DynamicLoader 66 //------------------------------------------------------------------ 67 static bool 68 RegisterPlugin (const ConstString &name, 69 const char *description, 70 DynamicLoaderCreateInstance create_callback, 71 DebuggerInitializeCallback debugger_init_callback = NULL); 72 73 static bool 74 UnregisterPlugin (DynamicLoaderCreateInstance create_callback); 75 76 static DynamicLoaderCreateInstance 77 GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx); 78 79 static DynamicLoaderCreateInstance 80 GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name); 81 82 //------------------------------------------------------------------ 83 // EmulateInstruction 84 //------------------------------------------------------------------ 85 static bool 86 RegisterPlugin (const ConstString &name, 87 const char *description, 88 EmulateInstructionCreateInstance create_callback); 89 90 static bool 91 UnregisterPlugin (EmulateInstructionCreateInstance create_callback); 92 93 static EmulateInstructionCreateInstance 94 GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx); 95 96 static EmulateInstructionCreateInstance 97 GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name); 98 99 //------------------------------------------------------------------ 100 // OperatingSystem 101 //------------------------------------------------------------------ 102 static bool 103 RegisterPlugin (const ConstString &name, 104 const char *description, 105 OperatingSystemCreateInstance create_callback); 106 107 static bool 108 UnregisterPlugin (OperatingSystemCreateInstance create_callback); 109 110 static OperatingSystemCreateInstance 111 GetOperatingSystemCreateCallbackAtIndex (uint32_t idx); 112 113 static OperatingSystemCreateInstance 114 GetOperatingSystemCreateCallbackForPluginName (const ConstString &name); 115 116 //------------------------------------------------------------------ 117 // LanguageRuntime 118 //------------------------------------------------------------------ 119 static bool 120 RegisterPlugin (const ConstString &name, 121 const char *description, 122 LanguageRuntimeCreateInstance create_callback); 123 124 static bool 125 UnregisterPlugin (LanguageRuntimeCreateInstance create_callback); 126 127 static LanguageRuntimeCreateInstance 128 GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx); 129 130 static LanguageRuntimeCreateInstance 131 GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name); 132 133 134 //------------------------------------------------------------------ 135 // SystemRuntime 136 //------------------------------------------------------------------ 137 static bool 138 RegisterPlugin (const ConstString &name, 139 const char *description, 140 SystemRuntimeCreateInstance create_callback); 141 142 static bool 143 UnregisterPlugin (SystemRuntimeCreateInstance create_callback); 144 145 static SystemRuntimeCreateInstance 146 GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx); 147 148 static SystemRuntimeCreateInstance 149 GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name); 150 151 152 //------------------------------------------------------------------ 153 // ObjectFile 154 //------------------------------------------------------------------ 155 static bool 156 RegisterPlugin (const ConstString &name, 157 const char *description, 158 ObjectFileCreateInstance create_callback, 159 ObjectFileCreateMemoryInstance create_memory_callback, 160 ObjectFileGetModuleSpecifications get_module_specifications); 161 162 static bool 163 UnregisterPlugin (ObjectFileCreateInstance create_callback); 164 165 static ObjectFileCreateInstance 166 GetObjectFileCreateCallbackAtIndex (uint32_t idx); 167 168 static ObjectFileCreateMemoryInstance 169 GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx); 170 171 static ObjectFileGetModuleSpecifications 172 GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx); 173 174 static ObjectFileCreateInstance 175 GetObjectFileCreateCallbackForPluginName (const ConstString &name); 176 177 static ObjectFileCreateMemoryInstance 178 GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name); 179 180 181 //------------------------------------------------------------------ 182 // ObjectContainer 183 //------------------------------------------------------------------ 184 static bool 185 RegisterPlugin (const ConstString &name, 186 const char *description, 187 ObjectContainerCreateInstance create_callback, 188 ObjectFileGetModuleSpecifications get_module_specifications); 189 190 static bool 191 UnregisterPlugin (ObjectContainerCreateInstance create_callback); 192 193 static ObjectContainerCreateInstance 194 GetObjectContainerCreateCallbackAtIndex (uint32_t idx); 195 196 static ObjectContainerCreateInstance 197 GetObjectContainerCreateCallbackForPluginName (const ConstString &name); 198 199 static ObjectFileGetModuleSpecifications 200 GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx); 201 202 //------------------------------------------------------------------ 203 // LogChannel 204 //------------------------------------------------------------------ 205 static bool 206 RegisterPlugin (const ConstString &name, 207 const char *description, 208 LogChannelCreateInstance create_callback); 209 210 static bool 211 UnregisterPlugin (LogChannelCreateInstance create_callback); 212 213 static LogChannelCreateInstance 214 GetLogChannelCreateCallbackAtIndex (uint32_t idx); 215 216 static LogChannelCreateInstance 217 GetLogChannelCreateCallbackForPluginName (const ConstString &name); 218 219 static const char * 220 GetLogChannelCreateNameAtIndex (uint32_t idx); 221 222 //------------------------------------------------------------------ 223 // Platform 224 //------------------------------------------------------------------ 225 static bool 226 RegisterPlugin (const ConstString &name, 227 const char *description, 228 PlatformCreateInstance create_callback, 229 DebuggerInitializeCallback debugger_init_callback = NULL); 230 231 static bool 232 UnregisterPlugin (PlatformCreateInstance create_callback); 233 234 static PlatformCreateInstance 235 GetPlatformCreateCallbackAtIndex (uint32_t idx); 236 237 static PlatformCreateInstance 238 GetPlatformCreateCallbackForPluginName (const ConstString &name); 239 240 static const char * 241 GetPlatformPluginNameAtIndex (uint32_t idx); 242 243 static const char * 244 GetPlatformPluginDescriptionAtIndex (uint32_t idx); 245 246 static size_t 247 AutoCompletePlatformName (const char *partial_name, 248 StringList &matches); 249 //------------------------------------------------------------------ 250 // Process 251 //------------------------------------------------------------------ 252 static bool 253 RegisterPlugin (const ConstString &name, 254 const char *description, 255 ProcessCreateInstance create_callback, 256 DebuggerInitializeCallback debugger_init_callback = NULL); 257 258 static bool 259 UnregisterPlugin (ProcessCreateInstance create_callback); 260 261 static ProcessCreateInstance 262 GetProcessCreateCallbackAtIndex (uint32_t idx); 263 264 static ProcessCreateInstance 265 GetProcessCreateCallbackForPluginName (const ConstString &name); 266 267 static const char * 268 GetProcessPluginNameAtIndex (uint32_t idx); 269 270 static const char * 271 GetProcessPluginDescriptionAtIndex (uint32_t idx); 272 273 //------------------------------------------------------------------ 274 // SymbolFile 275 //------------------------------------------------------------------ 276 static bool 277 RegisterPlugin (const ConstString &name, 278 const char *description, 279 SymbolFileCreateInstance create_callback); 280 281 static bool 282 UnregisterPlugin (SymbolFileCreateInstance create_callback); 283 284 static SymbolFileCreateInstance 285 GetSymbolFileCreateCallbackAtIndex (uint32_t idx); 286 287 static SymbolFileCreateInstance 288 GetSymbolFileCreateCallbackForPluginName (const ConstString &name); 289 290 291 //------------------------------------------------------------------ 292 // SymbolVendor 293 //------------------------------------------------------------------ 294 static bool 295 RegisterPlugin (const ConstString &name, 296 const char *description, 297 SymbolVendorCreateInstance create_callback); 298 299 static bool 300 UnregisterPlugin (SymbolVendorCreateInstance create_callback); 301 302 static SymbolVendorCreateInstance 303 GetSymbolVendorCreateCallbackAtIndex (uint32_t idx); 304 305 static SymbolVendorCreateInstance 306 GetSymbolVendorCreateCallbackForPluginName (const ConstString &name); 307 308 //------------------------------------------------------------------ 309 // UnwindAssembly 310 //------------------------------------------------------------------ 311 static bool 312 RegisterPlugin (const ConstString &name, 313 const char *description, 314 UnwindAssemblyCreateInstance create_callback); 315 316 static bool 317 UnregisterPlugin (UnwindAssemblyCreateInstance create_callback); 318 319 static UnwindAssemblyCreateInstance 320 GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx); 321 322 static UnwindAssemblyCreateInstance 323 GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name); 324 325 //------------------------------------------------------------------ 326 // Some plug-ins might register a DebuggerInitializeCallback 327 // callback when registering the plug-in. After a new Debugger 328 // instance is created, this DebuggerInitialize function will get 329 // called. This allows plug-ins to install Properties and do any 330 // other initialization that requires a debugger instance. 331 //------------------------------------------------------------------ 332 static void 333 DebuggerInitialize (Debugger &debugger); 334 335 static lldb::OptionValuePropertiesSP 336 GetSettingForDynamicLoaderPlugin (Debugger &debugger, 337 const ConstString &setting_name); 338 339 static bool 340 CreateSettingForDynamicLoaderPlugin (Debugger &debugger, 341 const lldb::OptionValuePropertiesSP &properties_sp, 342 const ConstString &description, 343 bool is_global_property); 344 345 static lldb::OptionValuePropertiesSP 346 GetSettingForPlatformPlugin (Debugger &debugger, 347 const ConstString &setting_name); 348 349 static bool 350 CreateSettingForPlatformPlugin (Debugger &debugger, 351 const lldb::OptionValuePropertiesSP &properties_sp, 352 const ConstString &description, 353 bool is_global_property); 354 355 static lldb::OptionValuePropertiesSP 356 GetSettingForProcessPlugin (Debugger &debugger, 357 const ConstString &setting_name); 358 359 static bool 360 CreateSettingForProcessPlugin (Debugger &debugger, 361 const lldb::OptionValuePropertiesSP &properties_sp, 362 const ConstString &description, 363 bool is_global_property); 364 365}; 366 367 368} // namespace lldb_private 369 370#endif // liblldb_PluginManager_h_ 371