Skip to content

Commit 39c23a3

Browse files
authored
Revert "[lldb/Commands] Add scripting template list command with auto discovery" (#100273)
Reverts #97273 since it broke the windows bot: https://lab.llvm.org/buildbot/#/builders/141/builds/1025/steps/4/logs/stdio
1 parent 25f0381 commit 39c23a3

25 files changed

+40
-546
lines changed

lldb/include/lldb/Core/PluginManager.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define LLDB_CORE_PLUGINMANAGER_H
1111

1212
#include "lldb/Core/Architecture.h"
13-
#include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h"
1413
#include "lldb/Symbol/TypeSystem.h"
1514
#include "lldb/Utility/CompletionRequest.h"
1615
#include "lldb/Utility/FileSpec.h"
@@ -488,25 +487,6 @@ class PluginManager {
488487

489488
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
490489

491-
// Scripted Interface
492-
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
493-
ScriptedInterfaceCreateInstance create_callback,
494-
lldb::ScriptLanguage language,
495-
ScriptedInterfaceUsages usages);
496-
497-
static bool UnregisterPlugin(ScriptedInterfaceCreateInstance create_callback);
498-
499-
static uint32_t GetNumScriptedInterfaces();
500-
501-
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx);
502-
503-
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx);
504-
505-
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx);
506-
507-
static ScriptedInterfaceUsages
508-
GetScriptedInterfaceUsagesAtIndex(uint32_t idx);
509-
510490
// REPL
511491
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description,
512492
REPLCreateInstance create_callback,

lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#ifndef LLDB_INTERPRETER_INTERFACES_SCRIPTEDINTERFACE_H
1010
#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDINTERFACE_H
1111

12-
#include "ScriptedInterfaceUsages.h"
13-
1412
#include "lldb/Core/StructuredDataImpl.h"
1513
#include "lldb/Utility/LLDBLog.h"
1614
#include "lldb/Utility/Log.h"
@@ -70,11 +68,6 @@ class ScriptedInterface {
7068
return true;
7169
}
7270

73-
static bool CreateInstance(lldb::ScriptLanguage language,
74-
ScriptedInterfaceUsages usages) {
75-
return false;
76-
}
77-
7871
protected:
7972
StructuredData::GenericSP m_object_instance_sp;
8073
};

lldb/include/lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

lldb/include/lldb/lldb-private-interfaces.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Value;
2525
} // namespace llvm
2626

