A breakpoint stops program execution so you can evaluate variables, fields, arrays, objects, and expressions; change the value of variables, arrays, and objects; and check what subroutine the program is in. Using breakpoints lets you run the program at full speed until it comes to a problem area; breakpoints give you an alternative to stepping through the entire program.

When you step or trace through a program, you’re essentially breaking at each line. However, once you are certain that no bugs exist in certain parts of your program, there is no need to repeatedly step through each line; instead, set breakpoints at crucial places where the code is less certain, then run the program at full speed and evaluate program values at the breakpoints.

If, for example, you suspect a bug in occurs at one particular place, such as when a subroutine is called, you could set a breakpoint at the line that calls the suspect subroutine. You could then step into the called method or function.

Setting and removing breakpoints

To set a breakpoint, select a line of code in the Source window and either

Move the pointer to the left of the command line where you want to enter a breakpoint. When the pointer changes to a Stop sign, double-click. The line is then highlighted in red.

To remove the breakpoint, double-click the highlighted line again.

Press Ctrl+B to add a breakpoint to the selected line of code or to remove a breakpoint from the selected line.

Choose Debug|Toggle Breakpoint from the Debugger menu (or from the Source window’s popup menu).

To remove all current breakpoints, choose Debug|Delete All Breakpoints.