Sunday, July 8, 2012

Xcode Debugger

Apple Xcode debugger documentation
Also, Paul Hegarty's Debugger Video on iTunes.

The debug console (lower right) has a prompt (e.g. (gdb) or (lldb)) where you can enter commands to get some feedback about objects at the current breakpoint.

(lldb) print self

(lldb) po [self someObjectGetter]


You can also do conditional breakpoints.  Conditional breakpoints mean that at some point in your program you only want a breakpoint to interrupt your program when a certain 'condition' exists.  For example, if you have an int value variable and you only want it to break when the value == 3.

To make a breakpoint conditional in Xcode, right-click on the breakpoint and select 'Edit Breakpoint' from the popup menu.  A little popup dialog (see image) will be presented.  Enter the desired condition and click done.

No comments:

Post a Comment