Does LLDB have convenience variables? If so, how do I use them? If no, is there any similar things to use?
Reference: http://software.intel.com/sites/products/documentation/hpc/atom/application/debugger/commands143.html
Does LLDB have convenience variables? If so, how do I use them? If no, is there any similar things to use?
Reference: http://software.intel.com/sites/products/documentation/hpc/atom/application/debugger/commands143.html
I finally figured it out myself. Run help expr
in LLDB and you will see:
User defined variables: You can define your own variables for convenience or to be used in subsequent expressions. You define them the same way you would define variables in C. If the first character of your user defined variable is a $, then the variable's value will be available in future expressions, otherwise it will just be available in the current expression.
So expr int $foo = 5
is what I want.
I struggled with this today. Here's what it looks like to deal with Objective-C variables in LLDB:
expr UIApplication *$app = (UIApplication *)[UIApplication sharedApplication]
expr UIWindow *$keyWindow = (UIWindow *)[$app keyWindow]
etc. I've found LLDB works best if you don't nest any calls, and you explicitly give a return type on every call.
Still I am getting a segmentation fault when I try to make initWithFrame:
work on a UIView later on though. :/
Just use the form:
(lldb) expr var
From their tutorial:
(lldb) expr self $0 = (SKTGraphicView *) 0x0000000100135430 (lldb) expr self = 0x00 $1 = (SKTGraphicView *) 0x0000000000000000
You can also call functions:
(lldb) expr (int) printf ("I have a pointer 0x%llx.\n", self) $2 = (int) 22 I have a pointer 0x0. (lldb) expr self = $0 $4 = (SKTGraphicView *) 0x0000000100135430