2727
namespace lldb_private {
28-
class ScriptedInterfaceUsages;
2928
typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp,
3029
const ArchSpec &arch);
3130
typedef std::unique_ptr<Architecture> (*ArchitectureCreateInstance)(
@@ -125,8 +124,6 @@ typedef lldb::REPLSP (*REPLCreateInstance)(Status &error,
125124
lldb::LanguageType language,
126125
Debugger *debugger, Target *target,
127126
const char *repl_options);
128-
typedef bool (*ScriptedInterfaceCreateInstance)(lldb::ScriptLanguage language,
129-
ScriptedInterfaceUsages usages);
130127
typedef int (*ComparisonFunction)(const void *, const void *);
131128
typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
132129
/// Trace

lldb/source/Commands/CommandObjectScripting.cpp

Lines changed: 2 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88

99
#include "CommandObjectScripting.h"
1010
#include "lldb/Core/Debugger.h"
11-
#include "lldb/Core/PluginManager.h"
1211
#include "lldb/DataFormatters/DataVisualization.h"
1312
#include "lldb/Host/Config.h"
1413
#include "lldb/Host/OptionParser.h"
1514
#include "lldb/Interpreter/CommandInterpreter.h"
1615
#include "lldb/Interpreter/CommandOptionArgumentTable.h"
1716
#include "lldb/Interpreter/CommandReturnObject.h"
18-
#include "lldb/Interpreter/Interfaces/ScriptedInterfaceUsages.h"
1917
#include "lldb/Interpreter/OptionArgParser.h"
2018
#include "lldb/Interpreter/ScriptInterpreter.h"
2119
#include "lldb/Utility/Args.h"
@@ -129,126 +127,9 @@ class CommandObjectScriptingRun : public CommandObjectRaw {
129127
CommandOptions m_options;
130128
};
131129

132-
#define LLDB_OPTIONS_scripting_template_list
133-
#include "CommandOptions.inc"
134-
135-
class CommandObjectScriptingTemplateList : public CommandObjectParsed {
136-
public:
137-
CommandObjectScriptingTemplateList(CommandInterpreter &interpreter)
138-
: CommandObjectParsed(
139-
interpreter, "scripting template list",
140-
"List all the available scripting extension templates. ",
141-
"scripting template list [--language <scripting-language> --]") {}
142-
143-
~CommandObjectScriptingTemplateList() override = default;
144-
145-
Options *GetOptions() override { return &m_options; }
146-
147-
class CommandOptions : public Options {
148-
public:
149-
CommandOptions() = default;
150-
~CommandOptions() override = default;
151-
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
152-
ExecutionContext *execution_context) override {
153-
Status error;
154-
const int short_option = m_getopt_table[option_idx].val;
130+
#pragma mark CommandObjectMultiwordScripting
155131

156-
switch (short_option) {
157-
case 'l':
158-
m_language = (lldb::ScriptLanguage)OptionArgParser::ToOptionEnum(
159-
option_arg, GetDefinitions()[option_idx].enum_values,
160-
eScriptLanguageNone, error);
161-
if (!error.Success())
162-
error.SetErrorStringWithFormatv(
163-
"unrecognized value for language '{0}'", option_arg);
164-
break;
165-
default:
166-
llvm_unreachable("Unimplemented option");
167-
}
168-
169-
return error;
170-
}
171-
172-
void OptionParsingStarting(ExecutionContext *execution_context) override {
173-
m_language = lldb::eScriptLanguageDefault;
174-
}
175-
176-
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
177-
return llvm::ArrayRef(g_scripting_template_list_options);
178-
}
179-
180-
lldb::ScriptLanguage m_language = lldb::eScriptLanguageDefault;
181-
};
182-
183-
protected:
184-
void DoExecute(Args &command, CommandReturnObject &result) override {
185-
Stream &s = result.GetOutputStream();
186-
s.Printf("Available scripted extension templates:");
187-
188-
auto print_field = [&s](llvm::StringRef key, llvm::StringRef value) {
189-
if (!value.empty()) {
190-
s.IndentMore();
191-
s.Indent();
192-
s << key << ": " << value << '\n';
193-
s.IndentLess();
194-
}
195-
};
196-
197-
size_t num_listed_interface = 0;
198-
size_t num_templates = PluginManager::GetNumScriptedInterfaces();
199-
for (size_t i = 0; i < num_templates; i++) {
200-
llvm::StringRef plugin_name =
201-
PluginManager::GetScriptedInterfaceNameAtIndex(i);
202-
if (plugin_name.empty())
203-
break;
204-
205-
lldb::ScriptLanguage lang =
206-
PluginManager::GetScriptedInterfaceLanguageAtIndex(i);
207-
if (lang != m_options.m_language)
208-
continue;
209-
210-
if (!num_listed_interface)
211-
s.EOL();
212-
213-
num_listed_interface++;
214-
215-
llvm::StringRef desc =
216-
PluginManager::GetScriptedInterfaceDescriptionAtIndex(i);
217-
ScriptedInterfaceUsages usages =
218-
PluginManager::GetScriptedInterfaceUsagesAtIndex(i);
219-
220-
print_field("Name", plugin_name);
221-
print_field("Language", ScriptInterpreter::LanguageToString(lang));
222-
print_field("Description", desc);
223-
usages.Dump(s, ScriptedInterfaceUsages::UsageKind::API);
224-
usages.Dump(s, ScriptedInterfaceUsages::UsageKind::CommandInterpreter);
225-
226-
if (i != num_templates - 1)
227-
s.EOL();
228-
}
229-
230-
if (!num_listed_interface)
231-
s << " None\n";
232-
}
233-
234-
private:
235-
CommandOptions m_options;
236-
};
237-
238-
class CommandObjectMultiwordScriptingTemplate : public CommandObjectMultiword {
239-
public:
240-
CommandObjectMultiwordScriptingTemplate(CommandInterpreter &interpreter)
241-
: CommandObjectMultiword(
242-
interpreter, "scripting template",
243-
"Commands for operating on the scripting templates.",
244-
"scripting template [<subcommand-options>]") {
245-
LoadSubCommand(
246-
"list",
247-
CommandObjectSP(new CommandObjectScriptingTemplateList(interpreter)));
248-
}
249-
250-
~CommandObjectMultiwordScriptingTemplate() override = default;
251-
};
132+
// CommandObjectMultiwordScripting
252133

253134
CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
254135
CommandInterpreter &interpreter)
@@ -258,9 +139,6 @@ CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
258139
"scripting <subcommand> [<subcommand-options>]") {
259140
LoadSubCommand("run",
260141
CommandObjectSP(new CommandObjectScriptingRun(interpreter)));
261-
LoadSubCommand("template",
262-
CommandObjectSP(
263-
new CommandObjectMultiwordScriptingTemplate(interpreter)));
264142
}
265143

266144
CommandObjectMultiwordScripting::~CommandObjectMultiwordScripting() = default;

lldb/source/Commands/Options.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,12 +841,6 @@ let Command = "scripting run" in {
841841
" language. If none is specific the default scripting language is used.">;
842842
}
843843

