Coverage Report

Created: 2023-09-12 09:32

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