< Previous PageNext Page > Hide TOC

Debugging in the Text Editor

You can perform many debugging tasks in the text editor, including controlling program flow, managing breakpoints and watchpoints, and viewing program memory. Figure 2-1 shows the text editor and the debugging controls it provides.


Figure 2-1  Debugging in the text editor

Debugging in the text editor

These are the controls identified in Figure 2-1:

This chapter describes these controls in detail.

In this section:

Debugger Strip
Gutter Shortcut Menu
Debugger Datatips


Debugger Strip

The debugger strip (Figure 2-2) is a small control strip that appears above the content pane. It lets you perform several debugging tasks.


Figure 2-2  Debugger strip

Debugger strip

These are the items in the debugger strip:

Gutter Shortcut Menu

The text editor gutter includes several shortcuts to debugging facilities. The code line indicated by the pointer at the time you choose the shortcut is the action line. These include:

Debugger Datatips

As you debug your program in the text editor, you may need to analyze the contents of the program’s variables as you step through code lines. Xcode provides debugger datatips to let you view and change your program’s variables. A debugger datatip is a control that provides access to the contents variables using a progressive disclosure mechanism driven by hovering the pointer over the control. You can also modify the contents of mutable variables using datatips.

Figure 2-3 shows a debugger datatip showing the contents of the bounds variable. In addition to viewing the variable’s value, the figure shows how you can modify the value. In this case, after double-clicking the value of the height field of the size structure, you can change it to another value before executing the code line that uses the bounds variable.


Figure 2-3  Changing variables with debugger datatips in the text editor

Changing variables with debugger datatips in the text editor

As you move the pointer over a disclosure triangle in a datatip row, the contents of the field the row represents are disclosed bellow that row. (You can turn off this behavior, as explained later.) When you hover the pointer to the right of the disclosure triangle control with two small triangles appears. Clicking that control shows the datatip menu. The datatip menu provides the following commands.

Debugger datatips also provide program-flow–control controls called step controls. Step controls allow you to perform perform Continue, Step In, and Step Over commands from the content pane of the text editor. To turn on step controls, use Run > Debugger Display > Datatips > Step Controls.

These are the commands step controls provide:



< Previous PageNext Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-01-06)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.