[Lldb-commits] [lldb] r256251 - Improve error handling for `frame select` command when there are too many arguments.

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 22 08:50:28 PST 2015


Author: amccarth
Date: Tue Dec 22 10:50:28 2015
New Revision: 256251

URL: http://llvm.org/viewvc/llvm-project?rev=256251&view=rev
Log:
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.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py
    lldb/trunk/source/Commands/CommandObjectFrame.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py?rev=256251&r1=256250&r2=256251&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/abbreviation/TestCommonShortSpellings.py Tue Dec 22 10:50:28 2015
@@ -29,6 +29,7 @@ class CommonShortSpellingsTestCase(TestB
             ('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'),
         ]
 

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=256251&r1=256250&r2=256251&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Dec 22 10:50:28 2015
@@ -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;
             }
         }
 




More information about the lldb-commits mailing list