diff options
Diffstat (limited to 'source/Interpreter/CommandObject.cpp')
-rw-r--r-- | source/Interpreter/CommandObject.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source/Interpreter/CommandObject.cpp b/source/Interpreter/CommandObject.cpp index 8e493c7a326f..d666852ee68c 100644 --- a/source/Interpreter/CommandObject.cpp +++ b/source/Interpreter/CommandObject.cpp @@ -257,14 +257,14 @@ void CommandObject::Cleanup() { m_api_locker.unlock(); } -int CommandObject::HandleCompletion(CompletionRequest &request) { +void CommandObject::HandleCompletion(CompletionRequest &request) { // Default implementation of WantsCompletion() is !WantsRawCommandString(). // Subclasses who want raw command string but desire, for example, argument // completion should override WantsCompletion() to return true, instead. if (WantsRawCommandString() && !WantsCompletion()) { // FIXME: Abstract telling the completion to insert the completion // character. - return -1; + return; } else { // Can we do anything generic with the options? Options *cur_options = GetOptions(); @@ -278,11 +278,11 @@ int CommandObject::HandleCompletion(CompletionRequest &request) { bool handled_by_options = cur_options->HandleOptionCompletion( request, opt_element_vector, GetCommandInterpreter()); if (handled_by_options) - return request.GetNumberOfMatches(); + return; } // If we got here, the last word is not an option or an option argument. - return HandleArgumentCompletion(request, opt_element_vector); + HandleArgumentCompletion(request, opt_element_vector); } } @@ -917,12 +917,21 @@ const char *CommandObject::GetArgumentDescriptionAsCString( return g_arguments_data[arg_type].help_text; } -Target *CommandObject::GetDummyTarget() { - return m_interpreter.GetDebugger().GetDummyTarget(); +Target &CommandObject::GetDummyTarget() { + return *m_interpreter.GetDebugger().GetDummyTarget(); +} + +Target &CommandObject::GetSelectedOrDummyTarget(bool prefer_dummy) { + return *m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy); } -Target *CommandObject::GetSelectedOrDummyTarget(bool prefer_dummy) { - return m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy); +Target &CommandObject::GetSelectedTarget() { + assert(m_flags.AnySet(eCommandRequiresTarget | eCommandProcessMustBePaused | + eCommandProcessMustBeLaunched | eCommandRequiresFrame | + eCommandRequiresThread | eCommandRequiresProcess | + eCommandRequiresRegContext) && + "GetSelectedTarget called from object that may have no target"); + return *m_interpreter.GetDebugger().GetSelectedTarget(); } Thread *CommandObject::GetDefaultThread() { @@ -958,7 +967,7 @@ bool CommandObjectParsed::Execute(const char *args_string, } if (!handled) { for (auto entry : llvm::enumerate(cmd_args.entries())) { - if (!entry.value().ref.empty() && entry.value().ref.front() == '`') { + if (!entry.value().ref().empty() && entry.value().ref().front() == '`') { cmd_args.ReplaceArgumentAtIndex( entry.index(), m_interpreter.ProcessEmbeddedScriptCommands(entry.value().c_str())); @@ -1064,7 +1073,7 @@ CommandObject::ArgumentTableEntry CommandObject::g_arguments_data[] = { { eArgTypePythonScript, "python-script", CommandCompletions::eNoCompletion, { nullptr, false }, "Source code written in Python." }, { eArgTypeQueueName, "queue-name", CommandCompletions::eNoCompletion, { nullptr, false }, "The name of the thread queue." }, { eArgTypeRegisterName, "register-name", CommandCompletions::eNoCompletion, { RegisterNameHelpTextCallback, true }, nullptr }, - { eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, { nullptr, false }, "A regular expression." }, + { eArgTypeRegularExpression, "regular-expression", CommandCompletions::eNoCompletion, { nullptr, false }, "A POSIX-compliant extended regular expression." }, { eArgTypeRunArgs, "run-args", CommandCompletions::eNoCompletion, { nullptr, false }, "Arguments to be passed to the target program when it starts executing." }, { eArgTypeRunMode, "run-mode", CommandCompletions::eNoCompletion, { nullptr, false }, "Help text goes here." }, { eArgTypeScriptedCommandSynchronicity, "script-cmd-synchronicity", CommandCompletions::eNoCompletion, { nullptr, false }, "The synchronicity to use to run scripted commands with regard to LLDB event system." }, |