[Lldb-commits] [lldb] r344102 - Add "var" and "vo" aliases for "frame variable" and "frame variable -O".

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 9 17:51:30 PDT 2018


Author: jingham
Date: Tue Oct  9 17:51:30 2018
New Revision: 344102

URL: http://llvm.org/viewvc/llvm-project?rev=344102&view=rev
Log:
Add "var" and "vo" aliases for "frame variable" and "frame variable -O".

Differential Revision: https://reviews.llvm.org/D53010

Modified:
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=344102&r1=344101&r2=344102&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Oct  9 17:51:30 2018
@@ -427,7 +427,17 @@ public:
             "arguments and local variables in scope. Names of argument, "
             "local, file static and file global variables can be specified. "
             "Children of aggregate variables can be specified such as "
-            "'var->child.x'.",
+            "'var->child.x'.  The -> and [] operators in 'frame variable' do "
+            "not invoke operator overloads if they exist, but directly access "
+            "the specified element.  If you want to trigger operator overloads "
+            "use the expression command to print the variable instead."
+            "\nIt is worth noting that except for overloaded "
+            "operators, when printing local variables 'expr local_var' and "
+            "'frame var local_var' produce the same "
+            "results.  However, 'frame variable' is more efficient, since it "
+            "uses debug information and memory reads directly, rather than "
+            "parsing and evaluating an expression, which may even involve "
+            "JITing and running code in the target program.",
             nullptr, eCommandRequiresFrame | eCommandTryTargetAPILock |
                          eCommandProcessMustBeLaunched |
                          eCommandProcessMustBePaused | eCommandRequiresProcess),

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=344102&r1=344101&r2=344102&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Oct  9 17:51:30 2018
@@ -423,6 +423,13 @@ void CommandInterpreter::Initialize() {
   if (cmd_obj_sp) {
     AddAlias("rbreak", cmd_obj_sp, "--func-regex %1");
   }
+
+  cmd_obj_sp = GetCommandSPExact("frame variable", false);
+  if (cmd_obj_sp) {
+    AddAlias("var", cmd_obj_sp);
+    AddAlias("vo", cmd_obj_sp, "--object-description");
+  }
+  
 }
 
 void CommandInterpreter::Clear() {




More information about the lldb-commits mailing list