Often times we would want to hold some temporary variables when debugging with lldb
. We can make use of expression
in such cases. An expression
, short form e
or expr
evaluates the given statement. If we use an assignment with a variable starting with $
, that variable will be available throughout and can be used in other expressions.
Since we are in single-line expression mode, there are slight differences in the way the expressions work. We need to cast NSRange
. A better option in this case is to use the multi-line expression mode. For that, first enter expr↩
which is followed by a carriage return. The lldb is now in multi-line expression mode where we can enter normal Objective-C (or Swift) code with each line terminated with a semi-colon and an empty line after the final statement will evaluate all the expressions and exit the mode.
Multi-line expression with lldb
makes debugging much better.