amccarth created this revision. amccarth added reviewers: emaste, jasonmolenda. amccarth added a subscriber: lldb-commits.
When there were too many arguments given for the `frame select` command, the error message wasn't particularly helpful and then lldb would try to select frame -1, which resulted in an additional confusing error message. This happened when the user expects `f s 1` to be a short form of `frame select 1`, but the `f` itself is an alias for `frame select`, so the `s` is extraneous. The new output should make it easier for the user to understand what went wrong: (lldb) f s 1 error: too many arguments; expect frame-index, saw 's'. Command Options Usage: frame select [-r <offset>] [<frame-index>] -r <offset> ( --relative <offset> ) A relative frame index offset from the current frame index. http://reviews.llvm.org/D15582 Files: packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py source/Commands/CommandObjectFrame.cpp Index: source/Commands/CommandObjectFrame.cpp =================================================================== --- source/Commands/CommandObjectFrame.cpp +++ source/Commands/CommandObjectFrame.cpp @@ -262,8 +262,10 @@ } else { - result.AppendError ("invalid arguments.\n"); + result.AppendErrorWithFormat ("too many arguments; expected frame-index, saw '%s'.\n", + command.GetArgumentAtIndex(0)); m_options.GenerateOptionUsage (result.GetErrorStream(), this); + return false; } } Index: packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py +++ packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py @@ -29,6 +29,7 @@ ('dis', 'disassemble'), ('ta st a', 'target stop-hook add'), ('fr v', 'frame variable'), + ('f 1', 'frame select 1'), ('ta st li', 'target stop-hook list'), ]
Index: source/Commands/CommandObjectFrame.cpp =================================================================== --- source/Commands/CommandObjectFrame.cpp +++ source/Commands/CommandObjectFrame.cpp @@ -262,8 +262,10 @@ } else { - result.AppendError ("invalid arguments.\n"); + result.AppendErrorWithFormat ("too many arguments; expected frame-index, saw '%s'.\n", + command.GetArgumentAtIndex(0)); m_options.GenerateOptionUsage (result.GetErrorStream(), this); + return false; } } Index: packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py +++ packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py @@ -29,6 +29,7 @@ ('dis', 'disassemble'), ('ta st a', 'target stop-hook add'), ('fr v', 'frame variable'), + ('f 1', 'frame select 1'), ('ta st li', 'target stop-hook list'), ]
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits