diff options
author | Jim Ingham <jingham@apple.com> | 2022-06-23 09:33:40 -0700 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2022-06-27 15:14:41 -0700 |
commit | c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a (patch) | |
tree | ed7886491e1a97d19af06525fca43987a3dfb0a9 /lldb/source/Commands/CommandObjectGUI.cpp | |
parent | 6824eee94203b16de7633050367505c2ad10c56a (diff) | |
download | llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.zip llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.tar.gz llvm-c1b07d617705dfdb3aabbdda51c1a40d99f7cc1a.tar.bz2 |
Have CommandObjectParsed check for "commands that take no arguments".
This is currently being done in an ad hoc way, and so for some
commands it isn't being checked. We have the info to make this check,
since commands are supposed to add their arguments to the m_arguments
field of the CommandObject. This change uses that info to check whether
the command received arguments in error.
A handful of commands weren't defining their argument types, I also had
to fix them. And a bunch of commands were checking for arguments by
hand, so I removed those checks in favor of the CommandObject one. That
also meant I had to change some tests that were checking for the ad hoc
error outputs.
Differential Revision: https://reviews.llvm.org/D128453
Diffstat (limited to 'lldb/source/Commands/CommandObjectGUI.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectGUI.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lldb/source/Commands/CommandObjectGUI.cpp b/lldb/source/Commands/CommandObjectGUI.cpp index 86c47a2..a63d171 100644 --- a/lldb/source/Commands/CommandObjectGUI.cpp +++ b/lldb/source/Commands/CommandObjectGUI.cpp @@ -26,22 +26,18 @@ CommandObjectGUI::~CommandObjectGUI() = default; bool CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) { #if LLDB_ENABLE_CURSES - if (args.GetArgumentCount() == 0) { - Debugger &debugger = GetDebugger(); - - File &input = debugger.GetInputFile(); - File &output = debugger.GetOutputFile(); - if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() && - input.GetIsInteractive()) { - IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger)); - if (io_handler_sp) - debugger.RunIOHandlerAsync(io_handler_sp); - result.SetStatus(eReturnStatusSuccessFinishResult); - } else { - result.AppendError("the gui command requires an interactive terminal."); - } + Debugger &debugger = GetDebugger(); + + File &input = debugger.GetInputFile(); + File &output = debugger.GetOutputFile(); + if (input.GetStream() && output.GetStream() && input.GetIsRealTerminal() && + input.GetIsInteractive()) { + IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger)); + if (io_handler_sp) + debugger.RunIOHandlerAsync(io_handler_sp); + result.SetStatus(eReturnStatusSuccessFinishResult); } else { - result.AppendError("the gui command takes no arguments."); + result.AppendError("the gui command requires an interactive terminal."); } return true; #else |