Setting and Removing Breakpoints

Breakpoints are useful when you have a general idea of where a bug occurs in a program. The debugger runs until it reaches the breakpoint, then stops. At this point you can step to the next line of code or trace through a function until you find the problem.

·To set a breakpoint in the GENERIC program:

1.Move the insertion point to first line of the About function in the source code.

2.From the Debug menu, choose Breakpoints. The Breakpoints dialog box appears. (See Figure 5.4.)

3.From the Break list, select at Location.

4.Choose Add.

5.Choose OK.

6.Choose Go from the Run menu. The GENERIC program begins to run.

7.While the program is running, choose About Generic from its Help menu. The program stops and the breakpoint line is highlighted in the source window.

·To remove a breakpoint:

1.From the Debug menu, choose Breakpoints. The Breakpoints dialog box appears. (See Figure 5.4.)

2.Select the breakpoint to remove from the Breakpoints list.

3.Choose Delete.

4.Choose OK.

The Breakpoints dialog box offers a variety of options for setting breakpoints. You can set breakpoints based on Windows messages, memory location, and the values in an expression. For additional information on breakpoints, see page 110 in the reference section.