Exercise 7.3: Adding and deleting breakpoints

Before you begin, you must complete Exercise 7.2: Starting a Debug session using service entry points.

Breakpoints are markers you place in your program to tell the debugger to stop your program whenever execution reaches that point. For example, if you suspect that a particular statement in your program is causing problems, you could set a line breakpoint on the line containing the statement, then run your program. Execution stops at the breakpoint before the statement is executed. You can then check the contents of variables and view the call stack, and execute the statement to see how the problem arises.

You can only set breakpoints at executable lines. All executable lines are displayed in blue. The easiest way to set a breakpoint is to right-click on the line in the Source view.

To set a breakpoint:

  1. Click anywhere on line 8.
  2. Right-click and click Add breakpoint on the popup menu.

    A dot with a check mark in the prefix area indicates that a breakpoint has been set for that line. The prefix area is the small grey margin to the left of the source lines.
    Debug icon on line 8

  3. Click on line 32.
  4. Right-click and click Add breakpoint on the pop-up menu.
  5. Click the Breakpoints tab in the upper right pane of the workbench.
  6. In the Breakpoints view right-click the breakpoint for line 8.

    Here you can manage your breakpoints. You can disable, or remove breakpoints accordingly.
    Breakpoints view

You have set breakpoints and now you are ready to begin Exercise 7.4: Displaying a variable.