Skip to content

Commit 34ac1f2

Browse files
committed
[lldb] Revert plugin manager changes to investigate failure
Revert the below two commits while we investigate the test failures. Revert "[lldb] Fix plugin manager test failure on windows (#134173)" This reverts commit b55bab2. Revert "Add enable/disable api for SystemRuntime plugins (#133794)" This reverts commit 2026873.
1 parent b55bab2 commit 34ac1f2

File tree

4 files changed

+3
-447
lines changed

4 files changed

+3
-447
lines changed

lldb/include/lldb/Core/PluginManager.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include <cstddef>
2424
#include <cstdint>
25-
#include <vector>
2625

2726
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName) \
2827
namespace lldb_private { \
@@ -48,12 +47,6 @@ class CommandInterpreter;
4847
class Debugger;
4948
class StringList;
5049

51-
struct RegisteredPluginInfo {
52-
llvm::StringRef name = "";
53-
llvm::StringRef description = "";
54-
bool enabled = false;
55-
};
56-
5750
class PluginManager {
5851
public:
5952
static void Initialize();
@@ -175,12 +168,6 @@ class PluginManager {
175168
static SystemRuntimeCreateInstance
176169
GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
177170

178-
static std::vector<RegisteredPluginInfo> GetSystemRuntimePluginInfo();
179-
180-
// Modify the enabled state of a SystemRuntime plugin.
181-
// Returns false if the plugin name is not found.
182-
static bool SetSystemRuntimePluginEnabled(llvm::StringRef name, bool enabled);
183-
184171
// ObjectFile
185172
static bool
186173
RegisterPlugin(llvm::StringRef name, llvm::StringRef description,

lldb/source/Core/PluginManager.cpp

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,11 @@ template <typename Callback> struct PluginInstance {
188188
PluginInstance(llvm::StringRef name, llvm::StringRef description,
189189
Callback create_callback,
190190
DebuggerInitializeCallback debugger_init_callback = nullptr)
191-
: name(name), description(description), enabled(true),
192-
create_callback(create_callback),
191+
: name(name), description(description), create_callback(create_callback),
193192
debugger_init_callback(debugger_init_callback) {}
194193

195194
llvm::StringRef name;
196195
llvm::StringRef description;
197-
bool enabled;
198196
Callback create_callback;
199197
DebuggerInitializeCallback debugger_init_callback;
200198
};
@@ -252,9 +250,7 @@ template <typename Instance> class PluginInstances {
252250
}
253251

254252
void PerformDebuggerCallback(Debugger &debugger) {
255-
for (const auto &instance : m_instances) {
256-
if (!instance.enabled)
257-
continue;
253+
for (auto &instance : m_instances) {
258254
if (instance.debugger_init_callback)
259255
instance.debugger_init_callback(debugger);
260256
}
@@ -264,14 +260,7 @@ template <typename Instance> class PluginInstances {
264260
// Note that this is a copy of the internal state so modifications
265261
// to the returned instances will not be reflected back to instances
266262
// stored by the PluginInstances object.
267-
std::vector<Instance> GetSnapshot() {
268-
std::vector<Instance> enabled_instances;
269-
for (const auto &instance : m_instances) {
270-
if (instance.enabled)
271-
enabled_instances.push_back(instance);
272-
}
273-
return enabled_instances;
274-
}
263+
std::vector<Instance> GetSnapshot() { return m_instances; }
275264

276265
const Instance *GetInstanceAtIndex(uint32_t idx) {
277266
uint32_t count = 0;
@@ -291,41 +280,12 @@ template <typename Instance> class PluginInstances {
291280
const Instance *
292281
FindEnabledInstance(std::function<bool(const Instance &)> predicate) const {
293282
for (const auto &instance : m_instances) {
294-
if (!instance.enabled)
295-
continue;
296283
if (predicate(instance))
297284
return &instance;
298285
}
299286
return nullptr;
300287
}
301288

302-
// Return a list of all the registered plugin instances. This includes both
303-
// enabled and disabled instances. The instances are listed in the order they
304-
// were registered which is the order they would be queried if they were all
305-
// enabled.
306-
std::vector<RegisteredPluginInfo> GetPluginInfoForAllInstances() {
307-
// Lookup the plugin info for each instance in the sorted order.
308-
std::vector<RegisteredPluginInfo> plugin_infos;
309-
plugin_infos.reserve(m_instances.size());
310-
for (const Instance &instance : m_instances)
311-
plugin_infos.push_back(
312-
{instance.name, instance.description, instance.enabled});
313-
314-
return plugin_infos;
315-
}
316-
317-
bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
318-
auto it = std::find_if(
319-
m_instances.begin(), m_instances.end(),
320-
[&](const Instance &instance) { return instance.name == name; });
321-
322-
if (it == m_instances.end())
323-
return false;
324-
325-
it->enabled = enable;
326-
return true;
327-
}
328-
329289
private:
330290
std::vector<Instance> m_instances;
331291
};
@@ -667,15 +627,6 @@ PluginManager::GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx) {
667627
return GetSystemRuntimeInstances().GetCallbackAtIndex(idx);
668628
}
669629

670-
std::vector<RegisteredPluginInfo> PluginManager::GetSystemRuntimePluginInfo() {
671-
return GetSystemRuntimeInstances().GetPluginInfoForAllInstances();
672-
}
673-
674-
bool PluginManager::SetSystemRuntimePluginEnabled(llvm::StringRef name,
675-
bool enable) {
676-
return GetSystemRuntimeInstances().SetInstanceEnabled(name, enable);
677-
}
678-
679630
#pragma mark ObjectFile
680631

681632
struct ObjectFileInstance : public PluginInstance<ObjectFileCreateInstance> {

lldb/unittests/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ add_lldb_unittest(LLDBCoreTests
77
FormatEntityTest.cpp
88
MangledTest.cpp
99
ModuleSpecTest.cpp
10-
PluginManagerTest.cpp
1110
ProgressReportTest.cpp
1211
RichManglingContextTest.cpp
1312
SourceLocationSpecTest.cpp

0 commit comments

Comments
 (0)