[Lldb-commits] [lldb] r359927 - [Alias] Add 're' alias for register

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri May 3 13:37:09 PDT 2019


Author: jdevlieghere
Date: Fri May  3 13:37:09 2019
New Revision: 359927

URL: http://llvm.org/viewvc/llvm-project?rev=359927&view=rev
Log:
[Alias] Add 're' alias for register

This patch makes `re` an alias for `register`. Currently `re<TAB>` gives
you the choice between `register` and `reproducer`. Given that you use
`register` a lot more often, it should win for the common substring.

Differential revision: https://reviews.llvm.org/D61469

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py?rev=359927&r1=359926&r2=359927&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py Fri May  3 13:37:09 2019
@@ -187,7 +187,8 @@ class RegisterCommandsTestCase(TestBase)
         elif not value.IsValid():
             return  # If register doesn't exist, skip this test
 
-        self.runCmd("register write " + register + " \'" + new_value + "\'")
+        # Also test the 're' alias.
+        self.runCmd("re write " + register + " \'" + new_value + "\'")
         self.expect(
             "register read " +
             register,

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=359927&r1=359926&r2=359927&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri May  3 13:37:09 2019
@@ -429,6 +429,11 @@ void CommandInterpreter::Initialize() {
     AddAlias("var", cmd_obj_sp);
     AddAlias("vo", cmd_obj_sp, "--object-description");
   }
+
+  cmd_obj_sp = GetCommandSPExact("register", false);
+  if (cmd_obj_sp) {
+    AddAlias("re", cmd_obj_sp);
+  }
 }
 
 void CommandInterpreter::Clear() {




More information about the lldb-commits mailing list