diff --git a/lldb/docs/python_api_enums.rst b/lldb/docs/python_api_enums.rst --- a/lldb/docs/python_api_enums.rst +++ b/lldb/docs/python_api_enums.rst @@ -876,6 +876,7 @@ .. py:data:: eArgTypeColumnNum .. py:data:: eArgTypeModuleUUID .. py:data:: eArgTypeLastArg +.. py:data:: eArgTypeCompletionType .. _SymbolType: diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -1666,10 +1666,10 @@ def __lldb_init_module(debugger, internal_dict): debugger.HandleCommand( - "command script add -o -c lldb.macosx.crashlog.Symbolicate crashlog" + "command script add -o -c lldb.macosx.crashlog.Symbolicate -C disk-file crashlog" ) debugger.HandleCommand( - "command script add -o -f lldb.macosx.crashlog.save_crashlog save_crashlog" + "command script add -o -f lldb.macosx.crashlog.save_crashlog -C disk-file save_crashlog" ) print( '"crashlog" and "save_crashlog" commands have been installed, use ' diff --git a/lldb/include/lldb/Interpreter/CommandCompletions.h b/lldb/include/lldb/Interpreter/CommandCompletions.h --- a/lldb/include/lldb/Interpreter/CommandCompletions.h +++ b/lldb/include/lldb/Interpreter/CommandCompletions.h @@ -24,39 +24,6 @@ class TildeExpressionResolver; class CommandCompletions { public: - enum CommonCompletionTypes { - eNoCompletion = 0u, - eSourceFileCompletion = (1u << 0), - eDiskFileCompletion = (1u << 1), - eDiskDirectoryCompletion = (1u << 2), - eSymbolCompletion = (1u << 3), - eModuleCompletion = (1u << 4), - eSettingsNameCompletion = (1u << 5), - ePlatformPluginCompletion = (1u << 6), - eArchitectureCompletion = (1u << 7), - eVariablePathCompletion = (1u << 8), - eRegisterCompletion = (1u << 9), - eBreakpointCompletion = (1u << 10), - eProcessPluginCompletion = (1u << 11), - eDisassemblyFlavorCompletion = (1u << 12), - eTypeLanguageCompletion = (1u << 13), - eFrameIndexCompletion = (1u << 14), - eModuleUUIDCompletion = (1u << 15), - eStopHookIDCompletion = (1u << 16), - eThreadIndexCompletion = (1u << 17), - eWatchPointIDCompletion = (1u << 18), - eBreakpointNameCompletion = (1u << 19), - eProcessIDCompletion = (1u << 20), - eProcessNameCompletion = (1u << 21), - eRemoteDiskFileCompletion = (1u << 22), - eRemoteDiskDirectoryCompletion = (1u << 23), - eTypeCategoryNameCompletion = (1u << 24), - // This item serves two purposes. It is the last element in the enum, so - // you can add custom enums starting from here in your Option class. Also - // if you & in this bit the base code will not process the option. - eCustomCompletion = (1u << 24) - }; - static bool InvokeCommonCompletionCallbacks( CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher); diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -83,7 +83,7 @@ struct ArgumentTableEntry { lldb::CommandArgumentType arg_type; const char *arg_name; - CommandCompletions::CommonCompletionTypes completion_type; + lldb::CompletionType completion_type; OptionEnumValues enum_values; ArgumentHelpCallback help_function; const char *help_text; diff --git a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h --- a/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h +++ b/lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h @@ -149,6 +149,51 @@ "Run only this thread while stepping"}, }; +static constexpr OptionEnumValueElement g_completion_type[] = { + {lldb::eNoCompletion, "none", "No completion."}, + {lldb::eSourceFileCompletion, "source-file", "Completes to a source file."}, + {lldb::eDiskFileCompletion, "disk-file", "Completes to a disk file."}, + {lldb::eDiskDirectoryCompletion, "disk-directory", + "Completes to a disk directory."}, + {lldb::eSymbolCompletion, "symbol", "Completes to a symbol."}, + {lldb::eModuleCompletion, "module", "Completes to a module."}, + {lldb::eSettingsNameCompletion, "settings-name", + "Completes to a settings name."}, + {lldb::ePlatformPluginCompletion, "platform-plugin", + "Completes to a platform plugin."}, + {lldb::eArchitectureCompletion, "architecture", + "Completes to a architecture."}, + {lldb::eVariablePathCompletion, "variable-path", + "Completes to a variable path."}, + {lldb::eRegisterCompletion, "register", "Completes to a register."}, + {lldb::eBreakpointCompletion, "breakpoint", "Completes to a breakpoint."}, + {lldb::eProcessPluginCompletion, "process-plugin", + "Completes to a process plugin."}, + {lldb::eDisassemblyFlavorCompletion, "disassembly-flavor", + "Completes to a disassembly flavor."}, + {lldb::eTypeLanguageCompletion, "type-language", + "Completes to a type language."}, + {lldb::eFrameIndexCompletion, "frame-index", "Completes to a frame index."}, + {lldb::eModuleUUIDCompletion, "module-uuid", "Completes to a module uuid."}, + {lldb::eStopHookIDCompletion, "stophook-id", "Completes to a stophook id."}, + {lldb::eThreadIndexCompletion, "thread-index", + "Completes to a thread index."}, + {lldb::eWatchpointIDCompletion, "watchpoint-id", + "Completes to a watchpoint id."}, + {lldb::eBreakpointNameCompletion, "breakpoint-name", + "Completes to a breakpoint name."}, + {lldb::eProcessIDCompletion, "process-id", "Completes to a process id."}, + {lldb::eProcessNameCompletion, "process-name", + "Completes to a process name."}, + {lldb::eRemoteDiskFileCompletion, "remote-disk-file", + "Completes to a remote disk file."}, + {lldb::eRemoteDiskDirectoryCompletion, "remote-disk-directory", + "Completes to a remote disk directory."}, + {lldb::eTypeCategoryNameCompletion, "type-category-name", + "Completes to a type category name."}, + {lldb::eCustomCompletion, "custom", "Custom completion."}, +}; + llvm::StringRef RegisterNameHelpTextCallback(); llvm::StringRef BreakpointIDHelpTextCallback(); llvm::StringRef BreakpointIDRangeHelpTextCallback(); @@ -162,101 +207,102 @@ static constexpr CommandObject::ArgumentTableEntry g_argument_table[] = { // clang-format off - { lldb::eArgTypeAddress, "address", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A valid address in the target program's execution space." }, - { lldb::eArgTypeAddressOrExpression, "address-expression", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An expression that resolves to an address." }, - { lldb::eArgTypeAliasName, "alias-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of an abbreviation (alias) for a debugger command." }, - { lldb::eArgTypeAliasOptions, "options-for-aliased-command", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Command options to be used as part of an alias (abbreviation) definition. (See 'help commands alias' for more information.)" }, - { lldb::eArgTypeArchitecture, "arch", CommandCompletions::eArchitectureCompletion, {}, { arch_helper, true }, "The architecture name, e.g. i386 or x86_64." }, - { lldb::eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A Boolean value: 'true' or 'false'" }, - { lldb::eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, {}, { BreakpointIDHelpTextCallback, false }, nullptr }, - { lldb::eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, {}, { BreakpointIDRangeHelpTextCallback, false }, nullptr }, - { lldb::eArgTypeBreakpointName, "breakpoint-name", CommandCompletions::eBreakpointNameCompletion, {}, { BreakpointNameHelpTextCallback, false }, nullptr }, - { lldb::eArgTypeByteSize, "byte-size", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Number of bytes to use." }, - { lldb::eArgTypeClassName, "class-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Then name of a class from the debug information in the program." }, - { lldb::eArgTypeCommandName, "cmd-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A debugger command (may be multiple words), without any options or arguments." }, - { lldb::eArgTypeCount, "count", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An unsigned integer." }, - { lldb::eArgTypeDescriptionVerbosity, "description-verbosity", CommandCompletions::eNoCompletion, g_description_verbosity_type, { nullptr, false }, "How verbose the output of 'po' should be." }, - { lldb::eArgTypeDirectoryName, "directory", CommandCompletions::eDiskDirectoryCompletion, {}, { nullptr, false }, "A directory name." }, - { lldb::eArgTypeDisassemblyFlavor, "disassembly-flavor", CommandCompletions::eDisassemblyFlavorCompletion, {}, { nullptr, false }, "A disassembly flavor recognized by your disassembly plugin. Currently the only valid options are \"att\" and \"intel\" for Intel targets" }, - { lldb::eArgTypeEndAddress, "end-address", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeExpression, "expr", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeExpressionPath, "expr-path", CommandCompletions::eNoCompletion, {}, { ExprPathHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeExprFormat, "expression-format", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]" }, - { lldb::eArgTypeFileLineColumn, "linespec", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A source specifier in the form file:line[:column]" }, - { lldb::eArgTypeFilename, "filename", CommandCompletions::eDiskFileCompletion, {}, { nullptr, false }, "The name of a file (can include path)." }, - { lldb::eArgTypeFormat, "format", CommandCompletions::eNoCompletion, {}, { FormatHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeFrameIndex, "frame-index", CommandCompletions::eFrameIndexCompletion, {}, { nullptr, false }, "Index into a thread's list of frames." }, - { lldb::eArgTypeFullName, "fullname", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a function." }, - { lldb::eArgTypeFunctionOrSymbol, "function-or-symbol", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a function or symbol." }, - { lldb::eArgTypeGDBFormat, "gdb-format", CommandCompletions::eNoCompletion, {}, { GDBFormatHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeHelpText, "help-text", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Text to be used as help for some other entity in LLDB" }, - { lldb::eArgTypeIndex, "index", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An index into a list." }, - { lldb::eArgTypeLanguage, "source-language", CommandCompletions::eTypeLanguageCompletion, {}, { LanguageTypeHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Line number in a source file." }, - { lldb::eArgTypeLogCategory, "log-category", CommandCompletions::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", CommandCompletions::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", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A C++ method name." }, - { lldb::eArgTypeName, "name", CommandCompletions::eTypeCategoryNameCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeNumLines, "num-lines", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The number of lines to use." }, - { lldb::eArgTypeNumberPerLine, "number-per-line", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The number of items per line to display." }, - { lldb::eArgTypeOffset, "offset", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeOldPathPrefix, "old-path-prefix", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeOneLiner, "one-line-command", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A command that is entered as a single line of text." }, - { lldb::eArgTypePath, "path", CommandCompletions::eDiskFileCompletion, {}, { nullptr, false }, "Path." }, - { lldb::eArgTypePermissionsNumber, "perms-numeric", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Permissions given as an octal number (e.g. 755)." }, - { lldb::eArgTypePermissionsString, "perms=string", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Permissions given as a string value (e.g. rw-r-xr--)." }, - { lldb::eArgTypePid, "pid", CommandCompletions::eProcessIDCompletion, {}, { nullptr, false }, "The process ID number." }, - { lldb::eArgTypePlugin, "plugin", CommandCompletions::eProcessPluginCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeProcessName, "process-name", CommandCompletions::eProcessNameCompletion, {}, { nullptr, false }, "The name of the process." }, - { lldb::eArgTypePythonClass, "python-class", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a Python class." }, - { lldb::eArgTypePythonFunction, "python-function", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a Python function." }, - { lldb::eArgTypePythonScript, "python-script", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Source code written in Python." }, - { lldb::eArgTypeQueueName, "queue-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of the thread queue." }, - { lldb::eArgTypeRegisterName, "register-name", CommandCompletions::eNoCompletion, {}, { RegisterNameHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A POSIX-compliant extended regular expression." }, - { lldb::eArgTypeRunArgs, "run-args", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Arguments to be passed to the target program when it starts executing." }, - { lldb::eArgTypeRunMode, "run-mode", CommandCompletions::eNoCompletion, g_running_mode, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeScriptedCommandSynchronicity, "script-cmd-synchronicity", CommandCompletions::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", CommandCompletions::eNoCompletion, g_script_option_enumeration, { nullptr, false }, "The scripting language to be used for script-based commands. Supported languages are python and lua." }, - { lldb::eArgTypeSearchWord, "search-word", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Any word of interest for search purposes." }, - { lldb::eArgTypeSelector, "selector", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An Objective-C selector name." }, - { lldb::eArgTypeSettingIndex, "setting-index", CommandCompletions::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", CommandCompletions::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", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a settable internal debugger variable up to a dot ('.'), e.g. 'target.process.'" }, - { lldb::eArgTypeSettingVariableName, "setting-variable-name", CommandCompletions::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", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The name of a shared library." }, - { lldb::eArgTypeSourceFile, "source-file", CommandCompletions::eSourceFileCompletion, {}, { nullptr, false }, "The name of a source file.." }, - { lldb::eArgTypeSortOrder, "sort-order", CommandCompletions::eNoCompletion, g_sort_option_enumeration, { nullptr, false }, "Specify a sort order when dumping lists." }, - { lldb::eArgTypeStartAddress, "start-address", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeSummaryString, "summary-string", CommandCompletions::eNoCompletion, {}, { SummaryStringHelpTextCallback, true }, nullptr }, - { lldb::eArgTypeSymbol, "symbol", CommandCompletions::eSymbolCompletion, {}, { nullptr, false }, "Any symbol name (function name, variable, argument, etc.)" }, - { lldb::eArgTypeThreadID, "thread-id", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Thread ID number." }, - { lldb::eArgTypeThreadIndex, "thread-index", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Index into the process' list of threads." }, - { lldb::eArgTypeThreadName, "thread-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The thread's name." }, - { lldb::eArgTypeTypeName, "type-name", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A type name." }, - { lldb::eArgTypeUnsignedInteger, "unsigned-integer", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An unsigned integer." }, - { lldb::eArgTypeUnixSignal, "unix-signal", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A valid Unix signal name or number (e.g. SIGKILL, KILL or 9)." }, - { lldb::eArgTypeVarName, "variable-name", CommandCompletions::eNoCompletion, {} ,{ nullptr, false }, "The name of a variable in your program." }, - { lldb::eArgTypeValue, "value", CommandCompletions::eNoCompletion, g_dependents_enumeration, { nullptr, false }, "A value could be anything, depending on where and how it is used." }, - { lldb::eArgTypeWidth, "width", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, - { lldb::eArgTypeNone, "none", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "No help available for this." }, - { lldb::eArgTypePlatform, "platform-name", CommandCompletions::ePlatformPluginCompletion, {}, { nullptr, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." }, - { lldb::eArgTypeWatchpointID, "watchpt-id", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Watchpoint IDs are positive integers." }, - { lldb::eArgTypeWatchpointIDRange, "watchpt-id-list", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "For example, '1-3' or '1 to 3'." }, - { lldb::eArgTypeWatchType, "watch-type", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Specify the type for a watchpoint." }, - { lldb::eArgRawInput, "raw-input", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." }, - { lldb::eArgTypeCommand, "command", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "An LLDB Command line command element." }, - { lldb::eArgTypeColumnNum, "column", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "Column number in a source file." }, - { lldb::eArgTypeModuleUUID, "module-uuid", CommandCompletions::eModuleUUIDCompletion, {}, { nullptr, false }, "A module UUID value." }, - { lldb::eArgTypeSaveCoreStyle, "corefile-style", CommandCompletions::eNoCompletion, g_corefile_save_style, { nullptr, false }, "The type of corefile that lldb will try to create, dependant on this target's capabilities." }, - { lldb::eArgTypeLogHandler, "log-handler", CommandCompletions::eNoCompletion, g_log_handler_type ,{ nullptr, false }, "The log handle that will be used to write out log messages." }, - { lldb::eArgTypeSEDStylePair, "substitution-pair", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A sed-style pattern and target pair." }, - { lldb::eArgTypeRecognizerID, "frame-recognizer-id", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The ID for a stack frame recognizer." }, - { lldb::eArgTypeConnectURL, "process-connect-url", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "A URL-style specification for a remote connection." }, - { lldb::eArgTypeTargetID, "target-id", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The index ID for an lldb Target." }, - { lldb::eArgTypeStopHookID, "stop-hook-id", CommandCompletions::eNoCompletion, {}, { nullptr, false }, "The ID you receive when you create a stop-hook." }, + { lldb::eArgTypeAddress, "address", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A valid address in the target program's execution space." }, + { lldb::eArgTypeAddressOrExpression, "address-expression", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An expression that resolves to an address." }, + { lldb::eArgTypeAliasName, "alias-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of an abbreviation (alias) for a debugger command." }, + { lldb::eArgTypeAliasOptions, "options-for-aliased-command", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Command options to be used as part of an alias (abbreviation) definition. (See 'help commands alias' for more information.)" }, + { lldb::eArgTypeArchitecture, "arch", lldb::eArchitectureCompletion, {}, { arch_helper, true }, "The architecture name, e.g. i386 or x86_64." }, + { lldb::eArgTypeBoolean, "boolean", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A Boolean value: 'true' or 'false'" }, + { lldb::eArgTypeBreakpointID, "breakpt-id", lldb::CompletionType::eNoCompletion, {}, { BreakpointIDHelpTextCallback, false }, nullptr }, + { lldb::eArgTypeBreakpointIDRange, "breakpt-id-list", lldb::CompletionType::eNoCompletion, {}, { BreakpointIDRangeHelpTextCallback, false }, nullptr }, + { lldb::eArgTypeBreakpointName, "breakpoint-name", lldb::eBreakpointNameCompletion, {}, { BreakpointNameHelpTextCallback, false }, nullptr }, + { lldb::eArgTypeByteSize, "byte-size", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Number of bytes to use." }, + { lldb::eArgTypeClassName, "class-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Then name of a class from the debug information in the program." }, + { lldb::eArgTypeCommandName, "cmd-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A debugger command (may be multiple words), without any options or arguments." }, + { lldb::eArgTypeCount, "count", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An unsigned integer." }, + { lldb::eArgTypeDescriptionVerbosity, "description-verbosity", lldb::CompletionType::eNoCompletion, g_description_verbosity_type, { nullptr, false }, "How verbose the output of 'po' should be." }, + { lldb::eArgTypeDirectoryName, "directory", lldb::eDiskDirectoryCompletion, {}, { nullptr, false }, "A directory name." }, + { lldb::eArgTypeDisassemblyFlavor, "disassembly-flavor", lldb::eDisassemblyFlavorCompletion, {}, { nullptr, false }, "A disassembly flavor recognized by your disassembly plugin. Currently the only valid options are \"att\" and \"intel\" for Intel targets" }, + { lldb::eArgTypeEndAddress, "end-address", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeExpression, "expr", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeExpressionPath, "expr-path", lldb::CompletionType::eNoCompletion, {}, { ExprPathHelpTextCallback, true }, nullptr }, + { lldb::eArgTypeExprFormat, "expression-format", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]" }, + { lldb::eArgTypeFileLineColumn, "linespec", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A source specifier in the form file:line[:column]" }, + { lldb::eArgTypeFilename, "filename", lldb::eDiskFileCompletion, {}, { nullptr, false }, "The name of a file (can include path)." }, + { lldb::eArgTypeFormat, "format", lldb::CompletionType::eNoCompletion, {}, { FormatHelpTextCallback, true }, nullptr }, + { lldb::eArgTypeFrameIndex, "frame-index", lldb::eFrameIndexCompletion, {}, { nullptr, false }, "Index into a thread's list of frames." }, + { lldb::eArgTypeFullName, "fullname", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeFunctionName, "function-name", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a function." }, + { lldb::eArgTypeFunctionOrSymbol, "function-or-symbol", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a function or symbol." }, + { lldb::eArgTypeGDBFormat, "gdb-format", lldb::CompletionType::eNoCompletion, {}, { GDBFormatHelpTextCallback, true }, nullptr }, + { lldb::eArgTypeHelpText, "help-text", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Text to be used as help for some other entity in LLDB" }, + { lldb::eArgTypeIndex, "index", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An index into a list." }, + { lldb::eArgTypeLanguage, "source-language", lldb::eTypeLanguageCompletion, {}, { LanguageTypeHelpTextCallback, true }, nullptr }, + { lldb::eArgTypeLineNum, "linenum", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Line number in a source file." }, + { 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 }, "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." }, + { lldb::eArgTypeOffset, "offset", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeOldPathPrefix, "old-path-prefix", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeOneLiner, "one-line-command", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A command that is entered as a single line of text." }, + { lldb::eArgTypePath, "path", lldb::eDiskFileCompletion, {}, { nullptr, false }, "Path." }, + { lldb::eArgTypePermissionsNumber, "perms-numeric", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Permissions given as an octal number (e.g. 755)." }, + { lldb::eArgTypePermissionsString, "perms=string", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Permissions given as a string value (e.g. rw-r-xr--)." }, + { lldb::eArgTypePid, "pid", lldb::eProcessIDCompletion, {}, { nullptr, false }, "The process ID number." }, + { lldb::eArgTypePlugin, "plugin", lldb::eProcessPluginCompletion, {}, { nullptr, false }, "Help text goes here." }, + { lldb::eArgTypeProcessName, "process-name", lldb::eProcessNameCompletion, {}, { nullptr, false }, "The name of the process." }, + { lldb::eArgTypePythonClass, "python-class", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a Python class." }, + { lldb::eArgTypePythonFunction, "python-function", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "The name of a Python function." }, + { lldb::eArgTypePythonScript, "python-script", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Source code written in Python." }, + { 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::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." }, + { lldb::eArgTypeSearchWord, "search-word", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Any word of interest for search purposes." }, + { 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::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::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::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." }, + { lldb::eArgTypePlatform, "platform-name", lldb::ePlatformPluginCompletion, {}, { nullptr, false }, "The name of an installed platform plug-in . Type 'platform list' to see a complete list of installed platforms." }, + { lldb::eArgTypeWatchpointID, "watchpt-id", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Watchpoint IDs are positive integers." }, + { lldb::eArgTypeWatchpointIDRange, "watchpt-id-list", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "For example, '1-3' or '1 to 3'." }, + { lldb::eArgTypeWatchType, "watch-type", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Specify the type for a watchpoint." }, + { lldb::eArgRawInput, "raw-input", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Free-form text passed to a command without prior interpretation, allowing spaces without requiring quotes. To pass arguments and free form text put two dashes ' -- ' between the last argument and any raw input." }, + { lldb::eArgTypeCommand, "command", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "An LLDB Command line command element." }, + { lldb::eArgTypeColumnNum, "column", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "Column number in a source file." }, + { lldb::eArgTypeModuleUUID, "module-uuid", lldb::eModuleUUIDCompletion, {}, { nullptr, false }, "A module UUID value." }, + { lldb::eArgTypeSaveCoreStyle, "corefile-style", lldb::CompletionType::eNoCompletion, g_corefile_save_style, { nullptr, false }, "The type of corefile that lldb will try to create, dependant on this target's capabilities." }, + { lldb::eArgTypeLogHandler, "log-handler", lldb::CompletionType::eNoCompletion, g_log_handler_type ,{ nullptr, false }, "The log handle that will be used to write out log messages." }, + { lldb::eArgTypeSEDStylePair, "substitution-pair", lldb::CompletionType::eNoCompletion, {}, { nullptr, false }, "A sed-style pattern and target pair." }, + { 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::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." }, // clang-format on }; diff --git a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h --- a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h @@ -52,7 +52,7 @@ FileSpec m_file_spec; uint32_t m_line_number = LLDB_INVALID_LINE_NUMBER; uint32_t m_column_number = LLDB_INVALID_COLUMN_NUMBER; - uint32_t m_completion_mask = CommandCompletions::eSourceFileCompletion; + uint32_t m_completion_mask = lldb::eSourceFileCompletion; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -79,7 +79,7 @@ FileSpec m_default_value; lldb::DataBufferSP m_data_sp; llvm::sys::TimePoint<> m_data_mod_time; - uint32_t m_completion_mask = CommandCompletions::eDiskFileCompletion; + uint32_t m_completion_mask = lldb::eDiskFileCompletion; bool m_resolve; }; diff --git a/lldb/include/lldb/Utility/OptionDefinition.h b/lldb/include/lldb/Utility/OptionDefinition.h --- a/lldb/include/lldb/Utility/OptionDefinition.h +++ b/lldb/include/lldb/Utility/OptionDefinition.h @@ -38,7 +38,7 @@ /// If not empty, an array of enum values. OptionEnumValues enum_values; /// The kind of completion for this option. - /// Contains values of the CommandCompletions::CommonCompletionTypes enum. + /// Contains values of the lldb::CompletionType enum. uint32_t completion_type; /// Type of argument this option takes. lldb::CommandArgumentType argument_type; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -629,6 +629,7 @@ eArgTypeConnectURL, eArgTypeTargetID, eArgTypeStopHookID, + eArgTypeCompletionType, eArgTypeLastArg // Always keep this entry as the last entry in this // enumeration!! }; @@ -1245,6 +1246,39 @@ eWatchPointValueKindExpression = 2, }; +enum CompletionType { + eNoCompletion = 0u, + eSourceFileCompletion = (1u << 0), + eDiskFileCompletion = (1u << 1), + eDiskDirectoryCompletion = (1u << 2), + eSymbolCompletion = (1u << 3), + eModuleCompletion = (1u << 4), + eSettingsNameCompletion = (1u << 5), + ePlatformPluginCompletion = (1u << 6), + eArchitectureCompletion = (1u << 7), + eVariablePathCompletion = (1u << 8), + eRegisterCompletion = (1u << 9), + eBreakpointCompletion = (1u << 10), + eProcessPluginCompletion = (1u << 11), + eDisassemblyFlavorCompletion = (1u << 12), + eTypeLanguageCompletion = (1u << 13), + eFrameIndexCompletion = (1u << 14), + eModuleUUIDCompletion = (1u << 15), + eStopHookIDCompletion = (1u << 16), + eThreadIndexCompletion = (1u << 17), + eWatchpointIDCompletion = (1u << 18), + eBreakpointNameCompletion = (1u << 19), + eProcessIDCompletion = (1u << 20), + eProcessNameCompletion = (1u << 21), + eRemoteDiskFileCompletion = (1u << 22), + eRemoteDiskDirectoryCompletion = (1u << 23), + eTypeCategoryNameCompletion = (1u << 24), + // This item serves two purposes. It is the last element in the enum, so + // you can add custom enums starting from here in your Option class. Also + // if you & in this bit the base code will not process the option. + eCustomCompletion = (1u << 25) +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -54,37 +54,41 @@ bool handled = false; const CommonCompletionElement common_completions[] = { - {eSourceFileCompletion, CommandCompletions::SourceFiles}, - {eDiskFileCompletion, CommandCompletions::DiskFiles}, - {eDiskDirectoryCompletion, CommandCompletions::DiskDirectories}, - {eSymbolCompletion, CommandCompletions::Symbols}, - {eModuleCompletion, CommandCompletions::Modules}, - {eModuleUUIDCompletion, CommandCompletions::ModuleUUIDs}, - {eSettingsNameCompletion, CommandCompletions::SettingsNames}, - {ePlatformPluginCompletion, CommandCompletions::PlatformPluginNames}, - {eArchitectureCompletion, CommandCompletions::ArchitectureNames}, - {eVariablePathCompletion, CommandCompletions::VariablePath}, - {eRegisterCompletion, CommandCompletions::Registers}, - {eBreakpointCompletion, CommandCompletions::Breakpoints}, - {eProcessPluginCompletion, CommandCompletions::ProcessPluginNames}, - {eDisassemblyFlavorCompletion, CommandCompletions::DisassemblyFlavors}, - {eTypeLanguageCompletion, CommandCompletions::TypeLanguages}, - {eFrameIndexCompletion, CommandCompletions::FrameIndexes}, - {eStopHookIDCompletion, CommandCompletions::StopHookIDs}, - {eThreadIndexCompletion, CommandCompletions::ThreadIndexes}, - {eWatchPointIDCompletion, CommandCompletions::WatchPointIDs}, - {eBreakpointNameCompletion, CommandCompletions::BreakpointNames}, - {eProcessIDCompletion, CommandCompletions::ProcessIDs}, - {eProcessNameCompletion, CommandCompletions::ProcessNames}, - {eRemoteDiskFileCompletion, CommandCompletions::RemoteDiskFiles}, - {eRemoteDiskDirectoryCompletion, + {lldb::eSourceFileCompletion, CommandCompletions::SourceFiles}, + {lldb::eDiskFileCompletion, CommandCompletions::DiskFiles}, + {lldb::eDiskDirectoryCompletion, CommandCompletions::DiskDirectories}, + {lldb::eSymbolCompletion, CommandCompletions::Symbols}, + {lldb::eModuleCompletion, CommandCompletions::Modules}, + {lldb::eModuleUUIDCompletion, CommandCompletions::ModuleUUIDs}, + {lldb::eSettingsNameCompletion, CommandCompletions::SettingsNames}, + {lldb::ePlatformPluginCompletion, + CommandCompletions::PlatformPluginNames}, + {lldb::eArchitectureCompletion, CommandCompletions::ArchitectureNames}, + {lldb::eVariablePathCompletion, CommandCompletions::VariablePath}, + {lldb::eRegisterCompletion, CommandCompletions::Registers}, + {lldb::eBreakpointCompletion, CommandCompletions::Breakpoints}, + {lldb::eProcessPluginCompletion, CommandCompletions::ProcessPluginNames}, + {lldb::eDisassemblyFlavorCompletion, + CommandCompletions::DisassemblyFlavors}, + {lldb::eTypeLanguageCompletion, CommandCompletions::TypeLanguages}, + {lldb::eFrameIndexCompletion, CommandCompletions::FrameIndexes}, + {lldb::eStopHookIDCompletion, CommandCompletions::StopHookIDs}, + {lldb::eThreadIndexCompletion, CommandCompletions::ThreadIndexes}, + {lldb::eWatchpointIDCompletion, CommandCompletions::WatchPointIDs}, + {lldb::eBreakpointNameCompletion, CommandCompletions::BreakpointNames}, + {lldb::eProcessIDCompletion, CommandCompletions::ProcessIDs}, + {lldb::eProcessNameCompletion, CommandCompletions::ProcessNames}, + {lldb::eRemoteDiskFileCompletion, CommandCompletions::RemoteDiskFiles}, + {lldb::eRemoteDiskDirectoryCompletion, CommandCompletions::RemoteDiskDirectories}, - {eTypeCategoryNameCompletion, CommandCompletions::TypeCategoryNames}, - {eNoCompletion, nullptr} // This one has to be last in the list. + {lldb::eTypeCategoryNameCompletion, + CommandCompletions::TypeCategoryNames}, + {lldb::CompletionType::eNoCompletion, + nullptr} // This one has to be last in the list. }; for (int i = 0;; i++) { - if (common_completions[i].type == eNoCompletion) + if (common_completions[i].type == lldb::eNoCompletion) break; else if ((common_completions[i].type & completion_mask) == common_completions[i].type && diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -828,9 +828,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } @@ -902,9 +901,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } protected: @@ -1017,9 +1015,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } protected: @@ -1394,9 +1391,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } @@ -1803,9 +1799,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } Options *GetOptions() override { return &m_option_group; } @@ -1887,9 +1882,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } Options *GetOptions() override { return &m_option_group; } @@ -2203,9 +2197,8 @@ switch (GetDefinitions()[opt_defs_index].short_option) { case 'f': - CommandCompletions::InvokeCommonCompletionCallbacks( - interpreter, CommandCompletions::eDiskFileCompletion, request, - nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + interpreter, lldb::eDiskFileCompletion, request, nullptr); break; case 'N': @@ -2343,9 +2336,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eBreakpointCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eBreakpointCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -66,9 +66,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } @@ -1080,9 +1079,10 @@ public: CommandObjectPythonFunction(CommandInterpreter &interpreter, std::string name, std::string funct, std::string help, - ScriptedCommandSynchronicity synch) + ScriptedCommandSynchronicity synch, + CompletionType completion_type) : CommandObjectRaw(interpreter, name), m_function_name(funct), - m_synchro(synch) { + m_synchro(synch), m_completion_type(completion_type) { if (!help.empty()) SetHelp(help); else { @@ -1116,6 +1116,15 @@ return CommandObjectRaw::GetHelpLong(); } + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), m_completion_type, request, nullptr); + } + + bool WantsCompletion() override { return true; } + protected: bool DoExecute(llvm::StringRef raw_command_line, CommandReturnObject &result) override { @@ -1146,6 +1155,7 @@ std::string m_function_name; ScriptedCommandSynchronicity m_synchro; bool m_fetched_help_long = false; + CompletionType m_completion_type = eNoCompletion; }; class CommandObjectScriptingObject : public CommandObjectRaw { @@ -1153,10 +1163,11 @@ CommandObjectScriptingObject(CommandInterpreter &interpreter, std::string name, StructuredData::GenericSP cmd_obj_sp, - ScriptedCommandSynchronicity synch) + ScriptedCommandSynchronicity synch, + CompletionType completion_type) : CommandObjectRaw(interpreter, name), m_cmd_obj_sp(cmd_obj_sp), m_synchro(synch), m_fetched_help_short(false), - m_fetched_help_long(false) { + m_fetched_help_long(false), m_completion_type(completion_type) { StreamString stream; stream.Printf("For more information run 'help %s'", name.c_str()); SetHelp(stream.GetString()); @@ -1166,6 +1177,15 @@ ~CommandObjectScriptingObject() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), m_completion_type, request, nullptr); + } + + bool WantsCompletion() override { return true; } + bool IsRemovable() const override { return true; } ScriptedCommandSynchronicity GetSynchronicity() { return m_synchro; } @@ -1232,6 +1252,7 @@ ScriptedCommandSynchronicity m_synchro; bool m_fetched_help_short : 1; bool m_fetched_help_long : 1; + CompletionType m_completion_type = eNoCompletion; }; // CommandObjectCommandsScriptImport @@ -1263,9 +1284,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } @@ -1439,6 +1459,18 @@ "unrecognized value for synchronicity '%s'", option_arg.str().c_str()); break; + case 'C': { + Status error; + OptionDefinition definition = GetDefinitions()[option_idx]; + lldb::CompletionType completion_type = + static_cast(OptionArgParser::ToOptionEnum( + option_arg, definition.enum_values, eNoCompletion, error)); + if (!error.Success()) + error.SetErrorStringWithFormat( + "unrecognized value for command completion type '%s'", + option_arg.str().c_str()); + m_completion_type = completion_type; + } break; default: llvm_unreachable("Unimplemented option"); } @@ -1450,6 +1482,7 @@ m_class_name.clear(); m_funct_name.clear(); m_short_help.clear(); + m_completion_type = eNoCompletion; m_overwrite_lazy = eLazyBoolCalculate; m_synchronicity = eScriptedCommandSynchronicitySynchronous; } @@ -1466,6 +1499,7 @@ LazyBool m_overwrite_lazy = eLazyBoolCalculate; ScriptedCommandSynchronicity m_synchronicity = eScriptedCommandSynchronicitySynchronous; + CompletionType m_completion_type = eNoCompletion; }; void IOHandlerActivated(IOHandler &io_handler, bool interactive) override { @@ -1496,7 +1530,7 @@ CommandObjectSP command_obj_sp(new CommandObjectPythonFunction( m_interpreter, m_cmd_name, funct_name_str, m_short_help, - m_synchronicity)); + m_synchronicity, m_completion_type)); if (!m_container) { Status error = m_interpreter.AddUserCommand( m_cmd_name, command_obj_sp, m_overwrite); @@ -1577,6 +1611,7 @@ m_short_help.assign(m_options.m_short_help); m_synchronicity = m_options.m_synchronicity; + m_completion_type = m_options.m_completion_type; // Handle the case where we prompt for the script code first: if (m_options.m_class_name.empty() && m_options.m_funct_name.empty()) { @@ -1589,7 +1624,7 @@ if (m_options.m_class_name.empty()) { new_cmd_sp.reset(new CommandObjectPythonFunction( m_interpreter, m_cmd_name, m_options.m_funct_name, - m_options.m_short_help, m_synchronicity)); + m_options.m_short_help, m_synchronicity, m_completion_type)); } else { ScriptInterpreter *interpreter = GetDebugger().GetScriptInterpreter(); if (!interpreter) { @@ -1606,7 +1641,8 @@ } new_cmd_sp.reset(new CommandObjectScriptingObject( - m_interpreter, m_cmd_name, cmd_obj_sp, m_synchronicity)); + m_interpreter, m_cmd_name, cmd_obj_sp, m_synchronicity, + m_completion_type)); } // Assume we're going to succeed... @@ -1634,6 +1670,7 @@ bool m_overwrite = false; ScriptedCommandSynchronicity m_synchronicity = eScriptedCommandSynchronicitySynchronous; + CompletionType m_completion_type = eNoCompletion; }; // CommandObjectCommandsScriptList @@ -1706,8 +1743,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::CompleteModifiableCmdPathArgs(m_interpreter, request, - opt_element_vector); + lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs( + m_interpreter, request, opt_element_vector); } protected: @@ -1857,8 +1894,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::CompleteModifiableCmdPathArgs(m_interpreter, request, - opt_element_vector); + lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs( + m_interpreter, request, opt_element_vector); } protected: @@ -1997,8 +2034,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::CompleteModifiableCmdPathArgs(m_interpreter, request, - opt_element_vector); + lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs( + m_interpreter, request, opt_element_vector); } protected: diff --git a/lldb/source/Commands/CommandObjectDWIMPrint.cpp b/lldb/source/Commands/CommandObjectDWIMPrint.cpp --- a/lldb/source/Commands/CommandObjectDWIMPrint.cpp +++ b/lldb/source/Commands/CommandObjectDWIMPrint.cpp @@ -52,9 +52,8 @@ void CommandObjectDWIMPrint::HandleArgumentCompletion( CompletionRequest &request, OptionElementVector &opt_element_vector) { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eVariablePathCompletion, request, nullptr); } bool CommandObjectDWIMPrint::DoExecute(StringRef command, diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -292,9 +292,8 @@ if (request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eFrameIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eFrameIndexCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } @@ -445,9 +444,9 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { // Arguments are the standard source file completer. - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eVariablePathCompletion, request, + nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -161,8 +161,8 @@ ~CommandObjectPlatformSelect() override = default; void HandleCompletion(CompletionRequest &request) override { - CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request, - nullptr); + lldb_private::CommandCompletions::PlatformPluginNames( + GetCommandInterpreter(), request, nullptr); } Options *GetOptions() override { return &m_option_group; } @@ -385,8 +385,7 @@ "Set settings for the current target's platform.", "platform settings", 0), m_option_working_dir(LLDB_OPT_SET_1, false, "working-dir", 'w', - CommandCompletions::eRemoteDiskDirectoryCompletion, - eArgTypePath, + lldb::eRemoteDiskDirectoryCompletion, eArgTypePath, "The working directory for the platform.") { m_options.Append(&m_option_working_dir, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1); } @@ -484,9 +483,9 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex() == 0) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eRemoteDiskFileCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -831,13 +830,12 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex() == 0) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eRemoteDiskFileCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); else if (request.GetCursorIndex() == 1) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -907,9 +905,9 @@ if (request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eRemoteDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -978,9 +976,9 @@ if (request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eRemoteDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -1048,9 +1046,9 @@ if (request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eRemoteDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -1107,13 +1105,12 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex() == 0) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); else if (request.GetCursorIndex() == 1) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eRemoteDiskFileCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRemoteDiskFileCompletion, request, + nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { @@ -1523,9 +1520,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eProcessIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eProcessIDCompletion, request, nullptr); } protected: @@ -1834,9 +1830,8 @@ OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } bool DoExecute(Args &args, CommandReturnObject &result) override { diff --git a/lldb/source/Commands/CommandObjectPlugin.cpp b/lldb/source/Commands/CommandObjectPlugin.cpp --- a/lldb/source/Commands/CommandObjectPlugin.cpp +++ b/lldb/source/Commands/CommandObjectPlugin.cpp @@ -39,9 +39,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -147,9 +147,8 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } Options *GetOptions() override { return &m_all_options; } @@ -1026,9 +1025,8 @@ if (!m_exe_ctx.HasProcessScope()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } Options *GetOptions() override { return &m_options; } diff --git a/lldb/source/Commands/CommandObjectRegexCommand.cpp b/lldb/source/Commands/CommandObjectRegexCommand.cpp --- a/lldb/source/Commands/CommandObjectRegexCommand.cpp +++ b/lldb/source/Commands/CommandObjectRegexCommand.cpp @@ -104,7 +104,7 @@ void CommandObjectRegexCommand::HandleCompletion(CompletionRequest &request) { if (m_completion_type_mask) { - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( GetCommandInterpreter(), m_completion_type_mask, request, nullptr); } } diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -79,9 +79,8 @@ if (!m_exe_ctx.HasProcessScope()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eRegisterCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRegisterCompletion, request, nullptr); } Options *GetOptions() override { return &m_option_group; } @@ -342,9 +341,8 @@ if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eRegisterCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eRegisterCompletion, request, nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectSession.cpp b/lldb/source/Commands/CommandObjectSession.cpp --- a/lldb/source/Commands/CommandObjectSession.cpp +++ b/lldb/source/Commands/CommandObjectSession.cpp @@ -31,9 +31,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -143,9 +143,9 @@ } if (request.GetCursorIndex() == setting_var_idx) { // Attempting to complete setting variable name - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); return; } arg = request.GetParsedLine().GetArgumentAtIndex(request.GetCursorIndex()); @@ -267,9 +267,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -511,9 +511,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -595,9 +595,9 @@ HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -703,9 +703,9 @@ OptionElementVector &opt_element_vector) override { // Attempting to complete variable name if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -795,9 +795,9 @@ OptionElementVector &opt_element_vector) override { // Attempting to complete variable name if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -891,9 +891,9 @@ OptionElementVector &opt_element_vector) override { // Attempting to complete variable name if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -976,9 +976,9 @@ OptionElementVector &opt_element_vector) override { // Attempting to complete variable name if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } protected: @@ -1051,9 +1051,9 @@ OptionElementVector &opt_element_vector) override { // Attempting to complete variable name if (request.GetCursorIndex() < 2) - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSettingsNameCompletion, request, + nullptr); } Options *GetOptions() override { return &m_options; } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -256,9 +256,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } protected: @@ -1846,9 +1845,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eModuleCompletion, request, - nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eModuleCompletion, request, nullptr); } }; @@ -1884,9 +1882,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eSourceFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eSourceFileCompletion, request, nullptr); } }; @@ -2531,9 +2528,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } protected: @@ -4062,8 +4058,8 @@ "target symbols add []", eCommandRequiresTarget), m_file_option( - LLDB_OPT_SET_1, false, "shlib", 's', - CommandCompletions::eModuleCompletion, eArgTypeShlibName, + LLDB_OPT_SET_1, false, "shlib", 's', lldb::eModuleCompletion, + eArgTypeShlibName, "Locate the debug symbols for the shared library specified by " "name."), m_current_frame_option( @@ -4093,9 +4089,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } Options *GetOptions() override { return &m_option_group; } @@ -4944,9 +4939,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eStopHookIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eStopHookIDCompletion, request, nullptr); } protected: @@ -5002,9 +4996,8 @@ OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eStopHookIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eStopHookIDCompletion, request, nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -401,9 +401,9 @@ if (request.GetCursorIndex()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } Options *GetOptions() override { return &m_all_options; } @@ -664,9 +664,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } bool DoExecute(Args &command, CommandReturnObject &result) override { @@ -1161,9 +1161,9 @@ if (request.GetCursorIndex()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } protected: @@ -1295,9 +1295,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } Options *GetOptions() override { return &m_options; } @@ -1345,9 +1345,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override { @@ -1393,9 +1393,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eThreadIndexCompletion, request, + nullptr); } bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override { diff --git a/lldb/source/Commands/CommandObjectTrace.cpp b/lldb/source/Commands/CommandObjectTrace.cpp --- a/lldb/source/Commands/CommandObjectTrace.cpp +++ b/lldb/source/Commands/CommandObjectTrace.cpp @@ -96,9 +96,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } ~CommandObjectTraceSave() override = default; @@ -186,9 +185,8 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); } ~CommandObjectTraceLoad() override = default; diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -1767,9 +1767,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eTypeCategoryNameCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request, + nullptr); } protected: @@ -1869,9 +1869,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eTypeCategoryNameCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request, + nullptr); } protected: @@ -1937,9 +1937,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eTypeCategoryNameCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request, + nullptr); } protected: @@ -2046,9 +2046,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eTypeCategoryNameCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request, + nullptr); } protected: @@ -2111,9 +2111,9 @@ OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex()) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), - CommandCompletions::eTypeCategoryNameCompletion, request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eTypeCategoryNameCompletion, request, + nullptr); } protected: diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -289,9 +289,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eWatchPointIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eWatchpointIDCompletion, request, + nullptr); } protected: @@ -365,9 +365,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eWatchPointIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eWatchpointIDCompletion, request, + nullptr); } protected: @@ -446,9 +446,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eWatchPointIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eWatchpointIDCompletion, request, + nullptr); } Options *GetOptions() override { return &m_options; } @@ -569,9 +569,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eWatchPointIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eWatchpointIDCompletion, request, + nullptr); } Options *GetOptions() override { return &m_options; } @@ -694,9 +694,9 @@ void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override { - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eWatchPointIDCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eWatchpointIDCompletion, request, + nullptr); } Options *GetOptions() override { return &m_options; } @@ -846,9 +846,9 @@ OptionElementVector &opt_element_vector) override { if (request.GetCursorIndex() != 0) return; - CommandCompletions::InvokeCommonCompletionCallbacks( - GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion, - request, nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eVariablePathCompletion, request, + nullptr); } Options *GetOptions() override { return &m_option_group; } diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -804,6 +804,9 @@ EnumArg<"ScriptedCommandSynchronicity">, Desc<"Set the synchronicity of this command's executions with regard to " "LLDB event system.">; + def completion_type : Option<"completion-type", "C">, + EnumArg<"CompletionType">, + Desc<"Specify which completion type the command should use - if none is specified, the command won't use auto-completion.">; } let Command = "container add" in { diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -215,9 +215,9 @@ io_handler.GetDebugger().GetCommandInterpreter().HandleCompletion(request); break; case Completion::Expression: - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( io_handler.GetDebugger().GetCommandInterpreter(), - CommandCompletions::eVariablePathCompletion, request, nullptr); + lldb::eVariablePathCompletion, request, nullptr); break; } } diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp --- a/lldb/source/Core/IOHandlerCursesGUI.cpp +++ b/lldb/source/Core/IOHandlerCursesGUI.cpp @@ -3821,7 +3821,7 @@ // This is a searcher delegate wrapper around CommandCompletions common // callbacks. The callbacks are only given the match string. The completion_mask -// can be a combination of CommonCompletionTypes. +// can be a combination of lldb::CompletionType. class CommonCompletionSearcherDelegate : public SearcherDelegate { public: typedef std::function CallbackType; @@ -3840,7 +3840,7 @@ void UpdateMatches(const std::string &text) override { CompletionResult result; CompletionRequest request(text.c_str(), text.size(), result); - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( m_debugger.GetCommandInterpreter(), m_completion_mask, request, nullptr); result.GetMatches(m_matches); @@ -3852,7 +3852,7 @@ protected: Debugger &m_debugger; - // A compound mask from CommonCompletionTypes. + // A compound mask from lldb::CompletionType. uint32_t m_completion_mask; // A callback to execute once the user selects a match. The match is passed to // the callback as a string. diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -616,9 +616,7 @@ "current file\n" " // containing text 'break " "here'.\n", - CommandCompletions::eSymbolCompletion | - CommandCompletions::eSourceFileCompletion, - false)); + lldb::eSymbolCompletion | lldb::eSourceFileCompletion, false)); if (break_regex_cmd_up) { bool success = true; @@ -669,9 +667,7 @@ "current file\n" " // containing text 'break " "here'.\n", - CommandCompletions::eSymbolCompletion | - CommandCompletions::eSourceFileCompletion, - false)); + lldb::eSymbolCompletion | lldb::eSourceFileCompletion, false)); if (tbreak_regex_cmd_up) { bool success = true; @@ -849,7 +845,7 @@ "_regexp-list 0x
// List around specified address\n" "_regexp-list -[] // List previous lines\n" "_regexp-list // List subsequent lines", - CommandCompletions::eSourceFileCompletion, false)); + lldb::eSourceFileCompletion, false)); if (list_regex_cmd_up) { if (list_regex_cmd_up->AddRegexCommand("^([0-9]+)[[:space:]]*$", "source list --line %1") && diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -66,7 +66,6 @@ void OptionValueArch::AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) { - CommandCompletions::InvokeCommonCompletionCallbacks( - interpreter, CommandCompletions::eArchitectureCompletion, request, - nullptr); + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( + interpreter, lldb::eArchitectureCompletion, request, nullptr); } diff --git a/lldb/source/Interpreter/OptionValueFileColonLine.cpp b/lldb/source/Interpreter/OptionValueFileColonLine.cpp --- a/lldb/source/Interpreter/OptionValueFileColonLine.cpp +++ b/lldb/source/Interpreter/OptionValueFileColonLine.cpp @@ -132,6 +132,6 @@ void OptionValueFileColonLine::AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) { - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( interpreter, m_completion_mask, request, nullptr); } diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -84,7 +84,7 @@ void OptionValueFileSpec::AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) { - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( interpreter, m_completion_mask, request, nullptr); } diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -714,8 +714,8 @@ } } - if (completion_mask & CommandCompletions::eSourceFileCompletion || - completion_mask & CommandCompletions::eSymbolCompletion) { + if (completion_mask & lldb::eSourceFileCompletion || + completion_mask & lldb::eSymbolCompletion) { for (size_t i = 0; i < opt_element_vector.size(); i++) { int cur_defs_index = opt_element_vector[i].opt_defs_index; @@ -748,7 +748,7 @@ } } - CommandCompletions::InvokeCommonCompletionCallbacks( + lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks( interpreter, completion_mask, request, filter_up.get()); } diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -436,6 +436,47 @@ self.dbg.CreateTarget(self.getBuildArtifact("a.out")) self.complete_from_to("target modules dump line-table main.cp", ["main.cpp"]) + def test_custom_command_completion(self): + """Tests completion in custom user provided commands.""" + completion_types = [ + "none", + "source-file", + "disk-file", + "disk-directory", + "symbol", + "module", + "settings-name", + "platform-plugin", + "architecture", + "variable-path", + "register", + "breakpoint", + "process-plugin", + "disassembly-flavor", + "type-language", + "frame-index", + "module-uuid", + "stophook-id", + "thread-index", + "watchpoint-id", + "breakpoint-name", + "process-id", + "process-name", + "remote-disk-file", + "remote-disk-directory", + "type-category-name", + "custom", + ] + self.completions_contain("command script add -C ", completion_types) + + source_path = os.path.join(self.getSourceDir(), "my_test_cmd.py") + self.runCmd("command script import '%s'" % (source_path)) + self.runCmd( + "command script add -C disk-file -f my_test_cmd.my_test_cmd my_test_cmd" + ) + self.complete_from_to("my_test_cmd main.cp", ["main.cpp"]) + self.expect("my_test_cmd main.cpp", substrs=["main.cpp"]) + def test_target_modules_load_aout(self): """Tests modules completion by completing the target modules load argument.""" self.build() diff --git a/lldb/test/API/functionalities/completion/my_test_cmd.py b/lldb/test/API/functionalities/completion/my_test_cmd.py new file mode 100644 --- /dev/null +++ b/lldb/test/API/functionalities/completion/my_test_cmd.py @@ -0,0 +1,2 @@ +def my_test_cmd(debugger, command, exe_ctx, result, dict): + result.Print(command) diff --git a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp --- a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp +++ b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp @@ -120,12 +120,11 @@ if (!O.Completions.empty()) { std::vector CompletionArgs; for (llvm::StringRef Completion : O.Completions) - CompletionArgs.push_back("CommandCompletions::e" + Completion.str() + - "Completion"); + CompletionArgs.push_back("e" + Completion.str() + "Completion"); OS << llvm::join(CompletionArgs.begin(), CompletionArgs.end(), " | "); } else - OS << "CommandCompletions::eNoCompletion"; + OS << "CompletionType::eNoCompletion"; // Add the argument type. OS << ", eArgType";