This is an archive of the discontinued LLVM Phabricator instance.

Add an alias "var" for "frame var" and "vo" for "frame var -O"
ClosedPublic

Authored by jingham on Oct 8 2018, 6:42 PM.

Details

Summary

"expression" is a hugely inefficient way to get the value of a local variable. There are a few cases where "frame variable" and "expression" will produce different results on the same expression (e.g. "foo->bar" when foo has an -> operator overload). But in general, if you are printing a local var, "frame var" is way more efficient. I've been trying to teach people to use 'frame var' more when it is appropriate, and it was suggested that adding a top-level alias for it might make the command easier to find and remember.

This patch adds two aliases:

var - frame var
vo - frame var -O

The latter is for our ObjC friends who often see the object description, rather than the object's ivars, as the primary source of information about the object.

I also added some caveats to the frame var help page.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

jingham created this revision.Oct 8 2018, 6:42 PM
davide accepted this revision.EditedOct 8 2018, 6:49 PM
davide added a subscriber: davide.

LG. If you can add a line (so that we can test this) to an existing inline test, I think it would be excellent.

This revision is now accepted and ready to land.Oct 8 2018, 6:49 PM
clayborg accepted this revision.Oct 9 2018, 7:45 AM
This revision was automatically updated to reflect the committed changes.

Currently v is an alias for version. I'd wager that — compared to printing a variable — LLDB user's almost never want to print LLDB's version. Would it make sense to re-purpose the single-letter v abbreviation for the much more frequently used frame variable action?

Currently v is an alias for version. I'd wager that — compared to printing a variable — LLDB user's almost never want to print LLDB's version. Would it make sense to re-purpose the single-letter v abbreviation for the much more frequently used frame variable action?

+1 for v as an alias for frame variable.