9

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?

Community
  • 1
  • 1
NSTJ
  • 3,858
  • 2
  • 27
  • 34
  • By marking breakpoint, and moving the mouse pointer to that variable – Anoop Vaidya Apr 13 '13 at 13:44
  • @AnoopVaidya no dice - see [here](http://picpaste.com/pics/Screen_Shot_2013-04-13_at_11.58.11_PM-jgwMuzoL.1365861570.png) – NSTJ Apr 13 '13 at 14:00
  • How that popup window came? right clicked? – Anoop Vaidya Apr 13 '13 at 14:13
  • no just hovering over the variable and clicking on the arrow. Are you using 4.6? – NSTJ Apr 13 '13 at 14:19
  • yes...... It should work. Check with some other XCode on diffrnt systems. get conformed and then re-install XCode. – Anoop Vaidya Apr 13 '13 at 14:23
  • Thanks, reinstalling Xcode is a bit drastic and like I said I'd just like to be able to run the `po` command anyways. A lot of other people are having the same problem so I'm hoping a fix is on the way. – NSTJ Apr 13 '13 at 14:25
  • A lot of people!!!!! Let me check again with XCode4.6.1. I have XCode4.6.0 there it is perfect. – Anoop Vaidya Apr 13 '13 at 14:27

3 Answers3

4

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

Moray
  • 321
  • 2
  • 9
  • 1
    Have you tried doing this with Xcode 4.6? There is a lag of up to 30s to right click on one of the variables in that pane, not to mention objects, ivars etc. – NSTJ Apr 13 '13 at 14:59
  • Well I'm using 4.6.1 and I have no lag at all when I right-click. And why to right-click? You have the values without clicking. – Moray Apr 13 '13 at 15:04
  • what if it is a dictionary? or an ivar which you want to inspect? – NSTJ Apr 13 '13 at 15:17
  • I have a little dictionary with 3 key/value pairs, still not any lag or delay. – Moray Apr 13 '13 at 15:34
1

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.
user352891
  • 1,181
  • 1
  • 8
  • 14
  • 1
    the problem with Xcode 4.6 is that for many users the `p`/`po` commands are very slow http://stackoverflow.com/questions/14760206/po-command-in-xcode-4-6-is-very-slow-the-first-time – NSTJ Apr 13 '13 at 15:36
0

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

Community
  • 1
  • 1
NSTJ
  • 3,858
  • 2
  • 27
  • 34