How do I quickly inspect the value of an arbitrary

2019-04-22 11:46发布

It seems reasonably widely acknowledged that it is slow to use the po command in Xcode 4.6.x. What are the options for inspecting the values of arbitrary variables unspecified at compile time (which rules out usage of NSLog()) which don't take > 15s?

3条回答
在下西门庆
2楼-- · 2019-04-22 12:26

Turns out the answer is pretty simple: download Xcode 4.6.2 where LLDB debugging speed has been increased significantly. Note some discussion over here

查看更多
迷人小祖宗
3楼-- · 2019-04-22 12:32

Just set a breakpoint where you want to learn the variables' value. Once the program is paused, a summary of all the variables' value will appear on the Varibles view on the left-bottom of the screen. Here is a screenshot :

enter image description here

查看更多
The star\"
4楼-- · 2019-04-22 12:41

You can use the lldb commands:

p (int) myInt
po myObject
po myObject.memberObject
p (float) myObject.floatMember

Just a note, you could also use p instead of po in the newest version of Xcode. If you run the help -a in llb, it will present you with command aliases, below is a snippet of the commands you could use.

> (lldb) help -a  
p         -- ('expression --')  Evaluate a C/ObjC/C++ expression in the current
         program context, using user defined variables and variables
         currently in scope.  

po        -- ('expression -o  --')  Evaluate a C/ObjC/C++ expression in the
         current program context, using user defined variables and
         variables currently in scope  

print     -- ('expression --')  Evaluate a C/ObjC/C++ expression in the current
         program context, using user defined variables and variables
         currently in scope.
查看更多
登录 后发表回答