From: Adrian McCarthy Date: Tue, 22 Dec 2015 16:50:28 +0000 (+0000) Subject: Improve error handling for `frame select` command when there are too many arguments. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2961ab889fb983df13f7953e1535859d7a45116;p=platform%2Fupstream%2Fllvm.git Improve error handling for `frame select` command when there are too many arguments. Bug: https://llvm.org/bugs/show_bug.cgi?id=25847 It now gives a more specific error message and then returns instead of trying to select the wrong frame. llvm-svn: 256251 --- diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py b/lldb/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py index 683ef04..9edbf21 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py @@ -29,6 +29,7 @@ class CommonShortSpellingsTestCase(TestBase): ('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'), ] diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index e8dc33a..9477b50 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -262,8 +262,10 @@ protected: } 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; } }