Debugging from four different locations
In Xcode, debugging can be performed from four different locations:
- Code Editor Window
- Debugger Window
- GDB Console
- Mini Debugger
Code Editor Window
You can set breakpoints right in the source code editor by clicking in the gutter (the left margin). When the program is run, the execution will stop if any of these breakpoints are hit.
Figure 1. Debugging from the source code editor window of Xcode. There is a debugger bar at the top of the window. Variable values can be obtained by moving the cursor over to the variable.

As you can see from the figure above, the blue tab in the left margin denotes the breakpoint. The red arrow says that that is the next line to execute. By moving the cursor over a variable, you can see the details of that variable.
In the figure above, the cursor is over the book object, which has members like author, copyright, title, etc. By simply moving the cursor over book variable, you can find out the values of these members. You can further drill down into the objects by clicking on the arrows on the left. These are called Debugger Datatips. By clicking on the up-down arrow in the datatip, you will get datatip menu which provides additional functionality to deal with the variable in question.
Figure 2. The Debugger Datatip menu in Xcode

As you can see from the menu, you can jump to the place where the variable is defined or look it up in the documentation. You can obtain the description, open the variable in a separate window or look at the memory it occupies.
There is a debugger tab at the top of the source code window. The buttons on this tab provide the primary debugger functionality: Continue Execution, Step Over Method or Function Call, Step Into Method or Function Call, and Step Out of Current Method or Function. In addition, you can move to a different thread or start the GUI Debugger Window or Console Debugger Window (discussed below).
Debugger Window
The debugger functionality is also available from the GUI Debugger window in Xcode. You can open this window by clicking on the Debugger icon in the source editor toolbar or choosing Run - Debugger menu.
Figure 3. The Debugger window from Xcode. In addition to the code window, you have call stack and variable information.

This is the most useful window for graphical debugging. In addition to source code (where the current breakpoint is), you will also see the call stack of methods/functions (stack frames) to get to this point. There is also a Variable Window that provides the values of various variables of relevance at that point of execution.
Debugger Console
The Debugger Console provides the most powerful debugging functionality in Xcode. This console is the front-end to the GDB (GNU Debugger). From other places (the editor, GUI Debugger), the information is presented graphically. For most of the regular debugging sessions, that functionality is good enough. Here with GDB Console, the information is presented in text in response to the commands you issue. GDB comes with a whole set of powerful debugging commands.
In the figure below, GDB shows the call stack in response to the command bt (which stands for backtrace).
Figure 4. The Debugger Console. Here you can execute the GDB debugger commands. Here the call stack as a response to the command bt is displayed.

Mini Debugger
When you want the least interference from your debugger (useful when trying to reproduces the hard-to-reproduce issues), you would want to use the mini debugger. This mini debugger comes in two modes: when it’s attached to the program (you can see the source at the breakpoint) and when it’s disengaged (i.e. you will see a small list of toolbar buttons to stop or pause the program).
Figure 5. The Mini Debugger Window of Xcode

Figure 6. The Mini Debugger when disengaged from the application
