diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-18 20:30:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-04-06 20:11:55 +0000 |
commit | 5f757f3ff9144b609b3c433dfd370cc6bdc191ad (patch) | |
tree | 1b4e980b866cd26a00af34c0a653eb640bd09caf /contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp | |
parent | 3e1c8a35f741a5d114d0ba670b15191355711fe9 (diff) | |
parent | 312c0ed19cc5276a17bacf2120097bec4515b0f1 (diff) |
Diffstat (limited to 'contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp')
-rw-r--r-- | contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp b/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp index f78fc728c898..e1275ce711fc 100644 --- a/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp @@ -46,7 +46,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/StreamFile.h" +#include "lldb/Host/StreamFile.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/State.h" @@ -128,8 +128,8 @@ CommandInterpreter::CommandInterpreter(Debugger &debugger, bool synchronous_execution) : Broadcaster(debugger.GetBroadcasterManager(), CommandInterpreter::GetStaticBroadcasterClass().AsCString()), - Properties(OptionValuePropertiesSP( - new OptionValueProperties(ConstString("interpreter")))), + Properties( + OptionValuePropertiesSP(new OptionValueProperties("interpreter"))), IOHandlerDelegate(IOHandlerDelegate::Completion::LLDBCommand), m_debugger(debugger), m_synchronous_execution(true), m_skip_lldbinit_files(false), m_skip_app_init_files(false), @@ -508,6 +508,11 @@ void CommandInterpreter::Initialize() { if (cmd_obj_sp) { AddAlias("history", cmd_obj_sp); } + + cmd_obj_sp = GetCommandSPExact("help"); + if (cmd_obj_sp) { + AddAlias("h", cmd_obj_sp); + } } void CommandInterpreter::Clear() { @@ -1227,36 +1232,11 @@ CommandObject * CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str, StringList *matches, StringList *descriptions) const { - CommandObject *command_obj = - GetCommandSP(cmd_str, false, true, matches, descriptions).get(); - - // If we didn't find an exact match to the command string in the commands, - // look in the aliases. - - if (command_obj) - return command_obj; - - command_obj = GetCommandSP(cmd_str, true, true, matches, descriptions).get(); - - if (command_obj) - return command_obj; - - // If there wasn't an exact match then look for an inexact one in just the - // commands - command_obj = GetCommandSP(cmd_str, false, false, nullptr).get(); - - // Finally, if there wasn't an inexact match among the commands, look for an - // inexact match in both the commands and aliases. - - if (command_obj) { - if (matches) - matches->AppendString(command_obj->GetCommandName()); - if (descriptions) - descriptions->AppendString(command_obj->GetHelp()); - return command_obj; - } - - return GetCommandSP(cmd_str, true, false, matches, descriptions).get(); + // Try to find a match among commands and aliases. Allowing inexact matches, + // but perferring exact matches. + return GetCommandSP(cmd_str, /*include_aliases=*/true, /*exact=*/false, + matches, descriptions) + .get(); } CommandObject *CommandInterpreter::GetUserCommandObject( @@ -1793,7 +1773,7 @@ CommandInterpreter::PreprocessToken(std::string &expr_str) { StreamString value_strm; const bool show_type = false; - scalar.GetValue(&value_strm, show_type); + scalar.GetValue(value_strm, show_type); size_t value_string_size = value_strm.GetSize(); if (value_string_size) { expr_str = value_strm.GetData(); |