Author: enrico Date: Fri Mar 25 16:59:06 2016 New Revision: 264468 URL: http://llvm.org/viewvc/llvm-project?rev=264468&view=rev Log: Fix an issue with nested aliases where the help system wouldn't correctly track the fact that an alias is an alias to a dash-dash alias (and I hope I typed the word 'alias' enough times in this commit message :-)
Modified: lldb/trunk/include/lldb/Interpreter/CommandAlias.h lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py lldb/trunk/source/Interpreter/CommandAlias.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandAlias.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandAlias.h?rev=264468&r1=264467&r2=264468&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandAlias.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandAlias.h Fri Mar 25 16:59:06 2016 @@ -106,6 +106,10 @@ public: std::pair<lldb::CommandObjectSP, OptionArgVectorSP> Desugar (); +protected: + bool + IsNestedAlias (); + private: lldb::CommandObjectSP m_underlying_command_sp; std::string m_option_string; Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py?rev=264468&r1=264467&r2=264468&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/nested_alias/TestNestedAlias.py Fri Mar 25 16:59:06 2016 @@ -46,6 +46,8 @@ class NestedAliasTestCase(TestBase): def cleanup(): self.runCmd('command unalias read', check=False) self.runCmd('command unalias rd', check=False) + self.runCmd('command unalias fo', check=False) + self.runCmd('command unalias foself', check=False) # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) @@ -58,3 +60,9 @@ class NestedAliasTestCase(TestBase): self.expect('memory read -f A -c 3 `&my_ptr[0]`', substrs=['deadfeed'], matching=False) self.expect('rd `&my_ptr[0]`', substrs=['deadfeed'], matching=False) + + self.runCmd('command alias fo frame variable -O --') + self.runCmd('command alias foself fo self') + + self.expect('help foself', substrs=['--show-all-children', '--raw-output'], matching=False) + self.expect('help foself', substrs=['Show frame variables.'], matching=True) Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=264468&r1=264467&r2=264468&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandAlias.cpp (original) +++ lldb/trunk/source/Interpreter/CommandAlias.cpp Fri Mar 25 16:59:06 2016 @@ -236,11 +236,22 @@ CommandAlias::IsDashDashCommand () break; } } + // if this is a nested alias, it may be adding arguments on top of an already dash-dash alias + if ((m_is_dashdash_alias == eLazyBoolNo) && IsNestedAlias()) + m_is_dashdash_alias = (GetUnderlyingCommand()->IsDashDashCommand() ? eLazyBoolYes : eLazyBoolNo); } } return (m_is_dashdash_alias == eLazyBoolYes); } +bool +CommandAlias::IsNestedAlias () +{ + if (GetUnderlyingCommand()) + return GetUnderlyingCommand()->IsAlias(); + return false; +} + std::pair<lldb::CommandObjectSP, OptionArgVectorSP> CommandAlias::Desugar () { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits