]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/PluginManager.h
Merge ^/head r294599 through r294776.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Core / PluginManager.h
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 #ifndef liblldb_PluginManager_h_
11 #define liblldb_PluginManager_h_
12
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Host/FileSpec.h"
19
20 namespace lldb_private {
21
22 class PluginManager
23 {
24 public:
25     static void
26     Initialize ();
27     
28     static void
29     Terminate ();
30
31     //------------------------------------------------------------------
32     // ABI
33     //------------------------------------------------------------------
34     static bool
35     RegisterPlugin (const ConstString &name,
36                     const char *description,
37                     ABICreateInstance create_callback);
38
39     static bool
40     UnregisterPlugin (ABICreateInstance create_callback);
41
42     static ABICreateInstance
43     GetABICreateCallbackAtIndex (uint32_t idx);
44
45     static ABICreateInstance
46     GetABICreateCallbackForPluginName (const ConstString &name);
47
48     //------------------------------------------------------------------
49     // Disassembler
50     //------------------------------------------------------------------
51     static bool
52     RegisterPlugin (const ConstString &name,
53                     const char *description,
54                     DisassemblerCreateInstance create_callback);
55
56     static bool
57     UnregisterPlugin (DisassemblerCreateInstance create_callback);
58
59     static DisassemblerCreateInstance
60     GetDisassemblerCreateCallbackAtIndex (uint32_t idx);
61
62     static DisassemblerCreateInstance
63     GetDisassemblerCreateCallbackForPluginName (const ConstString &name);
64
65     //------------------------------------------------------------------
66     // DynamicLoader
67     //------------------------------------------------------------------
68     static bool
69     RegisterPlugin(const ConstString &name,
70                    const char *description,
71                    DynamicLoaderCreateInstance create_callback,
72                    DebuggerInitializeCallback debugger_init_callback = nullptr);
73
74     static bool
75     UnregisterPlugin (DynamicLoaderCreateInstance create_callback);
76
77     static DynamicLoaderCreateInstance
78     GetDynamicLoaderCreateCallbackAtIndex (uint32_t idx);
79
80     static DynamicLoaderCreateInstance
81     GetDynamicLoaderCreateCallbackForPluginName (const ConstString &name);
82
83     //------------------------------------------------------------------
84     // JITLoader
85     //------------------------------------------------------------------
86     static bool
87     RegisterPlugin(const ConstString &name,
88                    const char *description,
89                    JITLoaderCreateInstance create_callback,
90                    DebuggerInitializeCallback debugger_init_callback = nullptr);
91
92     static bool
93     UnregisterPlugin (JITLoaderCreateInstance create_callback);
94
95     static JITLoaderCreateInstance
96     GetJITLoaderCreateCallbackAtIndex (uint32_t idx);
97
98     static JITLoaderCreateInstance
99     GetJITLoaderCreateCallbackForPluginName (const ConstString &name);
100
101     //------------------------------------------------------------------
102     // EmulateInstruction
103     //------------------------------------------------------------------
104     static bool
105     RegisterPlugin (const ConstString &name,
106                     const char *description,
107                     EmulateInstructionCreateInstance create_callback);
108     
109     static bool
110     UnregisterPlugin (EmulateInstructionCreateInstance create_callback);
111     
112     static EmulateInstructionCreateInstance
113     GetEmulateInstructionCreateCallbackAtIndex (uint32_t idx);
114     
115     static EmulateInstructionCreateInstance
116     GetEmulateInstructionCreateCallbackForPluginName (const ConstString &name);
117
118     //------------------------------------------------------------------
119     // OperatingSystem
120     //------------------------------------------------------------------
121     static bool RegisterPlugin(const ConstString &name, const char *description,
122                                OperatingSystemCreateInstance create_callback,
123                                DebuggerInitializeCallback debugger_init_callback);
124
125     static bool
126     UnregisterPlugin (OperatingSystemCreateInstance create_callback);
127     
128     static OperatingSystemCreateInstance
129     GetOperatingSystemCreateCallbackAtIndex (uint32_t idx);
130     
131     static OperatingSystemCreateInstance
132     GetOperatingSystemCreateCallbackForPluginName (const ConstString &name);
133
134     //------------------------------------------------------------------
135     // Language
136     //------------------------------------------------------------------
137     static bool
138     RegisterPlugin (const ConstString &name,
139                     const char *description,
140                     LanguageCreateInstance create_callback);
141     
142     static bool
143     UnregisterPlugin (LanguageCreateInstance create_callback);
144     
145     static LanguageCreateInstance
146     GetLanguageCreateCallbackAtIndex (uint32_t idx);
147     
148     static LanguageCreateInstance
149     GetLanguageCreateCallbackForPluginName (const ConstString &name);
150     
151     //------------------------------------------------------------------
152     // LanguageRuntime
153     //------------------------------------------------------------------
154     static bool
155     RegisterPlugin (const ConstString &name,
156                     const char *description,
157                     LanguageRuntimeCreateInstance create_callback,
158                     LanguageRuntimeGetCommandObject command_callback = nullptr);
159
160     static bool
161     UnregisterPlugin (LanguageRuntimeCreateInstance create_callback);
162
163     static LanguageRuntimeCreateInstance
164     GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx);
165
166     static LanguageRuntimeGetCommandObject
167     GetLanguageRuntimeGetCommandObjectAtIndex (uint32_t idx);
168
169     static LanguageRuntimeCreateInstance
170     GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);
171
172     //------------------------------------------------------------------
173     // SystemRuntime
174     //------------------------------------------------------------------
175     static bool
176     RegisterPlugin (const ConstString &name,
177                     const char *description,
178                     SystemRuntimeCreateInstance create_callback);
179
180     static bool
181     UnregisterPlugin (SystemRuntimeCreateInstance create_callback);
182
183     static SystemRuntimeCreateInstance
184     GetSystemRuntimeCreateCallbackAtIndex (uint32_t idx);
185
186     static SystemRuntimeCreateInstance
187     GetSystemRuntimeCreateCallbackForPluginName (const ConstString &name);
188
189     //------------------------------------------------------------------
190     // ObjectFile
191     //------------------------------------------------------------------
192     static bool
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);
199
200     static bool
201     UnregisterPlugin (ObjectFileCreateInstance create_callback);
202
203     static ObjectFileCreateInstance
204     GetObjectFileCreateCallbackAtIndex (uint32_t idx);
205     
206     static ObjectFileCreateMemoryInstance
207     GetObjectFileCreateMemoryCallbackAtIndex (uint32_t idx);
208
209     static ObjectFileGetModuleSpecifications
210     GetObjectFileGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
211
212     static ObjectFileCreateInstance
213     GetObjectFileCreateCallbackForPluginName (const ConstString &name);
214
215     static ObjectFileCreateMemoryInstance
216     GetObjectFileCreateMemoryCallbackForPluginName (const ConstString &name);
217
218     static Error
219     SaveCore (const lldb::ProcessSP &process_sp, const FileSpec &outfile);
220
221     //------------------------------------------------------------------
222     // ObjectContainer
223     //------------------------------------------------------------------
224     static bool
225     RegisterPlugin (const ConstString &name,
226                     const char *description,
227                     ObjectContainerCreateInstance create_callback,
228                     ObjectFileGetModuleSpecifications get_module_specifications);
229
230     static bool
231     UnregisterPlugin (ObjectContainerCreateInstance create_callback);
232
233     static ObjectContainerCreateInstance
234     GetObjectContainerCreateCallbackAtIndex (uint32_t idx);
235
236     static ObjectContainerCreateInstance
237     GetObjectContainerCreateCallbackForPluginName (const ConstString &name);
238
239     static ObjectFileGetModuleSpecifications
240     GetObjectContainerGetModuleSpecificationsCallbackAtIndex (uint32_t idx);
241
242     //------------------------------------------------------------------
243     // LogChannel
244     //------------------------------------------------------------------
245     static bool
246     RegisterPlugin (const ConstString &name,
247                     const char *description,
248                     LogChannelCreateInstance create_callback);
249
250     static bool
251     UnregisterPlugin (LogChannelCreateInstance create_callback);
252
253     static LogChannelCreateInstance
254     GetLogChannelCreateCallbackAtIndex (uint32_t idx);
255
256     static LogChannelCreateInstance
257     GetLogChannelCreateCallbackForPluginName (const ConstString &name);
258
259     static const char *
260     GetLogChannelCreateNameAtIndex (uint32_t idx);
261
262     //------------------------------------------------------------------
263     // Platform
264     //------------------------------------------------------------------
265     static bool
266     RegisterPlugin(const ConstString &name,
267                    const char *description,
268                    PlatformCreateInstance create_callback,
269                    DebuggerInitializeCallback debugger_init_callback = nullptr);
270
271     static bool
272     UnregisterPlugin (PlatformCreateInstance create_callback);
273
274     static PlatformCreateInstance
275     GetPlatformCreateCallbackAtIndex (uint32_t idx);
276
277     static PlatformCreateInstance
278     GetPlatformCreateCallbackForPluginName (const ConstString &name);
279     
280     static const char *
281     GetPlatformPluginNameAtIndex (uint32_t idx);
282
283     static const char *
284     GetPlatformPluginDescriptionAtIndex (uint32_t idx);
285
286     static size_t
287     AutoCompletePlatformName (const char *partial_name, 
288                               StringList &matches);
289     //------------------------------------------------------------------
290     // Process
291     //------------------------------------------------------------------
292     static bool
293     RegisterPlugin(const ConstString &name,
294                    const char *description,
295                    ProcessCreateInstance create_callback,
296                    DebuggerInitializeCallback debugger_init_callback = nullptr);
297     
298     static bool
299     UnregisterPlugin (ProcessCreateInstance create_callback);
300     
301     static ProcessCreateInstance
302     GetProcessCreateCallbackAtIndex (uint32_t idx);
303     
304     static ProcessCreateInstance
305     GetProcessCreateCallbackForPluginName (const ConstString &name);
306     
307     static const char *
308     GetProcessPluginNameAtIndex (uint32_t idx);
309     
310     static const char *
311     GetProcessPluginDescriptionAtIndex (uint32_t idx);
312
313     //------------------------------------------------------------------
314     // ScriptInterpreter
315     //------------------------------------------------------------------
316     static bool
317     RegisterPlugin(const ConstString &name, const char *description, lldb::ScriptLanguage script_lang,
318                                ScriptInterpreterCreateInstance create_callback);
319
320     static bool
321     UnregisterPlugin(ScriptInterpreterCreateInstance create_callback);
322
323     static ScriptInterpreterCreateInstance
324     GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx);
325
326     static lldb::ScriptInterpreterSP
327     GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
328                                     CommandInterpreter &interpreter);
329
330     //------------------------------------------------------------------
331     // SymbolFile
332     //------------------------------------------------------------------
333     static bool
334     RegisterPlugin (const ConstString &name,
335                     const char *description,
336                     SymbolFileCreateInstance create_callback,
337                     DebuggerInitializeCallback debugger_init_callback = nullptr);
338
339     static bool
340     UnregisterPlugin (SymbolFileCreateInstance create_callback);
341
342     static SymbolFileCreateInstance
343     GetSymbolFileCreateCallbackAtIndex (uint32_t idx);
344
345     static SymbolFileCreateInstance
346     GetSymbolFileCreateCallbackForPluginName (const ConstString &name);
347
348     //------------------------------------------------------------------
349     // SymbolVendor
350     //------------------------------------------------------------------
351     static bool
352     RegisterPlugin (const ConstString &name,
353                     const char *description,
354                     SymbolVendorCreateInstance create_callback);
355
356     static bool
357     UnregisterPlugin (SymbolVendorCreateInstance create_callback);
358
359     static SymbolVendorCreateInstance
360     GetSymbolVendorCreateCallbackAtIndex (uint32_t idx);
361
362     static SymbolVendorCreateInstance
363     GetSymbolVendorCreateCallbackForPluginName (const ConstString &name);
364
365     //------------------------------------------------------------------
366     // UnwindAssembly
367     //------------------------------------------------------------------
368     static bool
369     RegisterPlugin (const ConstString &name,
370                     const char *description,
371                     UnwindAssemblyCreateInstance create_callback);
372
373     static bool
374     UnregisterPlugin (UnwindAssemblyCreateInstance create_callback);
375
376     static UnwindAssemblyCreateInstance
377     GetUnwindAssemblyCreateCallbackAtIndex (uint32_t idx);
378
379     static UnwindAssemblyCreateInstance
380     GetUnwindAssemblyCreateCallbackForPluginName (const ConstString &name);
381     
382     //------------------------------------------------------------------
383     // MemoryHistory
384     //------------------------------------------------------------------
385     static bool
386     RegisterPlugin (const ConstString &name,
387                     const char *description,
388                     MemoryHistoryCreateInstance create_callback);
389     
390     static bool
391     UnregisterPlugin (MemoryHistoryCreateInstance create_callback);
392     
393     static MemoryHistoryCreateInstance
394     GetMemoryHistoryCreateCallbackAtIndex (uint32_t idx);
395     
396     static MemoryHistoryCreateInstance
397     GetMemoryHistoryCreateCallbackForPluginName (const ConstString &name);
398
399     //------------------------------------------------------------------
400     // InstrumentationRuntime
401     //------------------------------------------------------------------
402     static bool
403     RegisterPlugin (const ConstString &name,
404                     const char *description,
405                     InstrumentationRuntimeCreateInstance create_callback,
406                     InstrumentationRuntimeGetType get_type_callback);
407     
408     static bool
409     UnregisterPlugin (InstrumentationRuntimeCreateInstance create_callback);
410
411     static InstrumentationRuntimeGetType
412     GetInstrumentationRuntimeGetTypeCallbackAtIndex (uint32_t idx);
413     
414     static InstrumentationRuntimeCreateInstance
415     GetInstrumentationRuntimeCreateCallbackAtIndex (uint32_t idx);
416     
417     static InstrumentationRuntimeCreateInstance
418     GetInstrumentationRuntimeCreateCallbackForPluginName (const ConstString &name);
419
420     //------------------------------------------------------------------
421     // TypeSystem
422     //------------------------------------------------------------------
423     static bool
424     RegisterPlugin (const ConstString &name,
425                     const char *description,
426                     TypeSystemCreateInstance create_callback,
427                     TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
428
429     static bool
430     UnregisterPlugin (TypeSystemCreateInstance create_callback);
431
432     static TypeSystemCreateInstance
433     GetTypeSystemCreateCallbackAtIndex (uint32_t idx);
434
435     static TypeSystemCreateInstance
436     GetTypeSystemCreateCallbackForPluginName (const ConstString &name);
437     
438     static TypeSystemEnumerateSupportedLanguages
439     GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
440     
441     static TypeSystemEnumerateSupportedLanguages
442     GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
443     
444     //------------------------------------------------------------------
445     // REPL
446     //------------------------------------------------------------------
447     static bool
448     RegisterPlugin (const ConstString &name,
449                     const char *description,
450                     REPLCreateInstance create_callback,
451                     REPLEnumerateSupportedLanguages enumerate_languages_callback);
452     
453     static bool
454     UnregisterPlugin (REPLCreateInstance create_callback);
455     
456     static REPLCreateInstance
457     GetREPLCreateCallbackAtIndex (uint32_t idx);
458     
459     static REPLCreateInstance
460     GetREPLCreateCallbackForPluginName (const ConstString &name);
461     
462     static REPLEnumerateSupportedLanguages
463     GetREPLEnumerateSupportedLanguagesCallbackAtIndex (uint32_t idx);
464     
465     static REPLEnumerateSupportedLanguages
466     GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName (const ConstString &name);
467     
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     //------------------------------------------------------------------
475     static void
476     DebuggerInitialize (Debugger &debugger);
477     
478     static lldb::OptionValuePropertiesSP
479     GetSettingForDynamicLoaderPlugin (Debugger &debugger,
480                                       const ConstString &setting_name);
481     
482     static bool
483     CreateSettingForDynamicLoaderPlugin (Debugger &debugger,
484                                          const lldb::OptionValuePropertiesSP &properties_sp,
485                                          const ConstString &description,
486                                          bool is_global_property);
487     
488     static lldb::OptionValuePropertiesSP
489     GetSettingForPlatformPlugin (Debugger &debugger,
490                                        const ConstString &setting_name);
491     
492     static bool
493     CreateSettingForPlatformPlugin (Debugger &debugger,
494                                          const lldb::OptionValuePropertiesSP &properties_sp,
495                                          const ConstString &description,
496                                          bool is_global_property);
497
498     static lldb::OptionValuePropertiesSP
499     GetSettingForProcessPlugin (Debugger &debugger,
500                                 const ConstString &setting_name);
501
502     static bool
503     CreateSettingForProcessPlugin (Debugger &debugger,
504                                    const lldb::OptionValuePropertiesSP &properties_sp,
505                                    const ConstString &description,
506                                    bool is_global_property);
507
508     static lldb::OptionValuePropertiesSP
509     GetSettingForSymbolFilePlugin (Debugger &debugger,
510                                    const ConstString &setting_name);
511
512     static bool
513     CreateSettingForSymbolFilePlugin (Debugger &debugger,
514                                       const lldb::OptionValuePropertiesSP &properties_sp,
515                                       const ConstString &description,
516                                       bool is_global_property);
517
518     static lldb::OptionValuePropertiesSP
519     GetSettingForJITLoaderPlugin (Debugger &debugger,
520                                    const ConstString &setting_name);
521
522     static bool
523     CreateSettingForJITLoaderPlugin (Debugger &debugger,
524                                      const lldb::OptionValuePropertiesSP &properties_sp,
525                                      const ConstString &description,
526                                      bool is_global_property);
527
528     static lldb::OptionValuePropertiesSP GetSettingForOperatingSystemPlugin(Debugger &debugger,
529                                                                             const ConstString &setting_name);
530
531     static bool CreateSettingForOperatingSystemPlugin(Debugger &debugger,
532                                                       const lldb::OptionValuePropertiesSP &properties_sp,
533                                                       const ConstString &description, bool is_global_property);
534 };
535
536 } // namespace lldb_private
537
538 #endif // liblldb_PluginManager_h_