File indexing completed on 2026-05-10 08:42:45
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_CORE_PLUGINMANAGER_H
0010 #define LLDB_CORE_PLUGINMANAGER_H
0011
0012 #include "lldb/Core/Architecture.h"
0013 #include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h"
0014 #include "lldb/Symbol/TypeSystem.h"
0015 #include "lldb/Utility/CompletionRequest.h"
0016 #include "lldb/Utility/FileSpec.h"
0017 #include "lldb/Utility/Status.h"
0018 #include "lldb/lldb-enumerations.h"
0019 #include "lldb/lldb-forward.h"
0020 #include "lldb/lldb-private-interfaces.h"
0021 #include "llvm/ADT/StringRef.h"
0022
0023 #include <cstddef>
0024 #include <cstdint>
0025
0026 #define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName) \
0027 namespace lldb_private { \
0028 void lldb_initialize_##PluginName() { ClassName::Initialize(); } \
0029 void lldb_terminate_##PluginName() { ClassName::Terminate(); } \
0030 }
0031
0032 #define LLDB_PLUGIN_DEFINE(PluginName) \
0033 LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
0034
0035
0036 #define LLDB_PLUGIN_DECLARE(PluginName) \
0037 namespace lldb_private { \
0038 extern void lldb_initialize_##PluginName(); \
0039 extern void lldb_terminate_##PluginName(); \
0040 }
0041
0042 #define LLDB_PLUGIN_INITIALIZE(PluginName) lldb_initialize_##PluginName()
0043 #define LLDB_PLUGIN_TERMINATE(PluginName) lldb_terminate_##PluginName()
0044
0045 namespace lldb_private {
0046 class CommandInterpreter;
0047 class Debugger;
0048 class StringList;
0049
0050 class PluginManager {
0051 public:
0052 static void Initialize();
0053
0054 static void Terminate();
0055
0056
0057 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0058 ABICreateInstance create_callback);
0059
0060 static bool UnregisterPlugin(ABICreateInstance create_callback);
0061
0062 static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
0063
0064
0065 static void RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0066 ArchitectureCreateInstance create_callback);
0067
0068 static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
0069
0070 static std::unique_ptr<Architecture>
0071 CreateArchitectureInstance(const ArchSpec &arch);
0072
0073
0074 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0075 DisassemblerCreateInstance create_callback);
0076
0077 static bool UnregisterPlugin(DisassemblerCreateInstance create_callback);
0078
0079 static DisassemblerCreateInstance
0080 GetDisassemblerCreateCallbackAtIndex(uint32_t idx);
0081
0082 static DisassemblerCreateInstance
0083 GetDisassemblerCreateCallbackForPluginName(llvm::StringRef name);
0084
0085
0086 static bool
0087 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0088 DynamicLoaderCreateInstance create_callback,
0089 DebuggerInitializeCallback debugger_init_callback = nullptr);
0090
0091 static bool UnregisterPlugin(DynamicLoaderCreateInstance create_callback);
0092
0093 static DynamicLoaderCreateInstance
0094 GetDynamicLoaderCreateCallbackAtIndex(uint32_t idx);
0095
0096 static DynamicLoaderCreateInstance
0097 GetDynamicLoaderCreateCallbackForPluginName(llvm::StringRef name);
0098
0099
0100 static bool
0101 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0102 JITLoaderCreateInstance create_callback,
0103 DebuggerInitializeCallback debugger_init_callback = nullptr);
0104
0105 static bool UnregisterPlugin(JITLoaderCreateInstance create_callback);
0106
0107 static JITLoaderCreateInstance
0108 GetJITLoaderCreateCallbackAtIndex(uint32_t idx);
0109
0110
0111 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0112 EmulateInstructionCreateInstance create_callback);
0113
0114 static bool
0115 UnregisterPlugin(EmulateInstructionCreateInstance create_callback);
0116
0117 static EmulateInstructionCreateInstance
0118 GetEmulateInstructionCreateCallbackAtIndex(uint32_t idx);
0119
0120 static EmulateInstructionCreateInstance
0121 GetEmulateInstructionCreateCallbackForPluginName(llvm::StringRef name);
0122
0123
0124 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0125 OperatingSystemCreateInstance create_callback,
0126 DebuggerInitializeCallback debugger_init_callback);
0127
0128 static bool UnregisterPlugin(OperatingSystemCreateInstance create_callback);
0129
0130 static OperatingSystemCreateInstance
0131 GetOperatingSystemCreateCallbackAtIndex(uint32_t idx);
0132
0133 static OperatingSystemCreateInstance
0134 GetOperatingSystemCreateCallbackForPluginName(llvm::StringRef name);
0135
0136
0137 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0138 LanguageCreateInstance create_callback);
0139
0140 static bool UnregisterPlugin(LanguageCreateInstance create_callback);
0141
0142 static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx);
0143
0144
0145 static bool RegisterPlugin(
0146 llvm::StringRef name, llvm::StringRef description,
0147 LanguageRuntimeCreateInstance create_callback,
0148 LanguageRuntimeGetCommandObject command_callback = nullptr,
0149 LanguageRuntimeGetExceptionPrecondition precondition_callback = nullptr);
0150
0151 static bool UnregisterPlugin(LanguageRuntimeCreateInstance create_callback);
0152
0153 static LanguageRuntimeCreateInstance
0154 GetLanguageRuntimeCreateCallbackAtIndex(uint32_t idx);
0155
0156 static LanguageRuntimeGetCommandObject
0157 GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx);
0158
0159 static LanguageRuntimeGetExceptionPrecondition
0160 GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx);
0161
0162
0163 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0164 SystemRuntimeCreateInstance create_callback);
0165
0166 static bool UnregisterPlugin(SystemRuntimeCreateInstance create_callback);
0167
0168 static SystemRuntimeCreateInstance
0169 GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
0170
0171
0172 static bool
0173 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0174 ObjectFileCreateInstance create_callback,
0175 ObjectFileCreateMemoryInstance create_memory_callback,
0176 ObjectFileGetModuleSpecifications get_module_specifications,
0177 ObjectFileSaveCore save_core = nullptr,
0178 DebuggerInitializeCallback debugger_init_callback = nullptr);
0179
0180 static bool UnregisterPlugin(ObjectFileCreateInstance create_callback);
0181
0182 static bool IsRegisteredObjectFilePluginName(llvm::StringRef name);
0183
0184 static ObjectFileCreateInstance
0185 GetObjectFileCreateCallbackAtIndex(uint32_t idx);
0186
0187 static ObjectFileCreateMemoryInstance
0188 GetObjectFileCreateMemoryCallbackAtIndex(uint32_t idx);
0189
0190 static ObjectFileGetModuleSpecifications
0191 GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
0192
0193 static ObjectFileCreateMemoryInstance
0194 GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name);
0195
0196 static Status SaveCore(const lldb::ProcessSP &process_sp,
0197 lldb_private::SaveCoreOptions &core_options);
0198
0199
0200 static bool RegisterPlugin(
0201 llvm::StringRef name, llvm::StringRef description,
0202 ObjectContainerCreateInstance create_callback,
0203 ObjectFileGetModuleSpecifications get_module_specifications,
0204 ObjectContainerCreateMemoryInstance create_memory_callback = nullptr);
0205
0206 static bool UnregisterPlugin(ObjectContainerCreateInstance create_callback);
0207
0208 static ObjectContainerCreateInstance
0209 GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
0210
0211 static ObjectContainerCreateMemoryInstance
0212 GetObjectContainerCreateMemoryCallbackAtIndex(uint32_t idx);
0213
0214 static ObjectFileGetModuleSpecifications
0215 GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
0216
0217
0218 static bool
0219 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0220 PlatformCreateInstance create_callback,
0221 DebuggerInitializeCallback debugger_init_callback = nullptr);
0222
0223 static bool UnregisterPlugin(PlatformCreateInstance create_callback);
0224
0225 static PlatformCreateInstance GetPlatformCreateCallbackAtIndex(uint32_t idx);
0226
0227 static PlatformCreateInstance
0228 GetPlatformCreateCallbackForPluginName(llvm::StringRef name);
0229
0230 static llvm::StringRef GetPlatformPluginNameAtIndex(uint32_t idx);
0231
0232 static llvm::StringRef GetPlatformPluginDescriptionAtIndex(uint32_t idx);
0233
0234 static void AutoCompletePlatformName(llvm::StringRef partial_name,
0235 CompletionRequest &request);
0236
0237 static bool
0238 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0239 ProcessCreateInstance create_callback,
0240 DebuggerInitializeCallback debugger_init_callback = nullptr);
0241
0242 static bool UnregisterPlugin(ProcessCreateInstance create_callback);
0243
0244 static ProcessCreateInstance GetProcessCreateCallbackAtIndex(uint32_t idx);
0245
0246 static ProcessCreateInstance
0247 GetProcessCreateCallbackForPluginName(llvm::StringRef name);
0248
0249 static llvm::StringRef GetProcessPluginNameAtIndex(uint32_t idx);
0250
0251 static llvm::StringRef GetProcessPluginDescriptionAtIndex(uint32_t idx);
0252
0253 static void AutoCompleteProcessName(llvm::StringRef partial_name,
0254 CompletionRequest &request);
0255
0256
0257 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0258 RegisterTypeBuilderCreateInstance create_callback);
0259
0260 static bool
0261 UnregisterPlugin(RegisterTypeBuilderCreateInstance create_callback);
0262
0263 static lldb::RegisterTypeBuilderSP GetRegisterTypeBuilder(Target &target);
0264
0265
0266 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0267 lldb::ScriptLanguage script_lang,
0268 ScriptInterpreterCreateInstance create_callback);
0269
0270 static bool UnregisterPlugin(ScriptInterpreterCreateInstance create_callback);
0271
0272 static ScriptInterpreterCreateInstance
0273 GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx);
0274
0275 static lldb::ScriptInterpreterSP
0276 GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
0277 Debugger &debugger);
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313 static bool
0314 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0315 StructuredDataPluginCreateInstance create_callback,
0316 DebuggerInitializeCallback debugger_init_callback = nullptr,
0317 StructuredDataFilterLaunchInfo filter_callback = nullptr);
0318
0319 static bool
0320 UnregisterPlugin(StructuredDataPluginCreateInstance create_callback);
0321
0322 static StructuredDataPluginCreateInstance
0323 GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx);
0324
0325 static StructuredDataFilterLaunchInfo
0326 GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
0327 bool &iteration_complete);
0328
0329
0330 static bool
0331 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0332 SymbolFileCreateInstance create_callback,
0333 DebuggerInitializeCallback debugger_init_callback = nullptr);
0334
0335 static bool UnregisterPlugin(SymbolFileCreateInstance create_callback);
0336
0337 static SymbolFileCreateInstance
0338 GetSymbolFileCreateCallbackAtIndex(uint32_t idx);
0339
0340
0341 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0342 SymbolVendorCreateInstance create_callback);
0343
0344 static bool UnregisterPlugin(SymbolVendorCreateInstance create_callback);
0345
0346 static SymbolVendorCreateInstance
0347 GetSymbolVendorCreateCallbackAtIndex(uint32_t idx);
0348
0349
0350 static bool RegisterPlugin(
0351 llvm::StringRef name, llvm::StringRef description,
0352 SymbolLocatorCreateInstance create_callback,
0353 SymbolLocatorLocateExecutableObjectFile locate_executable_object_file =
0354 nullptr,
0355 SymbolLocatorLocateExecutableSymbolFile locate_executable_symbol_file =
0356 nullptr,
0357 SymbolLocatorDownloadObjectAndSymbolFile download_object_symbol_file =
0358 nullptr,
0359 SymbolLocatorFindSymbolFileInBundle find_symbol_file_in_bundle = nullptr,
0360 DebuggerInitializeCallback debugger_init_callback = nullptr);
0361
0362 static bool UnregisterPlugin(SymbolLocatorCreateInstance create_callback);
0363
0364 static SymbolLocatorCreateInstance
0365 GetSymbolLocatorCreateCallbackAtIndex(uint32_t idx);
0366
0367 static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec);
0368
0369 static FileSpec
0370 LocateExecutableSymbolFile(const ModuleSpec &module_spec,
0371 const FileSpecList &default_search_paths);
0372
0373 static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
0374 Status &error,
0375 bool force_lookup = true,
0376 bool copy_executable = true);
0377
0378 static FileSpec FindSymbolFileInBundle(const FileSpec &dsym_bundle_fspec,
0379 const UUID *uuid,
0380 const ArchSpec *arch);
0381
0382
0383 static bool RegisterPlugin(
0384 llvm::StringRef name, llvm::StringRef description,
0385 TraceCreateInstanceFromBundle create_callback_from_bundle,
0386 TraceCreateInstanceForLiveProcess create_callback_for_live_process,
0387 llvm::StringRef schema,
0388 DebuggerInitializeCallback debugger_init_callback);
0389
0390 static bool
0391 UnregisterPlugin(TraceCreateInstanceFromBundle create_callback);
0392
0393 static TraceCreateInstanceFromBundle
0394 GetTraceCreateCallback(llvm::StringRef plugin_name);
0395
0396 static TraceCreateInstanceForLiveProcess
0397 GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name);
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408 static llvm::StringRef GetTraceSchema(llvm::StringRef plugin_name);
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419 static llvm::StringRef GetTraceSchema(size_t index);
0420
0421
0422
0423
0424
0425
0426 static bool RegisterPlugin(
0427 llvm::StringRef name, llvm::StringRef description,
0428 TraceExporterCreateInstance create_callback,
0429 ThreadTraceExportCommandCreator create_thread_trace_export_command);
0430
0431 static TraceExporterCreateInstance
0432 GetTraceExporterCreateCallback(llvm::StringRef plugin_name);
0433
0434 static bool UnregisterPlugin(TraceExporterCreateInstance create_callback);
0435
0436 static llvm::StringRef GetTraceExporterPluginNameAtIndex(uint32_t index);
0437
0438
0439
0440 static ThreadTraceExportCommandCreator
0441 GetThreadTraceExportCommandCreatorAtIndex(uint32_t index);
0442
0443
0444 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0445 UnwindAssemblyCreateInstance create_callback);
0446
0447 static bool UnregisterPlugin(UnwindAssemblyCreateInstance create_callback);
0448
0449 static UnwindAssemblyCreateInstance
0450 GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx);
0451
0452
0453 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0454 MemoryHistoryCreateInstance create_callback);
0455
0456 static bool UnregisterPlugin(MemoryHistoryCreateInstance create_callback);
0457
0458 static MemoryHistoryCreateInstance
0459 GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx);
0460
0461
0462 static bool
0463 RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0464 InstrumentationRuntimeCreateInstance create_callback,
0465 InstrumentationRuntimeGetType get_type_callback);
0466
0467 static bool
0468 UnregisterPlugin(InstrumentationRuntimeCreateInstance create_callback);
0469
0470 static InstrumentationRuntimeGetType
0471 GetInstrumentationRuntimeGetTypeCallbackAtIndex(uint32_t idx);
0472
0473 static InstrumentationRuntimeCreateInstance
0474 GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
0475
0476
0477 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0478 TypeSystemCreateInstance create_callback,
0479 LanguageSet supported_languages_for_types,
0480 LanguageSet supported_languages_for_expressions);
0481
0482 static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
0483
0484 static TypeSystemCreateInstance
0485 GetTypeSystemCreateCallbackAtIndex(uint32_t idx);
0486
0487 static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
0488
0489 static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
0490
0491
0492 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0493 ScriptedInterfaceCreateInstance create_callback,
0494 lldb::ScriptLanguage language,
0495 ScriptedInterfaceUsages usages);
0496
0497 static bool UnregisterPlugin(ScriptedInterfaceCreateInstance create_callback);
0498
0499 static uint32_t GetNumScriptedInterfaces();
0500
0501 static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx);
0502
0503 static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx);
0504
0505 static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx);
0506
0507 static ScriptedInterfaceUsages
0508 GetScriptedInterfaceUsagesAtIndex(uint32_t idx);
0509
0510
0511 static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
0512 REPLCreateInstance create_callback,
0513 LanguageSet supported_languages);
0514
0515 static bool UnregisterPlugin(REPLCreateInstance create_callback);
0516
0517 static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
0518
0519 static LanguageSet GetREPLSupportedLanguagesAtIndex(uint32_t idx);
0520
0521 static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
0522
0523
0524
0525
0526
0527
0528 static void DebuggerInitialize(Debugger &debugger);
0529
0530 static lldb::OptionValuePropertiesSP
0531 GetSettingForDynamicLoaderPlugin(Debugger &debugger,
0532 llvm::StringRef setting_name);
0533
0534 static bool CreateSettingForDynamicLoaderPlugin(
0535 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0536 llvm::StringRef description, bool is_global_property);
0537
0538 static lldb::OptionValuePropertiesSP
0539 GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name);
0540
0541 static bool CreateSettingForPlatformPlugin(
0542 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0543 llvm::StringRef description, bool is_global_property);
0544
0545 static lldb::OptionValuePropertiesSP
0546 GetSettingForProcessPlugin(Debugger &debugger, llvm::StringRef setting_name);
0547
0548 static bool CreateSettingForProcessPlugin(
0549 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0550 llvm::StringRef description, bool is_global_property);
0551
0552 static lldb::OptionValuePropertiesSP
0553 GetSettingForSymbolLocatorPlugin(Debugger &debugger,
0554 llvm::StringRef setting_name);
0555
0556 static bool CreateSettingForSymbolLocatorPlugin(
0557 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0558 llvm::StringRef description, bool is_global_property);
0559
0560 static bool CreateSettingForTracePlugin(
0561 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0562 llvm::StringRef description, bool is_global_property);
0563
0564 static lldb::OptionValuePropertiesSP
0565 GetSettingForObjectFilePlugin(Debugger &debugger,
0566 llvm::StringRef setting_name);
0567
0568 static bool CreateSettingForObjectFilePlugin(
0569 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0570 llvm::StringRef description, bool is_global_property);
0571
0572 static lldb::OptionValuePropertiesSP
0573 GetSettingForSymbolFilePlugin(Debugger &debugger,
0574 llvm::StringRef setting_name);
0575
0576 static bool CreateSettingForSymbolFilePlugin(
0577 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0578 llvm::StringRef description, bool is_global_property);
0579
0580 static lldb::OptionValuePropertiesSP
0581 GetSettingForJITLoaderPlugin(Debugger &debugger,
0582 llvm::StringRef setting_name);
0583
0584 static bool CreateSettingForJITLoaderPlugin(
0585 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0586 llvm::StringRef description, bool is_global_property);
0587
0588 static lldb::OptionValuePropertiesSP
0589 GetSettingForOperatingSystemPlugin(Debugger &debugger,
0590 llvm::StringRef setting_name);
0591
0592 static bool CreateSettingForOperatingSystemPlugin(
0593 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0594 llvm::StringRef description, bool is_global_property);
0595
0596 static lldb::OptionValuePropertiesSP
0597 GetSettingForStructuredDataPlugin(Debugger &debugger,
0598 llvm::StringRef setting_name);
0599
0600 static bool CreateSettingForStructuredDataPlugin(
0601 Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
0602 llvm::StringRef description, bool is_global_property);
0603 };
0604
0605 }
0606
0607 #endif