1 //===-- PluginManager.h -----------------------------------------*- 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 #ifndef liblldb_PluginManager_h_
11 #define liblldb_PluginManager_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Host/FileSpec.h"
20 namespace lldb_private {
31 //------------------------------------------------------------------
33 //------------------------------------------------------------------
35 RegisterPlugin (const ConstString &name,
36 const char *description,
37 ABICreateInstance create_callback);
40 UnregisterPlugin (ABICreateInstance create_callback);
42 static ABICreateInstance
43 GetABICreateCallbackAtIndex (uint32_t idx);
45 static ABICreateInstance
46 GetABICreateCallbackForPluginName (const ConstString &name);
48 //------------------------------------------------------------------
50 //------------------------------------------------------------------
52 RegisterPlugin (const ConstString &name,
53 const char *description,
54 DisassemblerCreateInstance create_callback);
57 UnregisterPlugin (DisassemblerCreateInstance create_callback);
59 static DisassemblerCreateInstance
60 GetDisassemblerCreateCallbackAtIndex (uint32_t idx);
62 static DisassemblerCreateInstance
63 GetDisassemblerCreateCallbackForPluginName (const ConstString &name);
65 //------------------------------------------------------------------
67 //------------------------------------------------------------------
69 RegisterPlugin(const ConstString &name,
70 const char *description,
71 DynamicLoaderCreateInstance create_callback,
72 DebuggerInitializeCallback debugger_init_callback = nullptr);
75 UnregisterPlugin (DynamicLoaderCreateInstance create_callback);
77 static DynamicLoaderCreateInstance
78 GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx);
80 static DynamicLoaderCreateInstance
81 GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name);
83 //------------------------------------------------------------------
85 //------------------------------------------------------------------
87 RegisterPlugin(const ConstString &name,
88 const char *description,
89 JITLoaderCreateInstance create_callback,
90 DebuggerInitializeCallback debugger_init_callback = nullptr);
93 UnregisterPlugin (JITLoaderCreateInstance create_callback);
95 static JITLoaderCreateInstance
96 GetJITLoaderCreateCallbackAtIndex (uint32_t idx);
98 static JITLoaderCreateInstance
99 GetJITLoaderCreateCallbackForPluginName (const ConstString &name);
101 //------------------------------------------------------------------
102 // EmulateInstruction
103 //------------------------------------------------------------------
105 RegisterPlugin (const ConstString &name,
106 const char *description,
107 EmulateInstructionCreateInstance create_callback);
110 UnregisterPlugin (EmulateInstructionCreateInstance create_callback);
112 static EmulateInstructionCreateInstance
113 GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx);
115 static EmulateInstructionCreateInstance
116 GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name);
118 //------------------------------------------------------------------
120 //------------------------------------------------------------------
121 static bool RegisterPlugin(const ConstString &name, const char *description,
122 OperatingSystemCreateInstance create_callback,
123 DebuggerInitializeCallback debugger_init_callback);
126 UnregisterPlugin (OperatingSystemCreateInstance create_callback);
128 static OperatingSystemCreateInstance
129 GetOperatingSystemCreateCallbackAtIndex (uint32_t idx);
131 static OperatingSystemCreateInstance
132 GetOperatingSystemCreateCallbackForPluginName (const ConstString &name);
134 //------------------------------------------------------------------
136 //------------------------------------------------------------------
138 RegisterPlugin (const ConstString &name,
139 const char *description,
140 LanguageCreateInstance create_callback);
143 UnregisterPlugin (LanguageCreateInstance create_callback);
145 static LanguageCreateInstance
146 GetLanguageCreateCallbackAtIndex (uint32_t idx);
148 static LanguageCreateInstance
149 GetLanguageCreateCallbackForPluginName (const ConstString &name);
151 //------------------------------------------------------------------
153 //------------------------------------------------------------------
155 RegisterPlugin (const ConstString &name,
156 const char *description,
157 LanguageRuntimeCreateInstance create_callback,
158 LanguageRuntimeGetCommandObject command_callback = nullptr);
161 UnregisterPlugin (LanguageRuntimeCreateInstance create_callback);
163 static LanguageRuntimeCreateInstance
164 GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx);
166 static LanguageRuntimeGetCommandObject
167 GetLanguageRuntimeGetCommandObjectAtIndex (uint32_t idx);
169 static LanguageRuntimeCreateInstance
170 GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);
172 //------------------------------------------------------------------
174 //------------------------------------------------------------------
176 RegisterPlugin (const ConstString &name,
177 const char *description,
178 SystemRuntimeCreateInstance create_callback);
181 UnregisterPlugin (SystemRuntimeCreateInstance create_callback);
183 static SystemRuntimeCreateInstance
184 GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx);
186 static SystemRuntimeCreateInstance
187 GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name);
189 //------------------------------------------------------------------
191 //------------------------------------------------------------------
193 RegisterPlugin(const ConstString &name,
194 const char *description,
195 ObjectFileCreateInstance create_callback,
196 ObjectFileCreateMemoryInstance create_memory_callback,
197 ObjectFileGetModuleSpecifications get_module_specifications,
198 ObjectFileSaveCore save_core = nullptr);
201 UnregisterPlugin (ObjectFileCreateInstance create_callback);
203 static ObjectFileCreateInstance
204 GetObjectFileCreateCallbackAtIndex (uint32_t idx);
206 static ObjectFileCreateMemoryInstance
207 GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx);
209 static ObjectFileGetModuleSpecifications
210 GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
212 static ObjectFileCreateInstance
213 GetObjectFileCreateCallbackForPluginName (const ConstString &name);
215 static ObjectFileCreateMemoryInstance
216 GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name);
219 SaveCore (const lldb::ProcessSP &process_sp, const FileSpec &outfile);
221 //------------------------------------------------------------------
223 //------------------------------------------------------------------
225 RegisterPlugin (const ConstString &name,
226 const char *description,
227 ObjectContainerCreateInstance create_callback,
228 ObjectFileGetModuleSpecifications get_module_specifications);
231 UnregisterPlugin (ObjectContainerCreateInstance create_callback);
233 static ObjectContainerCreateInstance
234 GetObjectContainerCreateCallbackAtIndex (uint32_t idx);
236 static ObjectContainerCreateInstance
237 GetObjectContainerCreateCallbackForPluginName (const ConstString &name);
239 static ObjectFileGetModuleSpecifications
240 GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
242 //------------------------------------------------------------------
244 //------------------------------------------------------------------
246 RegisterPlugin (const ConstString &name,
247 const char *description,
248 LogChannelCreateInstance create_callback);
251 UnregisterPlugin (LogChannelCreateInstance create_callback);
253 static LogChannelCreateInstance
254 GetLogChannelCreateCallbackAtIndex (uint32_t idx);
256 static LogChannelCreateInstance
257 GetLogChannelCreateCallbackForPluginName (const ConstString &name);
260 GetLogChannelCreateNameAtIndex (uint32_t idx);
262 //------------------------------------------------------------------
264 //------------------------------------------------------------------
266 RegisterPlugin(const ConstString &name,
267 const char *description,
268 PlatformCreateInstance create_callback,
269 DebuggerInitializeCallback debugger_init_callback = nullptr);
272 UnregisterPlugin (PlatformCreateInstance create_callback);
274 static PlatformCreateInstance
275 GetPlatformCreateCallbackAtIndex (uint32_t idx);
277 static PlatformCreateInstance
278 GetPlatformCreateCallbackForPluginName (const ConstString &name);
281 GetPlatformPluginNameAtIndex (uint32_t idx);
284 GetPlatformPluginDescriptionAtIndex (uint32_t idx);
287 AutoCompletePlatformName (const char *partial_name,
288 StringList &matches);
289 //------------------------------------------------------------------
291 //------------------------------------------------------------------
293 RegisterPlugin(const ConstString &name,
294 const char *description,
295 ProcessCreateInstance create_callback,
296 DebuggerInitializeCallback debugger_init_callback = nullptr);
299 UnregisterPlugin (ProcessCreateInstance create_callback);
301 static ProcessCreateInstance
302 GetProcessCreateCallbackAtIndex (uint32_t idx);
304 static ProcessCreateInstance
305 GetProcessCreateCallbackForPluginName (const ConstString &name);
308 GetProcessPluginNameAtIndex (uint32_t idx);
311 GetProcessPluginDescriptionAtIndex (uint32_t idx);
313 //------------------------------------------------------------------
315 //------------------------------------------------------------------
317 RegisterPlugin(const ConstString &name, const char *description, lldb::ScriptLanguage script_lang,
318 ScriptInterpreterCreateInstance create_callback);
321 UnregisterPlugin(ScriptInterpreterCreateInstance create_callback);
323 static ScriptInterpreterCreateInstance
324 GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx);
326 static lldb::ScriptInterpreterSP
327 GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
328 CommandInterpreter &interpreter);
330 //------------------------------------------------------------------
332 //------------------------------------------------------------------
334 RegisterPlugin (const ConstString &name,
335 const char *description,
336 SymbolFileCreateInstance create_callback,
337 DebuggerInitializeCallback debugger_init_callback = nullptr);
340 UnregisterPlugin (SymbolFileCreateInstance create_callback);
342 static SymbolFileCreateInstance
343 GetSymbolFileCreateCallbackAtIndex (uint32_t idx);
345 static SymbolFileCreateInstance
346 GetSymbolFileCreateCallbackForPluginName (const ConstString &name);
348 //------------------------------------------------------------------
350 //------------------------------------------------------------------
352 RegisterPlugin (const ConstString &name,
353 const char *description,
354 SymbolVendorCreateInstance create_callback);
357 UnregisterPlugin (SymbolVendorCreateInstance create_callback);
359 static SymbolVendorCreateInstance
360 GetSymbolVendorCreateCallbackAtIndex (uint32_t idx);
362 static SymbolVendorCreateInstance
363 GetSymbolVendorCreateCallbackForPluginName (const ConstString &name);
365 //------------------------------------------------------------------
367 //------------------------------------------------------------------
369 RegisterPlugin (const ConstString &name,
370 const char *description,
371 UnwindAssemblyCreateInstance create_callback);
374 UnregisterPlugin (UnwindAssemblyCreateInstance create_callback);
376 static UnwindAssemblyCreateInstance
377 GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx);
379 static UnwindAssemblyCreateInstance
380 GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name);
382 //------------------------------------------------------------------
384 //------------------------------------------------------------------
386 RegisterPlugin (const ConstString &name,
387 const char *description,
388 MemoryHistoryCreateInstance create_callback);
391 UnregisterPlugin (MemoryHistoryCreateInstance create_callback);
393 static MemoryHistoryCreateInstance
394 GetMemoryHistoryCreateCallbackAtIndex (uint32_t idx);
396 static MemoryHistoryCreateInstance
397 GetMemoryHistoryCreateCallbackForPluginName (const ConstString &name);
399 //------------------------------------------------------------------
400 // InstrumentationRuntime
401 //------------------------------------------------------------------
403 RegisterPlugin (const ConstString &name,
404 const char *description,
405 InstrumentationRuntimeCreateInstance create_callback,
406 InstrumentationRuntimeGetType get_type_callback);
409 UnregisterPlugin (InstrumentationRuntimeCreateInstance create_callback);
411 static InstrumentationRuntimeGetType
412 GetInstrumentationRuntimeGetTypeCallbackAtIndex (uint32_t idx);
414 static InstrumentationRuntimeCreateInstance
415 GetInstrumentationRuntimeCreateCallbackAtIndex (uint32_t idx);
417 static InstrumentationRuntimeCreateInstance
418 GetInstrumentationRuntimeCreateCallbackForPluginName (const ConstString &name);
420 //------------------------------------------------------------------
422 //------------------------------------------------------------------
424 RegisterPlugin (const ConstString &name,
425 const char *description,
426 TypeSystemCreateInstance create_callback,
427 TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
430 UnregisterPlugin (TypeSystemCreateInstance create_callback);
432 static TypeSystemCreateInstance
433 GetTypeSystemCreateCallbackAtIndex (uint32_t idx);
435 static TypeSystemCreateInstance
436 GetTypeSystemCreateCallbackForPluginName (const ConstString &name);
438 static TypeSystemEnumerateSupportedLanguages
439 GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
441 static TypeSystemEnumerateSupportedLanguages
442 GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
444 //------------------------------------------------------------------
446 //------------------------------------------------------------------
448 RegisterPlugin (const ConstString &name,
449 const char *description,
450 REPLCreateInstance create_callback,
451 REPLEnumerateSupportedLanguages enumerate_languages_callback);
454 UnregisterPlugin (REPLCreateInstance create_callback);
456 static REPLCreateInstance
457 GetREPLCreateCallbackAtIndex (uint32_t idx);
459 static REPLCreateInstance
460 GetREPLCreateCallbackForPluginName (const ConstString &name);
462 static REPLEnumerateSupportedLanguages
463 GetREPLEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
465 static REPLEnumerateSupportedLanguages
466 GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
468 //------------------------------------------------------------------
469 // Some plug-ins might register a DebuggerInitializeCallback
470 // callback when registering the plug-in. After a new Debugger
471 // instance is created, this DebuggerInitialize function will get
472 // called. This allows plug-ins to install Properties and do any
473 // other initialization that requires a debugger instance.
474 //------------------------------------------------------------------
476 DebuggerInitialize (Debugger &debugger);
478 static lldb::OptionValuePropertiesSP
479 GetSettingForDynamicLoaderPlugin (Debugger &debugger,
480 const ConstString &setting_name);
483 CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
484 const lldb::OptionValuePropertiesSP &properties_sp,
485 const ConstString &description,
486 bool is_global_property);
488 static lldb::OptionValuePropertiesSP
489 GetSettingForPlatformPlugin (Debugger &debugger,
490 const ConstString &setting_name);
493 CreateSettingForPlatformPlugin (Debugger &debugger,
494 const lldb::OptionValuePropertiesSP &properties_sp,
495 const ConstString &description,
496 bool is_global_property);
498 static lldb::OptionValuePropertiesSP
499 GetSettingForProcessPlugin (Debugger &debugger,
500 const ConstString &setting_name);
503 CreateSettingForProcessPlugin (Debugger &debugger,
504 const lldb::OptionValuePropertiesSP &properties_sp,
505 const ConstString &description,
506 bool is_global_property);
508 static lldb::OptionValuePropertiesSP
509 GetSettingForSymbolFilePlugin (Debugger &debugger,
510 const ConstString &setting_name);
513 CreateSettingForSymbolFilePlugin (Debugger &debugger,
514 const lldb::OptionValuePropertiesSP &properties_sp,
515 const ConstString &description,
516 bool is_global_property);
518 static lldb::OptionValuePropertiesSP
519 GetSettingForJITLoaderPlugin (Debugger &debugger,
520 const ConstString &setting_name);
523 CreateSettingForJITLoaderPlugin (Debugger &debugger,
524 const lldb::OptionValuePropertiesSP &properties_sp,
525 const ConstString &description,
526 bool is_global_property);
528 static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger,
529 const ConstString &setting_name);
531 static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger,
532 const lldb::OptionValuePropertiesSP &properties_sp,
533 const ConstString &description, bool is_global_property);
536 } // namespace lldb_private
538 #endif // liblldb_PluginManager_h_