LLDB  mainline
PluginManager.cpp
Go to the documentation of this file.
1 //===-- PluginManager.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Host/FileSystem.h"
13 #include "lldb/Host/HostInfo.h"
15 #include "lldb/Target/Process.h"
17 #include "lldb/Utility/FileSpec.h"
18 #include "lldb/Utility/Status.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/DynamicLibrary.h"
22 #include "llvm/Support/FileSystem.h"
23 #include "llvm/Support/raw_ostream.h"
24 #include <cassert>
25 #include <map>
26 #include <memory>
27 #include <mutex>
28 #include <string>
29 #include <utility>
30 #include <vector>
31 #if defined(_WIN32)
33 #endif
34 
35 using namespace lldb;
36 using namespace lldb_private;
37 
38 typedef bool (*PluginInitCallback)();
39 typedef void (*PluginTermCallback)();
40 
41 struct PluginInfo {
42  PluginInfo() = default;
43 
44  llvm::sys::DynamicLibrary library;
45  PluginInitCallback plugin_init_callback = nullptr;
46  PluginTermCallback plugin_term_callback = nullptr;
47 };
48 
49 typedef std::map<FileSpec, PluginInfo> PluginTerminateMap;
50 
51 static std::recursive_mutex &GetPluginMapMutex() {
52  static std::recursive_mutex g_plugin_map_mutex;
53  return g_plugin_map_mutex;
54 }
55 
57  static PluginTerminateMap g_plugin_map;
58  return g_plugin_map;
59 }
60 
61 static bool PluginIsLoaded(const FileSpec &plugin_file_spec) {
62  std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
63  PluginTerminateMap &plugin_map = GetPluginMap();
64  return plugin_map.find(plugin_file_spec) != plugin_map.end();
65 }
66 
67 static void SetPluginInfo(const FileSpec &plugin_file_spec,
68  const PluginInfo &plugin_info) {
69  std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
70  PluginTerminateMap &plugin_map = GetPluginMap();
71  assert(plugin_map.find(plugin_file_spec) == plugin_map.end());
72  plugin_map[plugin_file_spec] = plugin_info;
73 }
74 
75 template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) {
76  return reinterpret_cast<FPtrTy>(VPtr);
77 }
78 
80 LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
81  llvm::StringRef path) {
82  Status error;
83 
84  namespace fs = llvm::sys::fs;
85  // If we have a regular file, a symbolic link or unknown file type, try and
86  // process the file. We must handle unknown as sometimes the directory
87  // enumeration might be enumerating a file system that doesn't have correct
88  // file type information.
89  if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file ||
90  ft == fs::file_type::type_unknown) {
91  FileSpec plugin_file_spec(path);
92  FileSystem::Instance().Resolve(plugin_file_spec);
93 
94  if (PluginIsLoaded(plugin_file_spec))
95  return FileSystem::eEnumerateDirectoryResultNext;
96  else {
97  PluginInfo plugin_info;
98 
99  std::string pluginLoadError;
100  plugin_info.library = llvm::sys::DynamicLibrary::getPermanentLibrary(
101  plugin_file_spec.GetPath().c_str(), &pluginLoadError);
102  if (plugin_info.library.isValid()) {
103  bool success = false;
104  plugin_info.plugin_init_callback = CastToFPtr<PluginInitCallback>(
105  plugin_info.library.getAddressOfSymbol("LLDBPluginInitialize"));
106  if (plugin_info.plugin_init_callback) {
107  // Call the plug-in "bool LLDBPluginInitialize(void)" function
108  success = plugin_info.plugin_init_callback();
109  }
110 
111  if (success) {
112  // It is ok for the "LLDBPluginTerminate" symbol to be nullptr
113  plugin_info.plugin_term_callback = CastToFPtr<PluginTermCallback>(
114  plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate"));
115  } else {
116  // The initialize function returned FALSE which means the plug-in
117  // might not be compatible, or might be too new or too old, or might
118  // not want to run on this machine. Set it to a default-constructed
119  // instance to invalidate it.
120  plugin_info = PluginInfo();
121  }
122 
123  // Regardless of success or failure, cache the plug-in load in our
124  // plug-in info so we don't try to load it again and again.
125  SetPluginInfo(plugin_file_spec, plugin_info);
126 
127  return FileSystem::eEnumerateDirectoryResultNext;
128  }
129  }
130  }
131 
132  if (ft == fs::file_type::directory_file ||
133  ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) {
134  // Try and recurse into anything that a directory or symbolic link. We must
135  // also do this for unknown as sometimes the directory enumeration might be
136  // enumerating a file system that doesn't have correct file type
137  // information.
138  return FileSystem::eEnumerateDirectoryResultEnter;
139  }
140 
141  return FileSystem::eEnumerateDirectoryResultNext;
142 }
143 
144 void PluginManager::Initialize() {
145  const bool find_directories = true;
146  const bool find_files = true;
147  const bool find_other = true;
148  char dir_path[PATH_MAX];
149  if (FileSpec dir_spec = HostInfo::GetSystemPluginDir()) {
150  if (FileSystem::Instance().Exists(dir_spec) &&
151  dir_spec.GetPath(dir_path, sizeof(dir_path))) {
152  FileSystem::Instance().EnumerateDirectory(dir_path, find_directories,
153  find_files, find_other,
154  LoadPluginCallback, nullptr);
155  }
156  }
157 
158  if (FileSpec dir_spec = HostInfo::GetUserPluginDir()) {
159  if (FileSystem::Instance().Exists(dir_spec) &&
160  dir_spec.GetPath(dir_path, sizeof(dir_path))) {
161  FileSystem::Instance().EnumerateDirectory(dir_path, find_directories,
162  find_files, find_other,
163  LoadPluginCallback, nullptr);
164  }
165  }
166 }
167 
168 void PluginManager::Terminate() {
169  std::lock_guard<std::recursive_mutex> guard(GetPluginMapMutex());
170  PluginTerminateMap &plugin_map = GetPluginMap();
171 
172  PluginTerminateMap::const_iterator pos, end = plugin_map.end();
173  for (pos = plugin_map.begin(); pos != end; ++pos) {
174  // Call the plug-in "void LLDBPluginTerminate (void)" function if there is
175  // one (if the symbol was not nullptr).
176  if (pos->second.library.isValid()) {
177  if (pos->second.plugin_term_callback)
178  pos->second.plugin_term_callback();
179  }
180  }
181  plugin_map.clear();
182 }
183 
184 template <typename Callback> struct PluginInstance {
185  typedef Callback CallbackType;
186 
187  PluginInstance() = default;
188  PluginInstance(llvm::StringRef name, llvm::StringRef description,
189  Callback create_callback,
190  DebuggerInitializeCallback debugger_init_callback = nullptr)
191  : name(name), description(description), create_callback(create_callback),
192  debugger_init_callback(debugger_init_callback) {}
193 
194  llvm::StringRef name;
195  llvm::StringRef description;
196  Callback create_callback;
198 };
199 
200 template <typename Instance> class PluginInstances {
201 public:
202  template <typename... Args>
203  bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
204  typename Instance::CallbackType callback,
205  Args &&...args) {
206  if (!callback)
207  return false;
208  assert(!name.empty());
209  Instance instance =
210  Instance(name, description, callback, std::forward<Args>(args)...);
211  m_instances.push_back(instance);
212  return false;
213  }
214 
215  bool UnregisterPlugin(typename Instance::CallbackType callback) {
216  if (!callback)
217  return false;
218  auto pos = m_instances.begin();
219  auto end = m_instances.end();
220  for (; pos != end; ++pos) {
221  if (pos->create_callback == callback) {
222  m_instances.erase(pos);
223  return true;
224  }
225  }
226  return false;
227  }
228 
229  typename Instance::CallbackType GetCallbackAtIndex(uint32_t idx) {
230  if (Instance *instance = GetInstanceAtIndex(idx))
231  return instance->create_callback;
232  return nullptr;
233  }
234 
235  llvm::StringRef GetDescriptionAtIndex(uint32_t idx) {
236  if (Instance *instance = GetInstanceAtIndex(idx))
237  return instance->description;
238  return "";
239  }
240 
241  llvm::StringRef GetNameAtIndex(uint32_t idx) {
242  if (Instance *instance = GetInstanceAtIndex(idx))
243  return instance->name;
244  return "";
245  }
246 
247  typename Instance::CallbackType GetCallbackForName(llvm::StringRef name) {
248  if (name.empty())
249  return nullptr;
250  for (auto &instance : m_instances) {
251  if (name == instance.name)
252  return instance.create_callback;
253  }
254  return nullptr;
255  }
256 
258  for (auto &instance : m_instances) {
259  if (instance.debugger_init_callback)
260  instance.debugger_init_callback(debugger);
261  }
262  }
263 
264  const std::vector<Instance> &GetInstances() const { return m_instances; }
265  std::vector<Instance> &GetInstances() { return m_instances; }
266 
267  Instance *GetInstanceAtIndex(uint32_t idx) {
268  if (idx < m_instances.size())
269  return &m_instances[idx];
270  return nullptr;
271  }
272 
273 private:
274  std::vector<Instance> m_instances;
275 };
276 
277 #pragma mark ABI
278 
281 
283  static ABIInstances g_instances;
284  return g_instances;
285 }
286 
287 bool PluginManager::RegisterPlugin(llvm::StringRef name,
288  llvm::StringRef description,
289  ABICreateInstance create_callback) {
290  return GetABIInstances().RegisterPlugin(name, description, create_callback);
291 }
292 
293 bool PluginManager::UnregisterPlugin(ABICreateInstance create_callback) {
294  return GetABIInstances().UnregisterPlugin(create_callback);
295 }
296 
297 ABICreateInstance PluginManager::GetABICreateCallbackAtIndex(uint32_t idx) {
298  return GetABIInstances().GetCallbackAtIndex(idx);
299 }
300 
301 #pragma mark Architecture
302 
304 typedef std::vector<ArchitectureInstance> ArchitectureInstances;
305 
307  static ArchitectureInstances g_instances;
308  return g_instances;
309 }
310 
311 void PluginManager::RegisterPlugin(llvm::StringRef name,
312  llvm::StringRef description,
313  ArchitectureCreateInstance create_callback) {
314  GetArchitectureInstances().push_back({name, description, create_callback});
315 }
316 
317 void PluginManager::UnregisterPlugin(
318  ArchitectureCreateInstance create_callback) {
319  auto &instances = GetArchitectureInstances();
320 
321  for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) {
322  if (pos->create_callback == create_callback) {
323  instances.erase(pos);
324  return;
325  }
326  }
327  llvm_unreachable("Plugin not found");
328 }
329 
330 std::unique_ptr<Architecture>
331 PluginManager::CreateArchitectureInstance(const ArchSpec &arch) {
332  for (const auto &instances : GetArchitectureInstances()) {
333  if (auto plugin_up = instances.create_callback(arch))
334  return plugin_up;
335  }
336  return nullptr;
337 }
338 
339 #pragma mark Disassembler
340 
343 
345  static DisassemblerInstances g_instances;
346  return g_instances;
347 }
348 
349 bool PluginManager::RegisterPlugin(llvm::StringRef name,
350  llvm::StringRef description,
351  DisassemblerCreateInstance create_callback) {
352  return GetDisassemblerInstances().RegisterPlugin(name, description,
353  create_callback);
354 }
355 
356 bool PluginManager::UnregisterPlugin(
357  DisassemblerCreateInstance create_callback) {
358  return GetDisassemblerInstances().UnregisterPlugin(create_callback);
359 }
360 
361 DisassemblerCreateInstance
362 PluginManager::GetDisassemblerCreateCallbackAtIndex(uint32_t idx) {
364 }
365 
366 DisassemblerCreateInstance
367 PluginManager::GetDisassemblerCreateCallbackForPluginName(
368  llvm::StringRef name) {
370 }
371 
372 #pragma mark DynamicLoader
373 
376 
378  static DynamicLoaderInstances g_instances;
379  return g_instances;
380 }
381 
382 bool PluginManager::RegisterPlugin(
383  llvm::StringRef name, llvm::StringRef description,
384  DynamicLoaderCreateInstance create_callback,
385  DebuggerInitializeCallback debugger_init_callback) {
387  name, description, create_callback, debugger_init_callback);
388 }
389 
390 bool PluginManager::UnregisterPlugin(
391  DynamicLoaderCreateInstance create_callback) {
392  return GetDynamicLoaderInstances().UnregisterPlugin(create_callback);
393 }
394 
395 DynamicLoaderCreateInstance
396 PluginManager::GetDynamicLoaderCreateCallbackAtIndex(uint32_t idx) {
398 }
399 
400 DynamicLoaderCreateInstance
401 PluginManager::GetDynamicLoaderCreateCallbackForPluginName(
402  llvm::StringRef name) {
404 }
405 
406 #pragma mark JITLoader
407 
410 
412  static JITLoaderInstances g_instances;
413  return g_instances;
414 }
415 
416 bool PluginManager::RegisterPlugin(
417  llvm::StringRef name, llvm::StringRef description,
418  JITLoaderCreateInstance create_callback,
419  DebuggerInitializeCallback debugger_init_callback) {
421  name, description, create_callback, debugger_init_callback);
422 }
423 
424 bool PluginManager::UnregisterPlugin(JITLoaderCreateInstance create_callback) {
425  return GetJITLoaderInstances().UnregisterPlugin(create_callback);
426 }
427 
428 JITLoaderCreateInstance
429 PluginManager::GetJITLoaderCreateCallbackAtIndex(uint32_t idx) {
431 }
432 
433 #pragma mark EmulateInstruction
434 
438 
440  static EmulateInstructionInstances g_instances;
441  return g_instances;
442 }
443 
444 bool PluginManager::RegisterPlugin(
445  llvm::StringRef name, llvm::StringRef description,
446  EmulateInstructionCreateInstance create_callback) {
447  return GetEmulateInstructionInstances().RegisterPlugin(name, description,
448  create_callback);
449 }
450 
451 bool PluginManager::UnregisterPlugin(
452  EmulateInstructionCreateInstance create_callback) {
453  return GetEmulateInstructionInstances().UnregisterPlugin(create_callback);
454 }
455 
456 EmulateInstructionCreateInstance
457 PluginManager::GetEmulateInstructionCreateCallbackAtIndex(uint32_t idx) {
459 }
460 
461 EmulateInstructionCreateInstance
462 PluginManager::GetEmulateInstructionCreateCallbackForPluginName(
463  llvm::StringRef name) {
465 }
466 
467 #pragma mark OperatingSystem
468 
471 
473  static OperatingSystemInstances g_instances;
474  return g_instances;
475 }
476 
477 bool PluginManager::RegisterPlugin(
478  llvm::StringRef name, llvm::StringRef description,
479  OperatingSystemCreateInstance create_callback,
480  DebuggerInitializeCallback debugger_init_callback) {
482  name, description, create_callback, debugger_init_callback);
483 }
484 
485 bool PluginManager::UnregisterPlugin(
486  OperatingSystemCreateInstance create_callback) {
487  return GetOperatingSystemInstances().UnregisterPlugin(create_callback);
488 }
489 
490 OperatingSystemCreateInstance
491 PluginManager::GetOperatingSystemCreateCallbackAtIndex(uint32_t idx) {
493 }
494 
495 OperatingSystemCreateInstance
496 PluginManager::GetOperatingSystemCreateCallbackForPluginName(
497  llvm::StringRef name) {
499 }
500 
501 #pragma mark Language
502 
505 
507  static LanguageInstances g_instances;
508  return g_instances;
509 }
510 
511 bool PluginManager::RegisterPlugin(llvm::StringRef name,
512  llvm::StringRef description,
513  LanguageCreateInstance create_callback) {
514  return GetLanguageInstances().RegisterPlugin(name, description,
515  create_callback);
516 }
517 
518 bool PluginManager::UnregisterPlugin(LanguageCreateInstance create_callback) {
519  return GetLanguageInstances().UnregisterPlugin(create_callback);
520 }
521 
522 LanguageCreateInstance
523 PluginManager::GetLanguageCreateCallbackAtIndex(uint32_t idx) {
525 }
526 
527 #pragma mark LanguageRuntime
528 
530  : public PluginInstance<LanguageRuntimeCreateInstance> {
532  llvm::StringRef name, llvm::StringRef description,
533  CallbackType create_callback,
534  DebuggerInitializeCallback debugger_init_callback,
535  LanguageRuntimeGetCommandObject command_callback,
536  LanguageRuntimeGetExceptionPrecondition precondition_callback)
538  name, description, create_callback, debugger_init_callback),
539  command_callback(command_callback),
540  precondition_callback(precondition_callback) {}
541 
542  LanguageRuntimeGetCommandObject command_callback;
543  LanguageRuntimeGetExceptionPrecondition precondition_callback;
544 };
545 
547 
549  static LanguageRuntimeInstances g_instances;
550  return g_instances;
551 }
552 
553 bool PluginManager::RegisterPlugin(
554  llvm::StringRef name, llvm::StringRef description,
555  LanguageRuntimeCreateInstance create_callback,
556  LanguageRuntimeGetCommandObject command_callback,
557  LanguageRuntimeGetExceptionPrecondition precondition_callback) {
559  name, description, create_callback, nullptr, command_callback,
560  precondition_callback);
561 }
562 
563 bool PluginManager::UnregisterPlugin(
564  LanguageRuntimeCreateInstance create_callback) {
565  return GetLanguageRuntimeInstances().UnregisterPlugin(create_callback);
566 }
567 
569 PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(uint32_t idx) {
571 }
572 
573 LanguageRuntimeGetCommandObject
574 PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx) {
575  const auto &instances = GetLanguageRuntimeInstances().GetInstances();
576  if (idx < instances.size())
577  return instances[idx].command_callback;
578  return nullptr;
579 }
580 
581 LanguageRuntimeGetExceptionPrecondition
582 PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx) {
583  const auto &instances = GetLanguageRuntimeInstances().GetInstances();
584  if (idx < instances.size())
585  return instances[idx].precondition_callback;
586  return nullptr;
587 }
588 
589 #pragma mark SystemRuntime
590 
593 
595  static SystemRuntimeInstances g_instances;
596  return g_instances;
597 }
598 
599 bool PluginManager::RegisterPlugin(
600  llvm::StringRef name, llvm::StringRef description,
601  SystemRuntimeCreateInstance create_callback) {
602  return GetSystemRuntimeInstances().RegisterPlugin(name, description,
603  create_callback);
604 }
605 
606 bool PluginManager::UnregisterPlugin(
607  SystemRuntimeCreateInstance create_callback) {
608  return GetSystemRuntimeInstances().UnregisterPlugin(create_callback);
609 }
610 
611 SystemRuntimeCreateInstance
612 PluginManager::GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx) {
614 }
615 
616 #pragma mark ObjectFile
617 
618 struct ObjectFileInstance : public PluginInstance<ObjectFileCreateInstance> {
620  llvm::StringRef name, llvm::StringRef description,
621  CallbackType create_callback,
622  ObjectFileCreateMemoryInstance create_memory_callback,
623  ObjectFileGetModuleSpecifications get_module_specifications,
624  ObjectFileSaveCore save_core,
625  DebuggerInitializeCallback debugger_init_callback)
627  name, description, create_callback, debugger_init_callback),
628  create_memory_callback(create_memory_callback),
629  get_module_specifications(get_module_specifications),
630  save_core(save_core) {}
631 
632  ObjectFileCreateMemoryInstance create_memory_callback;
633  ObjectFileGetModuleSpecifications get_module_specifications;
634  ObjectFileSaveCore save_core;
635 };
637 
639  static ObjectFileInstances g_instances;
640  return g_instances;
641 }
642 
643 bool PluginManager::RegisterPlugin(
644  llvm::StringRef name, llvm::StringRef description,
645  ObjectFileCreateInstance create_callback,
646  ObjectFileCreateMemoryInstance create_memory_callback,
647  ObjectFileGetModuleSpecifications get_module_specifications,
648  ObjectFileSaveCore save_core,
649  DebuggerInitializeCallback debugger_init_callback) {
651  name, description, create_callback, create_memory_callback,
652  get_module_specifications, save_core, debugger_init_callback);
653 }
654 
655 bool PluginManager::UnregisterPlugin(ObjectFileCreateInstance create_callback) {
656  return GetObjectFileInstances().UnregisterPlugin(create_callback);
657 }
658 
660 PluginManager::GetObjectFileCreateCallbackAtIndex(uint32_t idx) {
662 }
663 
664 ObjectFileCreateMemoryInstance
665 PluginManager::GetObjectFileCreateMemoryCallbackAtIndex(uint32_t idx) {
666  const auto &instances = GetObjectFileInstances().GetInstances();
667  if (idx < instances.size())
668  return instances[idx].create_memory_callback;
669  return nullptr;
670 }
671 
672 ObjectFileGetModuleSpecifications
673 PluginManager::GetObjectFileGetModuleSpecificationsCallbackAtIndex(
674  uint32_t idx) {
675  const auto &instances = GetObjectFileInstances().GetInstances();
676  if (idx < instances.size())
677  return instances[idx].get_module_specifications;
678  return nullptr;
679 }
680 
681 ObjectFileCreateMemoryInstance
682 PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
683  llvm::StringRef name) {
684  const auto &instances = GetObjectFileInstances().GetInstances();
685  for (auto &instance : instances) {
686  if (instance.name == name)
687  return instance.create_memory_callback;
688  }
689  return nullptr;
690 }
691 
692 Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
693  const FileSpec &outfile,
694  lldb::SaveCoreStyle &core_style,
695  llvm::StringRef plugin_name) {
696  if (plugin_name.empty()) {
697  // Try saving core directly from the process plugin first.
698  llvm::Expected<bool> ret = process_sp->SaveCore(outfile.GetPath());
699  if (!ret)
700  return Status(ret.takeError());
701  if (ret.get())
702  return Status();
703  }
704 
705  // Fall back to object plugins.
706  Status error;
707  auto &instances = GetObjectFileInstances().GetInstances();
708  for (auto &instance : instances) {
709  if (plugin_name.empty() || instance.name == plugin_name) {
710  if (instance.save_core &&
711  instance.save_core(process_sp, outfile, core_style, error))
712  return error;
713  }
714  }
715  error.SetErrorString(
716  "no ObjectFile plugins were able to save a core for this process");
717  return error;
718 }
719 
720 #pragma mark ObjectContainer
721 
723  : public PluginInstance<ObjectContainerCreateInstance> {
725  llvm::StringRef name, llvm::StringRef description,
726  CallbackType create_callback,
727  ObjectContainerCreateMemoryInstance create_memory_callback,
728  ObjectFileGetModuleSpecifications get_module_specifications)
729  : PluginInstance<ObjectContainerCreateInstance>(name, description,
730  create_callback),
731  create_memory_callback(create_memory_callback),
732  get_module_specifications(get_module_specifications) {}
733 
734  ObjectContainerCreateMemoryInstance create_memory_callback;
735  ObjectFileGetModuleSpecifications get_module_specifications;
736 };
738 
740  static ObjectContainerInstances g_instances;
741  return g_instances;
742 }
743 
744 bool PluginManager::RegisterPlugin(
745  llvm::StringRef name, llvm::StringRef description,
746  ObjectContainerCreateInstance create_callback,
747  ObjectFileGetModuleSpecifications get_module_specifications,
748  ObjectContainerCreateMemoryInstance create_memory_callback) {
750  name, description, create_callback, create_memory_callback,
751  get_module_specifications);
752 }
753 
754 bool PluginManager::UnregisterPlugin(
755  ObjectContainerCreateInstance create_callback) {
756  return GetObjectContainerInstances().UnregisterPlugin(create_callback);
757 }
758 
760 PluginManager::GetObjectContainerCreateCallbackAtIndex(uint32_t idx) {
762 }
763 
764 ObjectContainerCreateMemoryInstance
765 PluginManager::GetObjectContainerCreateMemoryCallbackAtIndex(uint32_t idx) {
766  const auto &instances = GetObjectContainerInstances().GetInstances();
767  if (idx < instances.size())
768  return instances[idx].create_memory_callback;
769  return nullptr;
770 }
771 
772 ObjectFileGetModuleSpecifications
773 PluginManager::GetObjectContainerGetModuleSpecificationsCallbackAtIndex(
774  uint32_t idx) {
775  const auto &instances = GetObjectContainerInstances().GetInstances();
776  if (idx < instances.size())
777  return instances[idx].get_module_specifications;
778  return nullptr;
779 }
780 
781 #pragma mark Platform
782 
785 
787  static PlatformInstances g_platform_instances;
788  return g_platform_instances;
789 }
790 
791 bool PluginManager::RegisterPlugin(
792  llvm::StringRef name, llvm::StringRef description,
793  PlatformCreateInstance create_callback,
794  DebuggerInitializeCallback debugger_init_callback) {
796  name, description, create_callback, debugger_init_callback);
797 }
798 
799 bool PluginManager::UnregisterPlugin(PlatformCreateInstance create_callback) {
800  return GetPlatformInstances().UnregisterPlugin(create_callback);
801 }
802 
803 llvm::StringRef PluginManager::GetPlatformPluginNameAtIndex(uint32_t idx) {
804  return GetPlatformInstances().GetNameAtIndex(idx);
805 }
806 
807 llvm::StringRef
808 PluginManager::GetPlatformPluginDescriptionAtIndex(uint32_t idx) {
810 }
811 
812 PlatformCreateInstance
813 PluginManager::GetPlatformCreateCallbackAtIndex(uint32_t idx) {
815 }
816 
817 PlatformCreateInstance
818 PluginManager::GetPlatformCreateCallbackForPluginName(llvm::StringRef name) {
820 }
821 
822 void PluginManager::AutoCompletePlatformName(llvm::StringRef name,
823  CompletionRequest &request) {
824  for (const auto &instance : GetPlatformInstances().GetInstances()) {
825  if (instance.name.startswith(name))
826  request.AddCompletion(instance.name);
827  }
828 }
829 
830 #pragma mark Process
831 
834 
836  static ProcessInstances g_instances;
837  return g_instances;
838 }
839 
840 bool PluginManager::RegisterPlugin(
841  llvm::StringRef name, llvm::StringRef description,
842  ProcessCreateInstance create_callback,
843  DebuggerInitializeCallback debugger_init_callback) {
845  name, description, create_callback, debugger_init_callback);
846 }
847 
848 bool PluginManager::UnregisterPlugin(ProcessCreateInstance create_callback) {
849  return GetProcessInstances().UnregisterPlugin(create_callback);
850 }
851 
852 llvm::StringRef PluginManager::GetProcessPluginNameAtIndex(uint32_t idx) {
853  return GetProcessInstances().GetNameAtIndex(idx);
854 }
855 
856 llvm::StringRef PluginManager::GetProcessPluginDescriptionAtIndex(uint32_t idx) {
858 }
859 
860 ProcessCreateInstance
861 PluginManager::GetProcessCreateCallbackAtIndex(uint32_t idx) {
863 }
864 
865 ProcessCreateInstance
866 PluginManager::GetProcessCreateCallbackForPluginName(llvm::StringRef name) {
868 }
869 
870 void PluginManager::AutoCompleteProcessName(llvm::StringRef name,
871  CompletionRequest &request) {
872  for (const auto &instance : GetProcessInstances().GetInstances()) {
873  if (instance.name.startswith(name))
874  request.AddCompletion(instance.name, instance.description);
875  }
876 }
877 
878 #pragma mark ScriptInterpreter
879 
881  : public PluginInstance<ScriptInterpreterCreateInstance> {
882  ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description,
883  CallbackType create_callback,
884  lldb::ScriptLanguage language)
885  : PluginInstance<ScriptInterpreterCreateInstance>(name, description,
886  create_callback),
887  language(language) {}
888 
890 };
891 
893 
895  static ScriptInterpreterInstances g_instances;
896  return g_instances;
897 }
898 
899 bool PluginManager::RegisterPlugin(
900  llvm::StringRef name, llvm::StringRef description,
901  lldb::ScriptLanguage script_language,
902  ScriptInterpreterCreateInstance create_callback) {
904  name, description, create_callback, script_language);
905 }
906 
907 bool PluginManager::UnregisterPlugin(
908  ScriptInterpreterCreateInstance create_callback) {
909  return GetScriptInterpreterInstances().UnregisterPlugin(create_callback);
910 }
911 
913 PluginManager::GetScriptInterpreterCreateCallbackAtIndex(uint32_t idx) {
915 }
916 
917 lldb::ScriptInterpreterSP
918 PluginManager::GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
919  Debugger &debugger) {
920  const auto &instances = GetScriptInterpreterInstances().GetInstances();
921  ScriptInterpreterCreateInstance none_instance = nullptr;
922  for (const auto &instance : instances) {
923  if (instance.language == lldb::eScriptLanguageNone)
924  none_instance = instance.create_callback;
925 
926  if (script_lang == instance.language)
927  return instance.create_callback(debugger);
928  }
929 
930  // If we didn't find one, return the ScriptInterpreter for the null language.
931  assert(none_instance != nullptr);
932  return none_instance(debugger);
933 }
934 
935 #pragma mark StructuredDataPlugin
936 
938  : public PluginInstance<StructuredDataPluginCreateInstance> {
940  llvm::StringRef name, llvm::StringRef description,
941  CallbackType create_callback,
942  DebuggerInitializeCallback debugger_init_callback,
943  StructuredDataFilterLaunchInfo filter_callback)
945  name, description, create_callback, debugger_init_callback),
946  filter_callback(filter_callback) {}
947 
948  StructuredDataFilterLaunchInfo filter_callback = nullptr;
949 };
950 
953 
955  static StructuredDataPluginInstances g_instances;
956  return g_instances;
957 }
958 
959 bool PluginManager::RegisterPlugin(
960  llvm::StringRef name, llvm::StringRef description,
961  StructuredDataPluginCreateInstance create_callback,
962  DebuggerInitializeCallback debugger_init_callback,
963  StructuredDataFilterLaunchInfo filter_callback) {
965  name, description, create_callback, debugger_init_callback,
966  filter_callback);
967 }
968 
969 bool PluginManager::UnregisterPlugin(
970  StructuredDataPluginCreateInstance create_callback) {
971  return GetStructuredDataPluginInstances().UnregisterPlugin(create_callback);
972 }
973 
975 PluginManager::GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx) {
977 }
978 
979 StructuredDataFilterLaunchInfo
980 PluginManager::GetStructuredDataFilterCallbackAtIndex(
981  uint32_t idx, bool &iteration_complete) {
982  const auto &instances = GetStructuredDataPluginInstances().GetInstances();
983  if (idx < instances.size()) {
984  iteration_complete = false;
985  return instances[idx].filter_callback;
986  } else {
987  iteration_complete = true;
988  }
989  return nullptr;
990 }
991 
992 #pragma mark SymbolFile
993 
996 
998  static SymbolFileInstances g_instances;
999  return g_instances;
1000 }
1001 
1002 bool PluginManager::RegisterPlugin(
1003  llvm::StringRef name, llvm::StringRef description,
1004  SymbolFileCreateInstance create_callback,
1005  DebuggerInitializeCallback debugger_init_callback) {
1007  name, description, create_callback, debugger_init_callback);
1008 }
1009 
1010 bool PluginManager::UnregisterPlugin(SymbolFileCreateInstance create_callback) {
1011  return GetSymbolFileInstances().UnregisterPlugin(create_callback);
1012 }
1013 
1014 SymbolFileCreateInstance
1015 PluginManager::GetSymbolFileCreateCallbackAtIndex(uint32_t idx) {
1017 }
1018 
1019 #pragma mark SymbolVendor
1020 
1023 
1025  static SymbolVendorInstances g_instances;
1026  return g_instances;
1027 }
1028 
1029 bool PluginManager::RegisterPlugin(llvm::StringRef name,
1030  llvm::StringRef description,
1031  SymbolVendorCreateInstance create_callback) {
1032  return GetSymbolVendorInstances().RegisterPlugin(name, description,
1033  create_callback);
1034 }
1035 
1036 bool PluginManager::UnregisterPlugin(
1037  SymbolVendorCreateInstance create_callback) {
1038  return GetSymbolVendorInstances().UnregisterPlugin(create_callback);
1039 }
1040 
1041 SymbolVendorCreateInstance
1042 PluginManager::GetSymbolVendorCreateCallbackAtIndex(uint32_t idx) {
1044 }
1045 
1046 #pragma mark Trace
1047 
1049  : public PluginInstance<TraceCreateInstanceFromBundle> {
1051  llvm::StringRef name, llvm::StringRef description,
1052  CallbackType create_callback_from_bundle,
1053  TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1054  llvm::StringRef schema)
1056  name, description, create_callback_from_bundle),
1057  schema(schema),
1058  create_callback_for_live_process(create_callback_for_live_process) {}
1059 
1060  llvm::StringRef schema;
1061  TraceCreateInstanceForLiveProcess create_callback_for_live_process;
1062 };
1063 
1065 
1067  static TraceInstances g_instances;
1068  return g_instances;
1069 }
1070 
1071 bool PluginManager::RegisterPlugin(
1072  llvm::StringRef name, llvm::StringRef description,
1073  TraceCreateInstanceFromBundle create_callback_from_bundle,
1074  TraceCreateInstanceForLiveProcess create_callback_for_live_process,
1075  llvm::StringRef schema) {
1077  name, description, create_callback_from_bundle,
1078  create_callback_for_live_process, schema);
1079 }
1080 
1081 bool PluginManager::UnregisterPlugin(
1082  TraceCreateInstanceFromBundle create_callback_from_bundle) {
1084  create_callback_from_bundle);
1085 }
1086 
1088 PluginManager::GetTraceCreateCallback(llvm::StringRef plugin_name) {
1089  return GetTracePluginInstances().GetCallbackForName(plugin_name);
1090 }
1091 
1092 TraceCreateInstanceForLiveProcess
1093 PluginManager::GetTraceCreateCallbackForLiveProcess(llvm::StringRef plugin_name) {
1094  for (const TraceInstance &instance : GetTracePluginInstances().GetInstances())
1095  if (instance.name == plugin_name)
1096  return instance.create_callback_for_live_process;
1097  return nullptr;
1098 }
1099 
1100 llvm::StringRef PluginManager::GetTraceSchema(llvm::StringRef plugin_name) {
1101  for (const TraceInstance &instance : GetTracePluginInstances().GetInstances())
1102  if (instance.name == plugin_name)
1103  return instance.schema;
1104  return llvm::StringRef();
1105 }
1106 
1107 llvm::StringRef PluginManager::GetTraceSchema(size_t index) {
1108  if (TraceInstance *instance =
1109  GetTracePluginInstances().GetInstanceAtIndex(index))
1110  return instance->schema;
1111  return llvm::StringRef();
1112 }
1113 
1114 #pragma mark TraceExporter
1115 
1117  : public PluginInstance<TraceExporterCreateInstance> {
1119  llvm::StringRef name, llvm::StringRef description,
1120  TraceExporterCreateInstance create_instance,
1121  ThreadTraceExportCommandCreator create_thread_trace_export_command)
1122  : PluginInstance<TraceExporterCreateInstance>(name, description,
1123  create_instance),
1124  create_thread_trace_export_command(create_thread_trace_export_command) {
1125  }
1126 
1127  ThreadTraceExportCommandCreator create_thread_trace_export_command;
1128 };
1129 
1131 
1133  static TraceExporterInstances g_instances;
1134  return g_instances;
1135 }
1136 
1137 bool PluginManager::RegisterPlugin(
1138  llvm::StringRef name, llvm::StringRef description,
1139  TraceExporterCreateInstance create_callback,
1140  ThreadTraceExportCommandCreator create_thread_trace_export_command) {
1142  name, description, create_callback, create_thread_trace_export_command);
1143 }
1144 
1146 PluginManager::GetTraceExporterCreateCallback(llvm::StringRef plugin_name) {
1147  return GetTraceExporterInstances().GetCallbackForName(plugin_name);
1148 }
1149 
1150 bool PluginManager::UnregisterPlugin(
1151  TraceExporterCreateInstance create_callback) {
1152  return GetTraceExporterInstances().UnregisterPlugin(create_callback);
1153 }
1154 
1155 ThreadTraceExportCommandCreator
1156 PluginManager::GetThreadTraceExportCommandCreatorAtIndex(uint32_t index) {
1157  if (TraceExporterInstance *instance =
1158  GetTraceExporterInstances().GetInstanceAtIndex(index))
1159  return instance->create_thread_trace_export_command;
1160  return nullptr;
1161 }
1162 
1163 llvm::StringRef
1164 PluginManager::GetTraceExporterPluginNameAtIndex(uint32_t index) {
1165  return GetTraceExporterInstances().GetNameAtIndex(index);
1166 }
1167 
1168 #pragma mark UnwindAssembly
1169 
1172 
1174  static UnwindAssemblyInstances g_instances;
1175  return g_instances;
1176 }
1177 
1178 bool PluginManager::RegisterPlugin(
1179  llvm::StringRef name, llvm::StringRef description,
1180  UnwindAssemblyCreateInstance create_callback) {
1181  return GetUnwindAssemblyInstances().RegisterPlugin(name, description,
1182  create_callback);
1183 }
1184 
1185 bool PluginManager::UnregisterPlugin(
1186  UnwindAssemblyCreateInstance create_callback) {
1187  return GetUnwindAssemblyInstances().UnregisterPlugin(create_callback);
1188 }
1189 
1190 UnwindAssemblyCreateInstance
1191 PluginManager::GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx) {
1193 }
1194 
1195 #pragma mark MemoryHistory
1196 
1199 
1201  static MemoryHistoryInstances g_instances;
1202  return g_instances;
1203 }
1204 
1205 bool PluginManager::RegisterPlugin(
1206  llvm::StringRef name, llvm::StringRef description,
1207  MemoryHistoryCreateInstance create_callback) {
1208  return GetMemoryHistoryInstances().RegisterPlugin(name, description,
1209  create_callback);
1210 }
1211 
1212 bool PluginManager::UnregisterPlugin(
1213  MemoryHistoryCreateInstance create_callback) {
1214  return GetMemoryHistoryInstances().UnregisterPlugin(create_callback);
1215 }
1216 
1217 MemoryHistoryCreateInstance
1218 PluginManager::GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx) {
1220 }
1221 
1222 #pragma mark InstrumentationRuntime
1223 
1225  : public PluginInstance<InstrumentationRuntimeCreateInstance> {
1227  llvm::StringRef name, llvm::StringRef description,
1228  CallbackType create_callback,
1229  InstrumentationRuntimeGetType get_type_callback)
1231  create_callback),
1232  get_type_callback(get_type_callback) {}
1233 
1234  InstrumentationRuntimeGetType get_type_callback = nullptr;
1235 };
1236 
1239 
1241  static InstrumentationRuntimeInstances g_instances;
1242  return g_instances;
1243 }
1244 
1245 bool PluginManager::RegisterPlugin(
1246  llvm::StringRef name, llvm::StringRef description,
1247  InstrumentationRuntimeCreateInstance create_callback,
1248  InstrumentationRuntimeGetType get_type_callback) {
1250  name, description, create_callback, get_type_callback);
1251 }
1252 
1253 bool PluginManager::UnregisterPlugin(
1254  InstrumentationRuntimeCreateInstance create_callback) {
1255  return GetInstrumentationRuntimeInstances().UnregisterPlugin(create_callback);
1256 }
1257 
1258 InstrumentationRuntimeGetType
1259 PluginManager::GetInstrumentationRuntimeGetTypeCallbackAtIndex(uint32_t idx) {
1260  const auto &instances = GetInstrumentationRuntimeInstances().GetInstances();
1261  if (idx < instances.size())
1262  return instances[idx].get_type_callback;
1263  return nullptr;
1264 }
1265 
1267 PluginManager::GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx) {
1269 }
1270 
1271 #pragma mark TypeSystem
1272 
1273 struct TypeSystemInstance : public PluginInstance<TypeSystemCreateInstance> {
1274  TypeSystemInstance(llvm::StringRef name, llvm::StringRef description,
1275  CallbackType create_callback,
1276  LanguageSet supported_languages_for_types,
1277  LanguageSet supported_languages_for_expressions)
1278  : PluginInstance<TypeSystemCreateInstance>(name, description,
1279  create_callback),
1280  supported_languages_for_types(supported_languages_for_types),
1281  supported_languages_for_expressions(
1282  supported_languages_for_expressions) {}
1283 
1286 };
1287 
1289 
1291  static TypeSystemInstances g_instances;
1292  return g_instances;
1293 }
1294 
1295 bool PluginManager::RegisterPlugin(
1296  llvm::StringRef name, llvm::StringRef description,
1297  TypeSystemCreateInstance create_callback,
1298  LanguageSet supported_languages_for_types,
1299  LanguageSet supported_languages_for_expressions) {
1301  name, description, create_callback, supported_languages_for_types,
1302  supported_languages_for_expressions);
1303 }
1304 
1305 bool PluginManager::UnregisterPlugin(TypeSystemCreateInstance create_callback) {
1306  return GetTypeSystemInstances().UnregisterPlugin(create_callback);
1307 }
1308 
1310 PluginManager::GetTypeSystemCreateCallbackAtIndex(uint32_t idx) {
1312 }
1313 
1314 LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForTypes() {
1315  const auto &instances = GetTypeSystemInstances().GetInstances();
1316  LanguageSet all;
1317  for (unsigned i = 0; i < instances.size(); ++i)
1318  all.bitvector |= instances[i].supported_languages_for_types.bitvector;
1319  return all;
1320 }
1321 
1322 LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForExpressions() {
1323  const auto &instances = GetTypeSystemInstances().GetInstances();
1324  LanguageSet all;
1325  for (unsigned i = 0; i < instances.size(); ++i)
1326  all.bitvector |= instances[i].supported_languages_for_expressions.bitvector;
1327  return all;
1328 }
1329 
1330 #pragma mark REPL
1331 
1332 struct REPLInstance : public PluginInstance<REPLCreateInstance> {
1333  REPLInstance(llvm::StringRef name, llvm::StringRef description,
1334  CallbackType create_callback, LanguageSet supported_languages)
1335  : PluginInstance<REPLCreateInstance>(name, description, create_callback),
1336  supported_languages(supported_languages) {}
1337 
1339 };
1340 
1342 
1344  static REPLInstances g_instances;
1345  return g_instances;
1346 }
1347 
1348 bool PluginManager::RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
1349  REPLCreateInstance create_callback,
1350  LanguageSet supported_languages) {
1351  return GetREPLInstances().RegisterPlugin(name, description, create_callback,
1352  supported_languages);
1353 }
1354 
1355 bool PluginManager::UnregisterPlugin(REPLCreateInstance create_callback) {
1356  return GetREPLInstances().UnregisterPlugin(create_callback);
1357 }
1358 
1359 REPLCreateInstance PluginManager::GetREPLCreateCallbackAtIndex(uint32_t idx) {
1360  return GetREPLInstances().GetCallbackAtIndex(idx);
1361 }
1362 
1363 LanguageSet PluginManager::GetREPLSupportedLanguagesAtIndex(uint32_t idx) {
1364  const auto &instances = GetREPLInstances().GetInstances();
1365  return idx < instances.size() ? instances[idx].supported_languages
1366  : LanguageSet();
1367 }
1368 
1369 LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
1370  const auto &instances = GetREPLInstances().GetInstances();
1371  LanguageSet all;
1372  for (unsigned i = 0; i < instances.size(); ++i)
1373  all.bitvector |= instances[i].supported_languages.bitvector;
1374  return all;
1375 }
1376 
1377 #pragma mark PluginManager
1378 
1379 void PluginManager::DebuggerInitialize(Debugger &debugger) {
1389 }
1390 
1391 // This is the preferred new way to register plugin specific settings. e.g.
1392 // This will put a plugin's settings under e.g.
1393 // "plugin.<plugin_type_name>.<plugin_type_desc>.SETTINGNAME".
1394 static lldb::OptionValuePropertiesSP
1396  ConstString plugin_type_desc, bool can_create) {
1397  lldb::OptionValuePropertiesSP parent_properties_sp(
1398  debugger.GetValueProperties());
1399  if (parent_properties_sp) {
1400  static ConstString g_property_name("plugin");
1401 
1402  OptionValuePropertiesSP plugin_properties_sp =
1403  parent_properties_sp->GetSubProperty(nullptr, g_property_name);
1404  if (!plugin_properties_sp && can_create) {
1405  plugin_properties_sp =
1406  std::make_shared<OptionValueProperties>(g_property_name);
1407  parent_properties_sp->AppendProperty(
1408  g_property_name, ConstString("Settings specify to plugins."), true,
1409  plugin_properties_sp);
1410  }
1411 
1412  if (plugin_properties_sp) {
1413  lldb::OptionValuePropertiesSP plugin_type_properties_sp =
1414  plugin_properties_sp->GetSubProperty(nullptr, plugin_type_name);
1415  if (!plugin_type_properties_sp && can_create) {
1416  plugin_type_properties_sp =
1417  std::make_shared<OptionValueProperties>(plugin_type_name);
1418  plugin_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
1419  true, plugin_type_properties_sp);
1420  }
1421  return plugin_type_properties_sp;
1422  }
1423  }
1424  return lldb::OptionValuePropertiesSP();
1425 }
1426 
1427 // This is deprecated way to register plugin specific settings. e.g.
1428 // "<plugin_type_name>.plugin.<plugin_type_desc>.SETTINGNAME" and Platform
1429 // generic settings would be under "platform.SETTINGNAME".
1430 static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(
1431  Debugger &debugger, ConstString plugin_type_name,
1432  ConstString plugin_type_desc, bool can_create) {
1433  static ConstString g_property_name("plugin");
1434  lldb::OptionValuePropertiesSP parent_properties_sp(
1435  debugger.GetValueProperties());
1436  if (parent_properties_sp) {
1437  OptionValuePropertiesSP plugin_properties_sp =
1438  parent_properties_sp->GetSubProperty(nullptr, plugin_type_name);
1439  if (!plugin_properties_sp && can_create) {
1440  plugin_properties_sp =
1441  std::make_shared<OptionValueProperties>(plugin_type_name);
1442  parent_properties_sp->AppendProperty(plugin_type_name, plugin_type_desc,
1443  true, plugin_properties_sp);
1444  }
1445 
1446  if (plugin_properties_sp) {
1447  lldb::OptionValuePropertiesSP plugin_type_properties_sp =
1448  plugin_properties_sp->GetSubProperty(nullptr, g_property_name);
1449  if (!plugin_type_properties_sp && can_create) {
1450  plugin_type_properties_sp =
1451  std::make_shared<OptionValueProperties>(g_property_name);
1452  plugin_properties_sp->AppendProperty(
1453  g_property_name, ConstString("Settings specific to plugins"), true,
1454  plugin_type_properties_sp);
1455  }
1456  return plugin_type_properties_sp;
1457  }
1458  }
1459  return lldb::OptionValuePropertiesSP();
1460 }
1461 
1462 namespace {
1463 
1464 typedef lldb::OptionValuePropertiesSP
1465 GetDebuggerPropertyForPluginsPtr(Debugger &, ConstString, ConstString,
1466  bool can_create);
1467 }
1468 
1469 static lldb::OptionValuePropertiesSP
1470 GetSettingForPlugin(Debugger &debugger, ConstString setting_name,
1471  ConstString plugin_type_name,
1472  GetDebuggerPropertyForPluginsPtr get_debugger_property =
1474  lldb::OptionValuePropertiesSP properties_sp;
1475  lldb::OptionValuePropertiesSP plugin_type_properties_sp(get_debugger_property(
1476  debugger, plugin_type_name,
1477  ConstString(), // not creating to so we don't need the description
1478  false));
1479  if (plugin_type_properties_sp)
1480  properties_sp =
1481  plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
1482  return properties_sp;
1483 }
1484 
1485 static bool
1486 CreateSettingForPlugin(Debugger &debugger, ConstString plugin_type_name,
1487  ConstString plugin_type_desc,
1488  const lldb::OptionValuePropertiesSP &properties_sp,
1489  ConstString description, bool is_global_property,
1490  GetDebuggerPropertyForPluginsPtr get_debugger_property =
1492  if (properties_sp) {
1493  lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1494  get_debugger_property(debugger, plugin_type_name, plugin_type_desc,
1495  true));
1496  if (plugin_type_properties_sp) {
1497  plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
1498  description, is_global_property,
1499  properties_sp);
1500  return true;
1501  }
1502  }
1503  return false;
1504 }
1505 
1506 static const char *kDynamicLoaderPluginName("dynamic-loader");
1507 static const char *kPlatformPluginName("platform");
1508 static const char *kProcessPluginName("process");
1509 static const char *kObjectFilePluginName("object-file");
1510 static const char *kSymbolFilePluginName("symbol-file");
1511 static const char *kJITLoaderPluginName("jit-loader");
1512 static const char *kStructuredDataPluginName("structured-data");
1513 
1514 lldb::OptionValuePropertiesSP
1515 PluginManager::GetSettingForDynamicLoaderPlugin(Debugger &debugger,
1516  ConstString setting_name) {
1517  return GetSettingForPlugin(debugger, setting_name,
1519 }
1520 
1521 bool PluginManager::CreateSettingForDynamicLoaderPlugin(
1522  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1523  ConstString description, bool is_global_property) {
1524  return CreateSettingForPlugin(
1526  ConstString("Settings for dynamic loader plug-ins"), properties_sp,
1527  description, is_global_property);
1528 }
1529 
1530 lldb::OptionValuePropertiesSP
1531 PluginManager::GetSettingForPlatformPlugin(Debugger &debugger,
1532  ConstString setting_name) {
1533  return GetSettingForPlugin(debugger, setting_name,
1536 }
1537 
1538 bool PluginManager::CreateSettingForPlatformPlugin(
1539  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1540  ConstString description, bool is_global_property) {
1542  ConstString("Settings for platform plug-ins"),
1543  properties_sp, description, is_global_property,
1545 }
1546 
1547 lldb::OptionValuePropertiesSP
1548 PluginManager::GetSettingForProcessPlugin(Debugger &debugger,
1549  ConstString setting_name) {
1550  return GetSettingForPlugin(debugger, setting_name,
1552 }
1553 
1554 bool PluginManager::CreateSettingForProcessPlugin(
1555  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1556  ConstString description, bool is_global_property) {
1558  ConstString("Settings for process plug-ins"),
1559  properties_sp, description, is_global_property);
1560 }
1561 
1562 lldb::OptionValuePropertiesSP
1563 PluginManager::GetSettingForObjectFilePlugin(Debugger &debugger,
1564  ConstString setting_name) {
1565  return GetSettingForPlugin(debugger, setting_name,
1567 }
1568 
1569 bool PluginManager::CreateSettingForObjectFilePlugin(
1570  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1571  ConstString description, bool is_global_property) {
1572  return CreateSettingForPlugin(
1574  ConstString("Settings for object file plug-ins"), properties_sp,
1575  description, is_global_property);
1576 }
1577 
1578 lldb::OptionValuePropertiesSP
1579 PluginManager::GetSettingForSymbolFilePlugin(Debugger &debugger,
1580  ConstString setting_name) {
1581  return GetSettingForPlugin(debugger, setting_name,
1583 }
1584 
1585 bool PluginManager::CreateSettingForSymbolFilePlugin(
1586  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1587  ConstString description, bool is_global_property) {
1588  return CreateSettingForPlugin(
1590  ConstString("Settings for symbol file plug-ins"), properties_sp,
1591  description, is_global_property);
1592 }
1593 
1594 lldb::OptionValuePropertiesSP
1595 PluginManager::GetSettingForJITLoaderPlugin(Debugger &debugger,
1596  ConstString setting_name) {
1597  return GetSettingForPlugin(debugger, setting_name,
1599 }
1600 
1601 bool PluginManager::CreateSettingForJITLoaderPlugin(
1602  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1603  ConstString description, bool is_global_property) {
1605  ConstString("Settings for JIT loader plug-ins"),
1606  properties_sp, description, is_global_property);
1607 }
1608 
1609 static const char *kOperatingSystemPluginName("os");
1610 
1611 lldb::OptionValuePropertiesSP
1612 PluginManager::GetSettingForOperatingSystemPlugin(Debugger &debugger,
1613  ConstString setting_name) {
1614  lldb::OptionValuePropertiesSP properties_sp;
1615  lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1618  ConstString(), // not creating to so we don't need the description
1619  false));
1620  if (plugin_type_properties_sp)
1621  properties_sp =
1622  plugin_type_properties_sp->GetSubProperty(nullptr, setting_name);
1623  return properties_sp;
1624 }
1625 
1626 bool PluginManager::CreateSettingForOperatingSystemPlugin(
1627  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1628  ConstString description, bool is_global_property) {
1629  if (properties_sp) {
1630  lldb::OptionValuePropertiesSP plugin_type_properties_sp(
1633  ConstString("Settings for operating system plug-ins"), true));
1634  if (plugin_type_properties_sp) {
1635  plugin_type_properties_sp->AppendProperty(properties_sp->GetName(),
1636  description, is_global_property,
1637  properties_sp);
1638  return true;
1639  }
1640  }
1641  return false;
1642 }
1643 
1644 lldb::OptionValuePropertiesSP
1645 PluginManager::GetSettingForStructuredDataPlugin(Debugger &debugger,
1646  ConstString setting_name) {
1647  return GetSettingForPlugin(debugger, setting_name,
1649 }
1650 
1651 bool PluginManager::CreateSettingForStructuredDataPlugin(
1652  Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
1653  ConstString description, bool is_global_property) {
1654  return CreateSettingForPlugin(
1656  ConstString("Settings for structured data plug-ins"), properties_sp,
1657  description, is_global_property);
1658 }
OperatingSystemInstances
PluginInstances< OperatingSystemInstance > OperatingSystemInstances
Definition: PluginManager.cpp:470
ObjectContainerInstance::create_memory_callback
ObjectContainerCreateMemoryInstance create_memory_callback
Definition: PluginManager.cpp:734
TypeSystemInstance::supported_languages_for_expressions
LanguageSet supported_languages_for_expressions
Definition: PluginManager.cpp:1285
GetMemoryHistoryInstances
static MemoryHistoryInstances & GetMemoryHistoryInstances()
Definition: PluginManager.cpp:1200
LanguageRuntimeCreateInstance
GetDisassemblerInstances
static DisassemblerInstances & GetDisassemblerInstances()
Definition: PluginManager.cpp:344
MemoryHistoryInstance
PluginInstance< MemoryHistoryCreateInstance > MemoryHistoryInstance
Definition: PluginManager.cpp:1197
lldb::ScriptLanguage
ScriptLanguage
Script interpreter types.
Definition: lldb-enumerations.h:216
lldb_private::Properties::GetValueProperties
virtual lldb::OptionValuePropertiesSP GetValueProperties() const
Definition: UserSettingsController.h:42
lldb_private::ArchSpec
Definition: ArchSpec.h:32
TraceExporterInstance::create_thread_trace_export_command
ThreadTraceExportCommandCreator create_thread_trace_export_command
Definition: PluginManager.cpp:1127
FileSystem.h
TypeSystemInstances
PluginInstances< TypeSystemInstance > TypeSystemInstances
Definition: PluginManager.cpp:1288
ScriptInterpreterInstance::ScriptInterpreterInstance
ScriptInterpreterInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, lldb::ScriptLanguage language)
Definition: PluginManager.cpp:882
GetPluginMapMutex
static std::recursive_mutex & GetPluginMapMutex()
Definition: PluginManager.cpp:51
ABIInstances
PluginInstances< ABIInstance > ABIInstances
Definition: PluginManager.cpp:280
kSymbolFilePluginName
static const char * kSymbolFilePluginName("symbol-file")
PluginTerminateMap
std::map< FileSpec, PluginInfo > PluginTerminateMap
Definition: PluginManager.cpp:49
GetREPLInstances
static REPLInstances & GetREPLInstances()
Definition: PluginManager.cpp:1343
GetTraceExporterInstances
static TraceExporterInstances & GetTraceExporterInstances()
Definition: PluginManager.cpp:1132
GetJITLoaderInstances
static JITLoaderInstances & GetJITLoaderInstances()
Definition: PluginManager.cpp:411
TypeSystemCreateInstance
LanguageRuntimeInstance
Definition: PluginManager.cpp:529
kJITLoaderPluginName
static const char * kJITLoaderPluginName("jit-loader")
PluginInstance::create_callback
Callback create_callback
Definition: PluginManager.cpp:196
GetSettingForPlugin
static lldb::OptionValuePropertiesSP GetSettingForPlugin(Debugger &debugger, ConstString setting_name, ConstString plugin_type_name, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
Definition: PluginManager.cpp:1470
SymbolFileInstance
PluginInstance< SymbolFileCreateInstance > SymbolFileInstance
Definition: PluginManager.cpp:994
DisassemblerInstances
PluginInstances< DisassemblerInstance > DisassemblerInstances
Definition: PluginManager.cpp:342
GetObjectFileInstances
static ObjectFileInstances & GetObjectFileInstances()
Definition: PluginManager.cpp:638
GetDebuggerPropertyForPluginsOldStyle
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle(Debugger &debugger, ConstString plugin_type_name, ConstString plugin_type_desc, bool can_create)
Definition: PluginManager.cpp:1430
kPlatformPluginName
static const char * kPlatformPluginName("platform")
StructuredDataPluginInstances
PluginInstances< StructuredDataPluginInstance > StructuredDataPluginInstances
Definition: PluginManager.cpp:952
ObjectContainerInstance::get_module_specifications
ObjectFileGetModuleSpecifications get_module_specifications
Definition: PluginManager.cpp:735
EmulateInstructionInstance
PluginInstance< EmulateInstructionCreateInstance > EmulateInstructionInstance
Definition: PluginManager.cpp:436
PluginTermCallback
void(* PluginTermCallback)()
Definition: PluginManager.cpp:39
StructuredDataPluginCreateInstance
CreateSettingForPlugin
static bool CreateSettingForPlugin(Debugger &debugger, ConstString plugin_type_name, ConstString plugin_type_desc, const lldb::OptionValuePropertiesSP &properties_sp, ConstString description, bool is_global_property, GetDebuggerPropertyForPluginsPtr get_debugger_property=GetDebuggerPropertyForPlugins)
Definition: PluginManager.cpp:1486
REPLInstance
Definition: PluginManager.cpp:1332
CastToFPtr
static FPtrTy CastToFPtr(void *VPtr)
Definition: PluginManager.cpp:75
TraceCreateInstanceFromBundle
PluginInstances::m_instances
std::vector< Instance > m_instances
Definition: PluginManager.cpp:274
InstrumentationRuntimeCreateInstance
lldb_private::Args
Definition: Args.h:33
PluginInstances::RegisterPlugin
bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, typename Instance::CallbackType callback, Args &&...args)
Definition: PluginManager.cpp:203
GetDynamicLoaderInstances
static DynamicLoaderInstances & GetDynamicLoaderInstances()
Definition: PluginManager.cpp:377
Debugger.h
LanguageRuntimeInstance::command_callback
LanguageRuntimeGetCommandObject command_callback
Definition: PluginManager.cpp:542
PluginInstances::GetInstances
const std::vector< Instance > & GetInstances() const
Definition: PluginManager.cpp:264
LanguageRuntimeInstances
PluginInstances< LanguageRuntimeInstance > LanguageRuntimeInstances
Definition: PluginManager.cpp:546
Process.h
GetPlatformInstances
static PlatformInstances & GetPlatformInstances()
Definition: PluginManager.cpp:786
kStructuredDataPluginName
static const char * kStructuredDataPluginName("structured-data")
lldb::eScriptLanguageNone
@ eScriptLanguageNone
Definition: lldb-enumerations.h:217
GetLanguageRuntimeInstances
static LanguageRuntimeInstances & GetLanguageRuntimeInstances()
Definition: PluginManager.cpp:548
GetSymbolVendorInstances
static SymbolVendorInstances & GetSymbolVendorInstances()
Definition: PluginManager.cpp:1024
SymbolVendorInstance
PluginInstance< SymbolVendorCreateInstance > SymbolVendorInstance
Definition: PluginManager.cpp:1021
PluginInstances
Definition: PluginManager.cpp:200
PluginInfo
Definition: PluginManager.cpp:41
TraceInstances
PluginInstances< TraceInstance > TraceInstances
Definition: PluginManager.cpp:1064
ObjectFileInstances
PluginInstances< ObjectFileInstance > ObjectFileInstances
Definition: PluginManager.cpp:636
GetUnwindAssemblyInstances
static UnwindAssemblyInstances & GetUnwindAssemblyInstances()
Definition: PluginManager.cpp:1173
lldb_private::FileSpec
Definition: FileSpec.h:55
ObjectFileInstance::save_core
ObjectFileSaveCore save_core
Definition: PluginManager.cpp:634
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
GetStructuredDataPluginInstances
static StructuredDataPluginInstances & GetStructuredDataPluginInstances()
Definition: PluginManager.cpp:954
UnwindAssemblyInstance
PluginInstance< UnwindAssemblyCreateInstance > UnwindAssemblyInstance
Definition: PluginManager.cpp:1170
bool
LoadPluginCallback
static FileSystem::EnumerateDirectoryResult LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path)
Definition: PluginManager.cpp:80
lldb_private::LanguageSet::bitvector
llvm::SmallBitVector bitvector
Definition: TypeSystem.h:41
PluginInstances::GetCallbackAtIndex
Instance::CallbackType GetCallbackAtIndex(uint32_t idx)
Definition: PluginManager.cpp:229
TypeSystemInstance::TypeSystemInstance
TypeSystemInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages_for_types, LanguageSet supported_languages_for_expressions)
Definition: PluginManager.cpp:1274
PluginInstance::name
llvm::StringRef name
Definition: PluginManager.cpp:194
GetScriptInterpreterInstances
static ScriptInterpreterInstances & GetScriptInterpreterInstances()
Definition: PluginManager.cpp:894
REPLInstance::supported_languages
LanguageSet supported_languages
Definition: PluginManager.cpp:1338
GetTracePluginInstances
static TraceInstances & GetTracePluginInstances()
Definition: PluginManager.cpp:1066
PluginInstances::UnregisterPlugin
bool UnregisterPlugin(typename Instance::CallbackType callback)
Definition: PluginManager.cpp:215
JITLoaderInstances
PluginInstances< JITLoaderInstance > JITLoaderInstances
Definition: PluginManager.cpp:409
ArchitectureInstance
PluginInstance< ArchitectureCreateInstance > ArchitectureInstance
Definition: PluginManager.cpp:303
GetProcessInstances
static ProcessInstances & GetProcessInstances()
Definition: PluginManager.cpp:835
GetTypeSystemInstances
static TypeSystemInstances & GetTypeSystemInstances()
Definition: PluginManager.cpp:1290
DynamicLoaderInstances
PluginInstances< DynamicLoaderInstance > DynamicLoaderInstances
Definition: PluginManager.cpp:375
ObjectContainerInstances
PluginInstances< ObjectContainerInstance > ObjectContainerInstances
Definition: PluginManager.cpp:737
lldb_private::FileSystem::EnumerateDirectoryResult
EnumerateDirectoryResult
Definition: FileSystem.h:166
OperatingSystemInstance
PluginInstance< OperatingSystemCreateInstance > OperatingSystemInstance
Definition: PluginManager.cpp:469
LanguageRuntimeInstance::precondition_callback
LanguageRuntimeGetExceptionPrecondition precondition_callback
Definition: PluginManager.cpp:543
TypeSystemInstance::supported_languages_for_types
LanguageSet supported_languages_for_types
Definition: PluginManager.cpp:1284
lldb_private::ConstString
Definition: ConstString.h:39
TraceInstance::schema
llvm::StringRef schema
Definition: PluginManager.cpp:1060
SymbolFileInstances
PluginInstances< SymbolFileInstance > SymbolFileInstances
Definition: PluginManager.cpp:995
GetLanguageInstances
static LanguageInstances & GetLanguageInstances()
Definition: PluginManager.cpp:506
TraceInstance
Definition: PluginManager.cpp:1048
SymbolVendorInstances
PluginInstances< SymbolVendorInstance > SymbolVendorInstances
Definition: PluginManager.cpp:1022
PluginInstances::PerformDebuggerCallback
void PerformDebuggerCallback(Debugger &debugger)
Definition: PluginManager.cpp:257
PlatformInstances
PluginInstances< PlatformInstance > PlatformInstances
Definition: PluginManager.cpp:784
ScriptInterpreterCreateInstance
ObjectContainerCreateInstance
ObjectContainerInstance::ObjectContainerInstance
ObjectContainerInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectContainerCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications)
Definition: PluginManager.cpp:724
PluginInstance
Definition: PluginManager.cpp:184
TypeSystemInstance
Definition: PluginManager.cpp:1273
PluginInstances::GetDescriptionAtIndex
llvm::StringRef GetDescriptionAtIndex(uint32_t idx)
Definition: PluginManager.cpp:235
GetABIInstances
static ABIInstances & GetABIInstances()
Definition: PluginManager.cpp:282
InstrumentationRuntimeInstance::InstrumentationRuntimeInstance
InstrumentationRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, InstrumentationRuntimeGetType get_type_callback)
Definition: PluginManager.cpp:1226
GetEmulateInstructionInstances
static EmulateInstructionInstances & GetEmulateInstructionInstances()
Definition: PluginManager.cpp:439
lldb_private::Debugger
Definition: Debugger.h:74
HostInfo.h
UnwindAssemblyInstances
PluginInstances< UnwindAssemblyInstance > UnwindAssemblyInstances
Definition: PluginManager.cpp:1171
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
StringList.h
ProcessInstance
PluginInstance< ProcessCreateInstance > ProcessInstance
Definition: PluginManager.cpp:832
PluginInfo::plugin_term_callback
PluginTermCallback plugin_term_callback
Definition: PluginManager.cpp:46
ObjectFileInstance::get_module_specifications
ObjectFileGetModuleSpecifications get_module_specifications
Definition: PluginManager.cpp:633
ScriptInterpreterInstance
Definition: PluginManager.cpp:880
StructuredDataPluginInstance
Definition: PluginManager.cpp:937
OptionValueProperties.h
PluginInstance::PluginInstance
PluginInstance(llvm::StringRef name, llvm::StringRef description, Callback create_callback, DebuggerInitializeCallback debugger_init_callback=nullptr)
Definition: PluginManager.cpp:188
TraceExporterInstance
Definition: PluginManager.cpp:1116
SystemRuntimeInstance
PluginInstance< SystemRuntimeCreateInstance > SystemRuntimeInstance
Definition: PluginManager.cpp:591
PluginInstance::description
llvm::StringRef description
Definition: PluginManager.cpp:195
ObjectFileInstance
Definition: PluginManager.cpp:618
PluginIsLoaded
static bool PluginIsLoaded(const FileSpec &plugin_file_spec)
Definition: PluginManager.cpp:61
PluginInstance::CallbackType
Callback CallbackType
Definition: PluginManager.cpp:185
TraceExporterInstances
PluginInstances< TraceExporterInstance > TraceExporterInstances
Definition: PluginManager.cpp:1130
PosixApi.h
LanguageRuntimeInstance::LanguageRuntimeInstance
LanguageRuntimeInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, LanguageRuntimeGetCommandObject command_callback, LanguageRuntimeGetExceptionPrecondition precondition_callback)
Definition: PluginManager.cpp:531
StructuredDataPluginInstance::StructuredDataPluginInstance
StructuredDataPluginInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, DebuggerInitializeCallback debugger_init_callback, StructuredDataFilterLaunchInfo filter_callback)
Definition: PluginManager.cpp:939
lldb_private::Status
Definition: Status.h:44
TraceExporterInstance::TraceExporterInstance
TraceExporterInstance(llvm::StringRef name, llvm::StringRef description, TraceExporterCreateInstance create_instance, ThreadTraceExportCommandCreator create_thread_trace_export_command)
Definition: PluginManager.cpp:1118
PluginInfo::plugin_init_callback
PluginInitCallback plugin_init_callback
Definition: PluginManager.cpp:45
ObjectFileInstance::create_memory_callback
ObjectFileCreateMemoryInstance create_memory_callback
Definition: PluginManager.cpp:632
GetSystemRuntimeInstances
static SystemRuntimeInstances & GetSystemRuntimeInstances()
Definition: PluginManager.cpp:594
LanguageInstance
PluginInstance< LanguageCreateInstance > LanguageInstance
Definition: PluginManager.cpp:503
uint32_t
SystemRuntimeInstances
PluginInstances< SystemRuntimeInstance > SystemRuntimeInstances
Definition: PluginManager.cpp:592
GetPluginMap
static PluginTerminateMap & GetPluginMap()
Definition: PluginManager.cpp:56
LanguageInstances
PluginInstances< LanguageInstance > LanguageInstances
Definition: PluginManager.cpp:504
GetOperatingSystemInstances
static OperatingSystemInstances & GetOperatingSystemInstances()
Definition: PluginManager.cpp:472
InstrumentationRuntimeInstances
PluginInstances< InstrumentationRuntimeInstance > InstrumentationRuntimeInstances
Definition: PluginManager.cpp:1238
REPLInstances
PluginInstances< REPLInstance > REPLInstances
Definition: PluginManager.cpp:1341
DynamicLoaderInstance
PluginInstance< DynamicLoaderCreateInstance > DynamicLoaderInstance
Definition: PluginManager.cpp:374
lldb::SaveCoreStyle
SaveCoreStyle
Definition: lldb-enumerations.h:1162
PluginInitCallback
bool(* PluginInitCallback)()
Definition: PluginManager.cpp:38
TraceInstance::TraceInstance
TraceInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback_from_bundle, TraceCreateInstanceForLiveProcess create_callback_for_live_process, llvm::StringRef schema)
Definition: PluginManager.cpp:1050
GetArchitectureInstances
static ArchitectureInstances & GetArchitectureInstances()
Definition: PluginManager.cpp:306
kProcessPluginName
static const char * kProcessPluginName("process")
PluginManager.h
kOperatingSystemPluginName
static const char * kOperatingSystemPluginName("os")
Status.h
JITLoaderInstance
PluginInstance< JITLoaderCreateInstance > JITLoaderInstance
Definition: PluginManager.cpp:408
InstrumentationRuntimeInstance
Definition: PluginManager.cpp:1224
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
ObjectFileCreateInstance
ProcessInstances
PluginInstances< ProcessInstance > ProcessInstances
Definition: PluginManager.cpp:833
GetInstrumentationRuntimeInstances
static InstrumentationRuntimeInstances & GetInstrumentationRuntimeInstances()
Definition: PluginManager.cpp:1240
FileSpec.h
lldb_private::CompletionRequest::AddCompletion
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
Definition: CompletionRequest.h:167
ObjectFileInstance::ObjectFileInstance
ObjectFileInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, ObjectFileCreateMemoryInstance create_memory_callback, ObjectFileGetModuleSpecifications get_module_specifications, ObjectFileSaveCore save_core, DebuggerInitializeCallback debugger_init_callback)
Definition: PluginManager.cpp:619
PluginInstance::debugger_init_callback
DebuggerInitializeCallback debugger_init_callback
Definition: PluginManager.cpp:197
ConstString.h
MemoryHistoryInstances
PluginInstances< MemoryHistoryInstance > MemoryHistoryInstances
Definition: PluginManager.cpp:1198
lldb_private::LanguageSet
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: TypeSystem.h:40
ScriptInterpreterInstances
PluginInstances< ScriptInterpreterInstance > ScriptInterpreterInstances
Definition: PluginManager.cpp:892
DisassemblerInstance
PluginInstance< DisassemblerCreateInstance > DisassemblerInstance
Definition: PluginManager.cpp:341
EmulateInstructionInstances
PluginInstances< EmulateInstructionInstance > EmulateInstructionInstances
Definition: PluginManager.cpp:437
ObjectContainerInstance
Definition: PluginManager.cpp:722
PluginInstances::GetCallbackForName
Instance::CallbackType GetCallbackForName(llvm::StringRef name)
Definition: PluginManager.cpp:247
ArchitectureInstances
std::vector< ArchitectureInstance > ArchitectureInstances
Definition: PluginManager.cpp:304
TraceInstance::create_callback_for_live_process
TraceCreateInstanceForLiveProcess create_callback_for_live_process
Definition: PluginManager.cpp:1061
PluginInfo::library
llvm::sys::DynamicLibrary library
Definition: PluginManager.cpp:44
REPLCreateInstance
GetSymbolFileInstances
static SymbolFileInstances & GetSymbolFileInstances()
Definition: PluginManager.cpp:997
kObjectFilePluginName
static const char * kObjectFilePluginName("object-file")
PATH_MAX
#define PATH_MAX
Definition: windows/PosixApi.h:25
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:364
TraceExporterCreateInstance
lldb
Definition: SBAddress.h:15
GetObjectContainerInstances
static ObjectContainerInstances & GetObjectContainerInstances()
Definition: PluginManager.cpp:739
GetDebuggerPropertyForPlugins
static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPlugins(Debugger &debugger, ConstString plugin_type_name, ConstString plugin_type_desc, bool can_create)
Definition: PluginManager.cpp:1395
SetPluginInfo
static void SetPluginInfo(const FileSpec &plugin_file_spec, const PluginInfo &plugin_info)
Definition: PluginManager.cpp:67
ABIInstance
PluginInstance< ABICreateInstance > ABIInstance
Definition: PluginManager.cpp:279
PluginInstances::GetInstanceAtIndex
Instance * GetInstanceAtIndex(uint32_t idx)
Definition: PluginManager.cpp:267
PluginInstances::GetInstances
std::vector< Instance > & GetInstances()
Definition: PluginManager.cpp:265
kDynamicLoaderPluginName
static const char * kDynamicLoaderPluginName("dynamic-loader")
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
PlatformInstance
PluginInstance< PlatformCreateInstance > PlatformInstance
Definition: PluginManager.cpp:783
DebuggerInitializeCallback
REPLInstance::REPLInstance
REPLInstance(llvm::StringRef name, llvm::StringRef description, CallbackType create_callback, LanguageSet supported_languages)
Definition: PluginManager.cpp:1333
PluginInstances::GetNameAtIndex
llvm::StringRef GetNameAtIndex(uint32_t idx)
Definition: PluginManager.cpp:241