844-
let Command = "scripting template list" in {
845-
def scripting_template_list_language : Option<"language", "l">,
846-
EnumArg<"ScriptLang">, Desc<"Specify the scripting "
847-
" language. If none is specified the default scripting language is used.">;
848-
}
849-
850844
let Command = "source info" in {
851845
def source_info_count : Option<"count", "c">, Arg<"Count">,
852846
Desc<"The number of line entries to display.">;

lldb/source/Core/PluginManager.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,70 +1505,6 @@ LanguageSet PluginManager::GetAllTypeSystemSupportedLanguagesForExpressions() {
15051505
return all;
15061506
}
15071507

1508-
#pragma mark ScriptedInterfaces
1509-
1510-
struct ScriptedInterfaceInstance
1511-
: public PluginInstance<ScriptedInterfaceCreateInstance> {
1512-
ScriptedInterfaceInstance(llvm::StringRef name, llvm::StringRef description,
1513-
ScriptedInterfaceCreateInstance create_callback,
1514-
lldb::ScriptLanguage language,
1515-
ScriptedInterfaceUsages usages)
1516-
: PluginInstance<ScriptedInterfaceCreateInstance>(name, description,
1517-
create_callback),
1518-
language(language), usages(usages) {}
1519-
1520-
lldb::ScriptLanguage language;
1521-
ScriptedInterfaceUsages usages;
1522-
};
1523-
1524-
typedef PluginInstances<ScriptedInterfaceInstance> ScriptedInterfaceInstances;
1525-
1526-
static ScriptedInterfaceInstances &GetScriptedInterfaceInstances() {
1527-
static ScriptedInterfaceInstances g_instances;
1528-
return g_instances;
1529-
}
1530-
1531-
bool PluginManager::RegisterPlugin(
1532-
llvm::StringRef name, llvm::StringRef description,
1533-
ScriptedInterfaceCreateInstance create_callback,
1534-
lldb::ScriptLanguage language, ScriptedInterfaceUsages usages) {
1535-
return GetScriptedInterfaceInstances().RegisterPlugin(
1536-
name, description, create_callback, language, usages);
1537-
}
1538-
1539-
bool PluginManager::UnregisterPlugin(
1540-
ScriptedInterfaceCreateInstance create_callback) {
1541-
return GetScriptedInterfaceInstances().UnregisterPlugin(create_callback);
1542-
}
1543-
1544-
uint32_t PluginManager::GetNumScriptedInterfaces() {
1545-
return GetScriptedInterfaceInstances().GetInstances().size();
1546-
}
1547-
1548-
llvm::StringRef PluginManager::GetScriptedInterfaceNameAtIndex(uint32_t index) {
1549-
return GetScriptedInterfaceInstances().GetNameAtIndex(index);
1550-
}
1551-
1552-
llvm::StringRef
1553-
PluginManager::GetScriptedInterfaceDescriptionAtIndex(uint32_t index) {
1554-
return GetScriptedInterfaceInstances().GetDescriptionAtIndex(index);
1555-
}
1556-
1557-
lldb::ScriptLanguage
1558-
PluginManager::GetScriptedInterfaceLanguageAtIndex(uint32_t idx) {
1559-
const auto &instances = GetScriptedInterfaceInstances().GetInstances();
1560-
return idx < instances.size() ? instances[idx].language
1561-
: ScriptLanguage::eScriptLanguageNone;
1562-
}
1563-
1564-
ScriptedInterfaceUsages
1565-
PluginManager::GetScriptedInterfaceUsagesAtIndex(uint32_t idx) {
1566-
const auto &instances = GetScriptedInterfaceInstances().GetInstances();
1567-
if (idx >= instances.size())
1568-
return {};
1569-
return instances[idx].usages;
1570-
}
1571-
15721508
#pragma mark REPL
15731509

15741510
struct REPLInstance : public PluginInstance<REPLCreateInstance> {
@@ -1629,7 +1565,6 @@ void PluginManager::DebuggerInitialize(Debugger &debugger) {
16291565
GetOperatingSystemInstances().PerformDebuggerCallback(debugger);
16301566
GetStructuredDataPluginInstances().PerformDebuggerCallback(debugger);
16311567
GetTracePluginInstances().PerformDebuggerCallback(debugger);
1632-
GetScriptedInterfaceInstances().PerformDebuggerCallback(debugger);
16331568
}
16341569

16351570
// This is the preferred new way to register plugin specific settings. e.g.

lldb/source/Interpreter/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ lldb_tablegen(InterpreterPropertiesEnum.inc -gen-lldb-property-enum-defs
66
SOURCE InterpreterProperties.td
77
TARGET LLDBInterpreterPropertiesEnumGen)
88

9-
add_subdirectory(Interfaces)
10-
119
add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
1210
CommandAlias.cpp
1311
CommandHistory.cpp
@@ -56,7 +54,6 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
5654
ScriptInterpreter.cpp
5755

5856
LINK_LIBS
59-
lldbInterpreterInterfaces
6057
lldbCommands
6158
lldbCore
6259
lldbDataFormatters
@@ -69,7 +66,6 @@ add_lldb_library(lldbInterpreter NO_PLUGIN_DEPENDENCIES
6966
)
7067

7168
add_dependencies(lldbInterpreter
72-
lldbInterpreterInterfaces
7369
LLDBInterpreterPropertiesGen
7470
LLDBInterpreterPropertiesEnumGen)
7571

lldb/source/Interpreter/Interfaces/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)