mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
Revert "Centralize the handling of completion for simple argument lists. (#82085)"
This reverts commit 21631494b0.
Reverted because of greendragon failure:
******************** TEST 'lldb-api :: functionalities/completion/TestCompletion.py' FAILED ********************
Script:
This commit is contained in:
@@ -242,13 +242,6 @@ public:
|
||||
/// The completion request that needs to be answered.
|
||||
virtual void HandleCompletion(CompletionRequest &request);
|
||||
|
||||
/// The default version handles argument definitions that have only one
|
||||
/// argument type, and use one of the argument types that have an entry in
|
||||
/// the CommonCompletions. Override this if you have a more complex
|
||||
/// argument setup.
|
||||
/// FIXME: we should be able to extend this to more complex argument
|
||||
/// definitions provided we have completers for all the argument types.
|
||||
///
|
||||
/// The input array contains a parsed version of the line.
|
||||
///
|
||||
/// We've constructed the map of options and their arguments as well if that
|
||||
@@ -258,7 +251,7 @@ public:
|
||||
/// The completion request that needs to be answered.
|
||||
virtual void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector);
|
||||
OptionElementVector &opt_element_vector) {}
|
||||
|
||||
bool HelpTextContainsWord(llvm::StringRef search_word,
|
||||
bool search_short_help = true,
|
||||
|
||||
@@ -243,7 +243,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = {
|
||||
{ lldb::eArgTypeLogCategory, "log-category", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." },
|
||||
{ lldb::eArgTypeLogChannel, "log-channel", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." },
|
||||
{ lldb::eArgTypeMethod, "method", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A C++ method name." },
|
||||
{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "The name of a type category." },
|
||||
{ lldb::eArgTypeName, "name", lldb::eTypeCategoryNameCompletion, {}, { nullptr, false }, "Help text goes here." },
|
||||
{ lldb::eArgTypeNewPathPrefix, "new-path-prefix", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." },
|
||||
{ lldb::eArgTypeNumLines, "num-lines", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The number of lines to use." },
|
||||
{ lldb::eArgTypeNumberPerLine, "number-per-line", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The number of items per line to display." },
|
||||
@@ -262,7 +262,7 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = {
|
||||
{ lldb::eArgTypeQueueName, "queue-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of the thread queue." },
|
||||
{ lldb::eArgTypeRegisterName, "register-name", lldb::CompletionType::eNoCompletion, {}, { RegisterNameHelpTextCallback, true }, nullptr },
|
||||
{ lldb::eArgTypeRegularExpression, "regular-expression", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A POSIX-compliant extended regular expression." },
|
||||
{ lldb::eArgTypeRunArgs, "run-args", lldb::CompletionType::eDiskFileCompletion, {}, { nullptr, false }, "Arguments to be passed to the target program when it starts executing." },
|
||||
{ lldb::eArgTypeRunArgs, "run-args", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Arguments to be passed to the target program when it starts executing." },
|
||||
{ lldb::eArgTypeRunMode, "run-mode", lldb::CompletionType::eNoCompletion, g_running_mode, { nullptr, false }, "Help text goes here." },
|
||||
{ lldb::eArgTypeScriptedCommandSynchronicity, "script-cmd-synchronicity", lldb::CompletionType::eNoCompletion, g_script_synchro_type, { nullptr, false }, "The synchronicity to use to run scripted commands with regard to LLDB event system." },
|
||||
{ lldb::eArgTypeScriptLang, "script-language", lldb::CompletionType::eNoCompletion, g_script_option_enumeration, { nullptr, false }, "The scripting language to be used for script-based commands. Supported languages are python and lua." },
|
||||
@@ -270,21 +270,21 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = {
|
||||
{ lldb::eArgTypeSelector, "selector", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An Objective-C selector name." },
|
||||
{ lldb::eArgTypeSettingIndex, "setting-index", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An index into a settings variable that is an array (try 'settings list' to see all the possible settings variables and their types)." },
|
||||
{ lldb::eArgTypeSettingKey, "setting-key", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A key into a settings variables that is a dictionary (try 'settings list' to see all the possible settings variables and their types)." },
|
||||
{ lldb::eArgTypeSettingPrefix, "setting-prefix", lldb::CompletionType::eSettingsNameCompletion, {}, { nullptr, false }, "The name of a settable internal debugger variable up to a dot ('.'), e.g. 'target.process.'" },
|
||||
{ lldb::eArgTypeSettingVariableName, "setting-variable-name", lldb::CompletionType::eSettingsNameCompletion, {}, { nullptr, false }, "The name of a settable internal debugger variable. Type 'settings list' to see a complete list of such variables." },
|
||||
{ lldb::eArgTypeShlibName, "shlib-name", lldb::CompletionType::eDiskFileCompletion, {}, { nullptr, false }, "The name of a shared library." },
|
||||
{ lldb::eArgTypeSettingPrefix, "setting-prefix", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a settable internal debugger variable up to a dot ('.'), e.g. 'target.process.'" },
|
||||
{ lldb::eArgTypeSettingVariableName, "setting-variable-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a settable internal debugger variable. Type 'settings list' to see a complete list of such variables." },
|
||||
{ lldb::eArgTypeShlibName, "shlib-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a shared library." },
|
||||
{ lldb::eArgTypeSourceFile, "source-file", lldb::eSourceFileCompletion, {}, { nullptr, false }, "The name of a source file.." },
|
||||
{ lldb::eArgTypeSortOrder, "sort-order", lldb::CompletionType::eNoCompletion, g_sort_option_enumeration, { nullptr, false }, "Specify a sort order when dumping lists." },
|
||||
{ lldb::eArgTypeStartAddress, "start-address", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." },
|
||||
{ lldb::eArgTypeSummaryString, "summary-string", lldb::CompletionType::eNoCompletion, {}, { SummaryStringHelpTextCallback, true }, nullptr },
|
||||
{ lldb::eArgTypeSymbol, "symbol", lldb::eSymbolCompletion, {}, { nullptr, false }, "Any symbol name (function name, variable, argument, etc.)" },
|
||||
{ lldb::eArgTypeThreadID, "thread-id", lldb::CompletionType::eThreadIndexCompletion, {}, { nullptr, false }, "Thread ID number." },
|
||||
{ lldb::eArgTypeThreadIndex, "thread-index", lldb::CompletionType::eThreadIndexCompletion, {}, { nullptr, false }, "Index into the process' list of threads." },
|
||||
{ lldb::eArgTypeThreadID, "thread-id", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Thread ID number." },
|
||||
{ lldb::eArgTypeThreadIndex, "thread-index", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Index into the process' list of threads." },
|
||||
{ lldb::eArgTypeThreadName, "thread-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The thread's name." },
|
||||
{ lldb::eArgTypeTypeName, "type-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A type name." },
|
||||
{ lldb::eArgTypeUnsignedInteger, "unsigned-integer", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An unsigned integer." },
|
||||
{ lldb::eArgTypeUnixSignal, "unix-signal", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A valid Unix signal name or number (e.g. SIGKILL, KILL or 9)." },
|
||||
{ lldb::eArgTypeVarName, "variable-name", lldb::CompletionType::eVariablePathCompletion, {} ,{ nullptr, false }, "The name of a variable in your program." },
|
||||
{ lldb::eArgTypeVarName, "variable-name", lldb::CompletionType::eNoCompletion, {} ,{ nullptr, false }, "The name of a variable in your program." },
|
||||
{ lldb::eArgTypeValue, "value", lldb::CompletionType::eNoCompletion, g_dependents_enumeration, { nullptr, false }, "A value could be anything, depending on where and how it is used." },
|
||||
{ lldb::eArgTypeWidth, "width", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." },
|
||||
{ lldb::eArgTypeNone, "none", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "No help available for this." },
|
||||
@@ -302,11 +302,8 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = {
|
||||
{ lldb::eArgTypeRecognizerID, "frame-recognizer-id", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The ID for a stack frame recognizer." },
|
||||
{ lldb::eArgTypeConnectURL, "process-connect-url", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A URL-style specification for a remote connection." },
|
||||
{ lldb::eArgTypeTargetID, "target-id", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The index ID for an lldb Target." },
|
||||
{ lldb::eArgTypeStopHookID, "stop-hook-id", lldb::CompletionType::eStopHookIDCompletion, {}, { nullptr, false }, "The ID you receive when you create a stop-hook." },
|
||||
{ lldb::eArgTypeStopHookID, "stop-hook-id", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The ID you receive when you create a stop-hook." },
|
||||
{ lldb::eArgTypeCompletionType, "completion-type", lldb::CompletionType::eNoCompletion, g_completion_type, { nullptr, false }, "The completion type to use when adding custom commands. If none is specified, the command won't use auto-completion." },
|
||||
{ lldb::eArgTypeRemotePath, "remote-path", lldb::CompletionType::eRemoteDiskFileCompletion, {}, { nullptr, false }, "A path on the system managed by the current platform." },
|
||||
{ lldb::eArgTypeRemoteFilename, "remote-filename", lldb::CompletionType::eRemoteDiskFileCompletion, {}, { nullptr, false }, "A file on the system managed by the current platform." },
|
||||
{ lldb::eArgTypeModule, "module", lldb::CompletionType::eModuleCompletion, {}, { nullptr, false }, "The name of a module loaded into the current target." },
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
||||
@@ -651,9 +651,6 @@ enum CommandArgumentType {
|
||||
eArgTypeTargetID,
|
||||
eArgTypeStopHookID,
|
||||
eArgTypeCompletionType,
|
||||
eArgTypeRemotePath,
|
||||
eArgTypeRemoteFilename,
|
||||
eArgTypeModule,
|
||||
eArgTypeLastArg // Always keep this entry as the last entry in this
|
||||
// enumeration!!
|
||||
};
|
||||
|
||||
@@ -63,6 +63,13 @@ public:
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
|
||||
protected:
|
||||
@@ -1961,6 +1968,13 @@ public:
|
||||
|
||||
~CommandObjectCommandsScriptImport() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -52,6 +52,12 @@ CommandObjectDWIMPrint::CommandObjectDWIMPrint(CommandInterpreter &interpreter)
|
||||
|
||||
Options *CommandObjectDWIMPrint::GetOptions() { return &m_option_group; }
|
||||
|
||||
void CommandObjectDWIMPrint::HandleArgumentCompletion(
|
||||
CompletionRequest &request, OptionElementVector &opt_element_vector) {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eVariablePathCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
void CommandObjectDWIMPrint::DoExecute(StringRef command,
|
||||
CommandReturnObject &result) {
|
||||
m_option_group.NotifyOptionParsingStarting(&m_exe_ctx);
|
||||
|
||||
@@ -39,6 +39,10 @@ public:
|
||||
|
||||
bool WantsCompletion() override { return true; }
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override;
|
||||
|
||||
private:
|
||||
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
||||
|
||||
|
||||
@@ -286,6 +286,16 @@ public:
|
||||
|
||||
~CommandObjectFrameSelect() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() != 0)
|
||||
return;
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eFrameIndexCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
|
||||
protected:
|
||||
@@ -436,6 +446,15 @@ may even involve JITing and running code in the target program.)");
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
// Arguments are the standard source file completer.
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eVariablePathCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
llvm::StringRef GetScopeString(VariableSP var_sp) {
|
||||
if (!var_sp)
|
||||
|
||||
@@ -418,7 +418,7 @@ public:
|
||||
: CommandObjectParsed(interpreter, "platform mkdir",
|
||||
"Make a new directory on the remote end.", nullptr,
|
||||
0) {
|
||||
CommandArgumentData thread_arg{eArgTypeRemotePath, eArgRepeatPlain};
|
||||
CommandArgumentData thread_arg{eArgTypePath, eArgRepeatPlain};
|
||||
m_arguments.push_back({thread_arg});
|
||||
}
|
||||
|
||||
@@ -467,12 +467,21 @@ public:
|
||||
CommandObjectPlatformFOpen(CommandInterpreter &interpreter)
|
||||
: CommandObjectParsed(interpreter, "platform file open",
|
||||
"Open a file on the remote end.", nullptr, 0) {
|
||||
CommandArgumentData path_arg{eArgTypeRemotePath, eArgRepeatPlain};
|
||||
CommandArgumentData path_arg{eArgTypePath, eArgRepeatPlain};
|
||||
m_arguments.push_back({path_arg});
|
||||
}
|
||||
|
||||
~CommandObjectPlatformFOpen() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() == 0)
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
PlatformSP platform_sp(
|
||||
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
||||
@@ -786,7 +795,7 @@ public:
|
||||
CommandArgumentData file_arg_remote, file_arg_host;
|
||||
|
||||
// Define the first (and only) variant of this arg.
|
||||
file_arg_remote.arg_type = eArgTypeRemoteFilename;
|
||||
file_arg_remote.arg_type = eArgTypeFilename;
|
||||
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
||||
// There is only one variant this argument could be; put it into the
|
||||
// argument entry.
|
||||
@@ -867,7 +876,7 @@ public:
|
||||
CommandArgumentData file_arg_remote;
|
||||
|
||||
// Define the first (and only) variant of this arg.
|
||||
file_arg_remote.arg_type = eArgTypeRemoteFilename;
|
||||
file_arg_remote.arg_type = eArgTypeFilename;
|
||||
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
||||
// There is only one variant this argument could be; put it into the
|
||||
// argument entry.
|
||||
@@ -879,6 +888,17 @@ public:
|
||||
|
||||
~CommandObjectPlatformGetSize() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() != 0)
|
||||
return;
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
// If the number of arguments is incorrect, issue an error message.
|
||||
if (args.GetArgumentCount() != 1) {
|
||||
@@ -926,7 +946,7 @@ public:
|
||||
CommandArgumentData file_arg_remote;
|
||||
|
||||
// Define the first (and only) variant of this arg.
|
||||
file_arg_remote.arg_type = eArgTypeRemoteFilename;
|
||||
file_arg_remote.arg_type = eArgTypeFilename;
|
||||
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
||||
// There is only one variant this argument could be; put it into the
|
||||
// argument entry.
|
||||
@@ -938,6 +958,17 @@ public:
|
||||
|
||||
~CommandObjectPlatformGetPermissions() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() != 0)
|
||||
return;
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
// If the number of arguments is incorrect, issue an error message.
|
||||
if (args.GetArgumentCount() != 1) {
|
||||
@@ -984,7 +1015,7 @@ public:
|
||||
CommandArgumentData file_arg_remote;
|
||||
|
||||
// Define the first (and only) variant of this arg.
|
||||
file_arg_remote.arg_type = eArgTypeRemoteFilename;
|
||||
file_arg_remote.arg_type = eArgTypeFilename;
|
||||
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
||||
// There is only one variant this argument could be; put it into the
|
||||
// argument entry.
|
||||
@@ -996,6 +1027,17 @@ public:
|
||||
|
||||
~CommandObjectPlatformFileExists() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() != 0)
|
||||
return;
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
// If the number of arguments is incorrect, issue an error message.
|
||||
if (args.GetArgumentCount() != 1) {
|
||||
@@ -1038,7 +1080,7 @@ public:
|
||||
|
||||
Omitting the destination places the file in the platform working directory.)");
|
||||
CommandArgumentData source_arg{eArgTypePath, eArgRepeatPlain};
|
||||
CommandArgumentData path_arg{eArgTypeRemotePath, eArgRepeatOptional};
|
||||
CommandArgumentData path_arg{eArgTypePath, eArgRepeatOptional};
|
||||
m_arguments.push_back({source_arg});
|
||||
m_arguments.push_back({path_arg});
|
||||
}
|
||||
@@ -1097,16 +1139,6 @@ public:
|
||||
m_arguments.push_back({run_arg_arg});
|
||||
}
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
// I didn't make a type for RemoteRunArgs, but since we're going to run
|
||||
// this on the remote system we should use the remote completer.
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
~CommandObjectPlatformProcessLaunch() override = default;
|
||||
|
||||
Options *GetOptions() override { return &m_all_options; }
|
||||
@@ -1520,6 +1552,13 @@ public:
|
||||
|
||||
~CommandObjectPlatformProcessInfo() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eProcessIDCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
Target *target = GetDebugger().GetSelectedTarget().get();
|
||||
@@ -1811,7 +1850,7 @@ public:
|
||||
"Install a target (bundle or executable file) to the remote end.",
|
||||
"platform target-install <local-thing> <remote-sandbox>", 0) {
|
||||
CommandArgumentData local_arg{eArgTypePath, eArgRepeatPlain};
|
||||
CommandArgumentData remote_arg{eArgTypeRemotePath, eArgRepeatPlain};
|
||||
CommandArgumentData remote_arg{eArgTypePath, eArgRepeatPlain};
|
||||
m_arguments.push_back({local_arg});
|
||||
m_arguments.push_back({remote_arg});
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ public:
|
||||
|
||||
~CommandObjectPluginLoad() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
size_t argc = command.GetArgumentCount();
|
||||
|
||||
@@ -143,6 +143,14 @@ public:
|
||||
|
||||
~CommandObjectProcessLaunch() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_all_options; }
|
||||
|
||||
std::optional<std::string> GetRepeatCommand(Args ¤t_command_args,
|
||||
@@ -1007,7 +1015,9 @@ public:
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (!m_exe_ctx.HasProcessScope())
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
@@ -1282,6 +1292,13 @@ public:
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
class CommandOptions : public Options {
|
||||
public:
|
||||
CommandOptions() = default;
|
||||
|
||||
@@ -80,7 +80,9 @@ public:
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (!m_exe_ctx.HasProcessScope())
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRegisterCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
@@ -438,7 +440,8 @@ different for the same register when connected to different debug servers.)");
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0)
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eRegisterCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -28,6 +28,13 @@ public:
|
||||
|
||||
~CommandObjectSessionSave() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
llvm::StringRef file_path;
|
||||
|
||||
@@ -262,6 +262,14 @@ public:
|
||||
|
||||
~CommandObjectSettingsShow() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eSettingsNameCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
|
||||
@@ -257,6 +257,13 @@ public:
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
@@ -2782,6 +2789,13 @@ public:
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
OptionGroupOptions m_option_group;
|
||||
OptionGroupUUID m_uuid_option_group;
|
||||
@@ -3219,7 +3233,7 @@ public:
|
||||
: CommandObjectParsed(
|
||||
interpreter, "target modules list",
|
||||
"List current executable and dependent shared library images.") {
|
||||
CommandArgumentData module_arg{eArgTypeModule, eArgRepeatStar};
|
||||
CommandArgumentData module_arg{eArgTypeShlibName, eArgRepeatStar};
|
||||
m_arguments.push_back({module_arg});
|
||||
}
|
||||
|
||||
@@ -4329,6 +4343,13 @@ public:
|
||||
|
||||
~CommandObjectTargetSymbolsAdd() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
|
||||
protected:
|
||||
@@ -5174,7 +5195,8 @@ public:
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex())
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eStopHookIDCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -5229,7 +5251,8 @@ public:
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex())
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eStopHookIDCompletion, request, nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -403,7 +403,10 @@ public:
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex())
|
||||
return;
|
||||
CommandObject::HandleArgumentCompletion(request, opt_element_vector);
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eThreadIndexCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_all_options; }
|
||||
@@ -660,6 +663,14 @@ public:
|
||||
|
||||
~CommandObjectThreadContinue() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eThreadIndexCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
bool synchronous_execution = m_interpreter.GetSynchronous();
|
||||
|
||||
|
||||
@@ -1758,6 +1758,14 @@ public:
|
||||
|
||||
~CommandObjectTypeCategoryDefine() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
@@ -1851,6 +1859,14 @@ public:
|
||||
|
||||
~CommandObjectTypeCategoryEnable() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
@@ -1910,6 +1926,14 @@ public:
|
||||
|
||||
~CommandObjectTypeCategoryDelete() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
@@ -2009,6 +2033,14 @@ public:
|
||||
|
||||
~CommandObjectTypeCategoryDisable() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
protected:
|
||||
void DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
|
||||
@@ -831,6 +831,16 @@ corresponding to the byte size of the data type.");
|
||||
|
||||
~CommandObjectWatchpointSetVariable() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (request.GetCursorIndex() != 0)
|
||||
return;
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), lldb::eVariablePathCompletion, request,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_option_group; }
|
||||
|
||||
protected:
|
||||
|
||||
@@ -305,43 +305,6 @@ void CommandObject::HandleCompletion(CompletionRequest &request) {
|
||||
}
|
||||
}
|
||||
|
||||
void CommandObject::HandleArgumentCompletion(
|
||||
CompletionRequest &request, OptionElementVector &opt_element_vector) {
|
||||
size_t num_arg_entries = GetNumArgumentEntries();
|
||||
if (num_arg_entries != 1)
|
||||
return;
|
||||
|
||||
CommandArgumentEntry *entry_ptr = GetArgumentEntryAtIndex(0);
|
||||
if (!entry_ptr) {
|
||||
assert(entry_ptr && "We said there was one entry, but there wasn't.");
|
||||
return; // Not worth crashing if asserts are off...
|
||||
}
|
||||
|
||||
CommandArgumentEntry &entry = *entry_ptr;
|
||||
// For now, we only handle the simple case of one homogenous argument type.
|
||||
if (entry.size() != 1)
|
||||
return;
|
||||
|
||||
// Look up the completion type, and if it has one, invoke it:
|
||||
const CommandObject::ArgumentTableEntry *arg_entry =
|
||||
FindArgumentDataByType(entry[0].arg_type);
|
||||
const ArgumentRepetitionType repeat = entry[0].arg_repetition;
|
||||
|
||||
if (arg_entry == nullptr || arg_entry->completion_type == lldb::eNoCompletion)
|
||||
return;
|
||||
|
||||
// FIXME: This should be handled higher in the Command Parser.
|
||||
// Check the case where this command only takes one argument, and don't do
|
||||
// the completion if we aren't on the first entry:
|
||||
if (repeat == eArgRepeatPlain && request.GetCursorIndex() != 0)
|
||||
return;
|
||||
|
||||
lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), arg_entry->completion_type, request, nullptr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CommandObject::HelpTextContainsWord(llvm::StringRef search_word,
|
||||
bool search_short_help,
|
||||
bool search_long_help,
|
||||
|
||||
@@ -104,7 +104,7 @@ class HelpCommandTestCase(TestBase):
|
||||
def test_help_image_list_shows_positional_args(self):
|
||||
"""Command 'help image list' should describe positional args."""
|
||||
# 'image' is an alias for 'target modules'.
|
||||
self.expect("help image list", substrs=["<module> [...]"])
|
||||
self.expect("help image list", substrs=["<shlib-name> [...]"])
|
||||
|
||||
@no_debug_info_test
|
||||
def test_help_target_variable_syntax(self):
|
||||
|
||||
Reference in New Issue
Block a user