[PATCH] D53010: Add an alias "var" for "frame var" and "vo" for "frame var -O"

Jim Ingham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 17:53:33 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL344102: Add "var" and "vo" aliases for "frame variable" and "frame variable -O". (authored by jingham, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53010?vs=168742&id=168927#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53010

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


Index: lldb/trunk/source/Commands/CommandObjectFrame.cpp
===================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp
@@ -427,7 +427,17 @@
             "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),
Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
===================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp
@@ -423,6 +423,13 @@
   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() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53010.168927.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181010/a27d4e40/attachment.bin>


More information about the llvm-commits mailing list