How to Manage Breakpoints in Xcode4 - dummies

By Neal Goldstein, Dave Wilson

You can use Xcode4’s debugger to pause execution of your iOS program at any time and view the state of the running code. This helps you produce more bug-free code for your app.

You won’t find much to see in the Debug area and Debug navigator unless your program is stopped at a breakpoint or paused (and not much at those points, either). The debugger is more useful to you if you set breakpoints to stop at known points and then view the values of the variables in your source code.

Given that fact, it’s probably time to show you how to set a breakpoint and explain what a breakpoint is.

A breakpoint is an instruction to the debugger to stop execution at a particular program instruction. By setting breakpoints at various methods in your program, you can step through its execution — at the instruction level — to see exactly what it’s doing. You can also examine the variables that the program is setting and using. If you’re stymied by a logic error, setting breakpoints is a great way to break that logjam.

To set breakpoints, open a file in the Source editor and click in the Gutter — the column between the Navigator area and the Focus ribbon that is adjacent to the Editor area in the figure — next to the spot where you want execution to stop.


You can toggle the state (on or off) of all the breakpoints in your program at any time by clicking the Breakpoints button in the Xcode toolbar (to the left of the Activity viewer).

To disable an individual breakpoint, click its icon in the gutter. To get rid of a breakpoint completely, simply drag it off to the side. You can also right-click (or Control-click) the breakpoint and choose Remove Breakpoint from the pop-up menu that appears.