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. See The Text Editor to learn more about the text editor’s capabilities.

This chapter describes how to debug your program from the text editor.

Text Editor Debugger Controls

Text Editor Debugger Controls shows the text editor and the debugging controls it provides.

Figure 3-1  Debugging in the text editor
Debugging in the text editor

These are the controls identified in the figure:

Debugger Strip

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

Figure 3-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. You can view your program’s variables using a debugger datatip. When the pointer hovers over a variable, its contents are progressively disclosed using disclosure triangles. You can also modify the contents of mutable variables.

Figure 3-3 shows a debugger datatip showing the contents of the bounds variable. In addition to viewing the variable’s value, you can also modify that value. 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 3-3  Changing variables with debugger datatips in the text editor
Changing variables with debugger datatips in the text editorChanging 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 below that row. (You can turn off this behavior, as explained later.) When the pointer hovers to the right of the disclosure triangle, a 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. These controls allow you to perform Continue, Step Into, and Step Over commands from the content pane of the text editor. To turn on step controls, chose Run > Debugger Display > Datatips > Step Controls.

These are the commands step controls provide: