5.3 Setting Line Breakpoints

A breakpoint is a point in a program that interrupts the running of the program. When stopped at a breakpoint you can display or change the value of variables, view the call stack and perform other debug tasks. This lesson will describe two ways of setting line breakpoints.

tip You can only set line breakpoints at executable lines. All executable lines are displayed in blue.

Using the Prefix Area of the Source pane

The easiest way to set a breakpoint is to double-click in the prefix area of the Source pane.

Follow these steps:

  1. Position your mouse pointer over the prefix area (left margin) of line 10.
  2. Double-click with the left mouse button. A red icon now marks the line, indicating that a breakpoint is set. You can also right-click and select Set Breakpoint.


Setting Breakpoints from the Breakpoints menu

You can also use the Breakpoints menu to set breakpoints in your source.

Follow these steps:

  1. Ensure that the Breakpoints tab is selected. The Breakpoints menu is added to the debugger's main menu.

  2. In the prefix area of the Source pane, click at line 47. The cursor in the Source pane moves to line 47.
  3. Select Set Line from the Breakpoints menu. The Line breakpoint window appears with Program, Module, and Line set and default values for Thread and Frequency.

  4. Click OK. In the prefix area of the Source pane, line 47 is now marked with red icon, indicating that a breakpoint is set.

Click on to indicate that you have completed these steps.