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” shows the text editor and the debugging controls it provides.
These are the controls identified in the figure:
Debugger strip. Compresses several debugger controls into a small space.
Gutter. Gives you access to a few debugging commands through its shortcut menu.
Debugger datatip. Shows the value of a variable when the pointer hovers over it, and lets you modify that value.
The debugger strip (Figure 3-2) is a small control strip that appears above the content pane. It lets you perform several debugging tasks.
These are the items in the debugger strip:
Thread list. List of the threads in the program being debugged.
Breakpoints. Activates/deactivates breakpoints.
Continue. Continues execution of a paused process.
Step Over. Steps over the current code line. The process counter (PC), identified by the red arrow in the gutter, moves to the next code line to be executed in the current file.
Step Into. Steps into a function or method in the current code line. If possible, the editor shows the source file containing the called routine an the process counter appears in the code line to be executed next.
Step Out. Steps out of the current function or method. The editor shows the source file containing the caller.
Debugger. Opens the debugger.
Console. Opens the console
Call list. List of the called functions or methods in the current call stack.
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:
Continue to Here: Continues program execution up to the action line.
Add Breakpoint: Adds a breakpoint to the action line.
Add & Edit Breakpoint: Adds a breakpoint to the action line and opens the breakpoints window.
Built-in Breakpoints: Adds a predefined breakpoint to the action line.
Enable Breakpoints: Activates breakpoints for the current debugging session.
Disable Breakpoints: Deactivates breakpoints for the current debugging session.
Reveal in Breakpoints: Opens the action line’s breakpoint in the breakpoints window.
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.
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.
Print Description: Prints the description of the current datatip field in the console.
Open in Window: Opens a window containing the data of the current datatip field.
View as Memory: Shows the contents of the current datatip field in the memory viewer window. See “Browsing Memory” for more information.
Jump to Definition: Opens the file that declares the data type of the current datatip field.
Jump to Documentation: Opens the reference for the data type of the current datatip field.
Show Types: Toggles the display of the data type of the datatip fields.
Show Data Formatters: Toggles the display of data formatters for the datatip fields.
Sort by Name: Sorts datatip fields by field name.
Sort by Type: Sorts datatip fields by field data type.
No Sort: Applies no sorting to datatip fields.
Auto Expand: Toggles the autoexpansion of datatip fields that represent structures when the pointer hovers over the corresponding disclosure triangle.
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:
Continue to Here
To perform this command, let the pointer hover over the gutter identifying the action line. The Continue to Here icon appears on the left margin of the line (Figure 3-4). Clicking this icon continues program execution up to the action line.
Step In and Step Over
To perform these commands, let the pointer hover over the action line in the gutter or the content pane until the Step In or the Step Over icon appears on the left margin of the line (Figure 3-5). Click the icon to perform the command.
Last updated: 2009-10-19