Using breakpoints

Breakpoints are temporary markers that you place in your executable program to instruct the debugger to stop your program at a given point. When a breakpoint is encountered, execution suspends at the breakpoint before the line is executed, at which point you can see the stack for the thread and check the contents of variables, registers, and memory. Then, you can step over (execute) the line and see what effect it has on the argument.

About this task

The debugger supports the following types of breakpoints:

  • Entry breakpoints Entry breakpoint icon are triggered when the entry points they apply to are entered.
  • Source entry breakpoints Source line breakpoint icon are entry breakpoints for COBOL and PL/I that can be set when you edit source before debugging an application.
  • Address breakpoints Address breakpoint icon are triggered before the disassembly instruction at a particular address is executed.
  • Load breakpoints Generic breakpoint icon are triggered when a DLL or object module is loaded.
  • Conditional breakpoints are triggered by parameters that control the behaviour of these breakpoints. Not all breakpoint types support conditions.
  • Event breakpoints are triggered when the debugger recognizes an exception thrown by the application.
  • Statement breakpoints Generic breakpoint icon are triggered when the statement they are set on is about to be executed.
  • Watch breakpoints Generic breakpoint icon are triggered when execution changes data at a specific address.
  • Occurrence breakpoints are triggered when an event occurs or a specific exception is thrown. When the breakpoint is triggered, an action can be performed (optional).

Event breakpoints are set in the Breakpoints view by clicking the Manage Compiled Language Event breakpoints push button and then, in the Manage Event Breakpoints dialog, selecting the event type that you want the debugger to catch. These breakpoints include all standard signals, and a number of events of interest, such as C++ exceptions, and calls to library functions like exit(). For POSIX signals, you can choose to be notified of all occurrences of each individual signal (handled signals), or only those occurrences when no handler has been provided (unhandled signals).

Line and statement breakpoints can be set in the editor by double-clicking on the ruler area to the left of an executable line or by a right-click pop-up menu action in the editor Source line breakpoint icon when you debug - or they can be set by wizard in the Breakpoints view Generic breakpoint icon. If you want a thread-specific Line breakpoint, you must set it from the Breakpoints view while there is an active debug session. Entry breakpoints can be set in the Modules view by right-clicking an entry point and selecting Set entry breakpoint from the pop-up menu - or they can be set by wizard in the Breakpoints view. In addition, you can right-click the debug target (or one of its threads or stack frames) in the Debug view and select Options > Stop At All Function Entries from the pop-up menu to stop at all entry points (this option is also available in the Breakpoints view pop-up menu). Source entry breakpoints are set when you edit COBOL or PL/I source. You can either use the outline view or the left ruler to add source entry breakpoints. All other breakpoint types are set by wizard in the Breakpoints view. To access the wizards for setting breakpoints, right-click in the Breakpoints view and select Add Breakpoint from the pop-up menu. This will expand to a menu that allows you to choose the breakpoint type that you want to set. When you use the wizard to set a breakpoint, you can specify optional breakpoint parameters and set conditional breakpoints (see the related topic).

The Breakpoints view displays a list of all breakpoints for all debug sessions. You can reduce the number of breakpoints displayed in one of the following ways:

  • To filter out breakpoints that are not related to the current debug session, click the Breakpoints view Show Breakpoints Supported by Selected Target push button.
  • To link the Breakpoints view with the Debug view, click the Link with Debug View toggle. When this toggle is selected and a breakpoint suspends a debug session, that breakpoint will automatically be selected in the Breakpoints view.

You can also group breakpoints for easier viewing in the Breakpoints view. Breakpoints can be grouped by breakpoints (the standard list of breakpoints), breakpoint types (for example, grouped by line and entry breakpoints), and by breakpoint working sets (groups that you define yourself). To group breakpoints, select the Breakpoints view down-arrow icon and then select the grouping that you want to display in the Breakpoints view. When you click Advanced in this menu, a dialog box opens which allows you to created nested groupings. To create working sets, choose Working Sets from the Breakpoints view down-arrow icon menu.

The breakpoint entries in the list provide you, in brackets, with a summary of the breakpoints' properties. With pop-up menu options, you can add breakpoints, remove breakpoints, and enable or disable breakpoints. You can also edit breakpoint properties with a pop-up menu option. With push buttons in the Breakpoints view, you can remove breakpoints.

When you choose to edit a breakpoint, the wizard by which it was created opens (if you did not use a wizard to create the breakpoint, the wizard for the breakpoint type opens). While in the wizard, you can click Next > or < Back to view or edit the breakpoint settings in the wizard. Once you are finished, click Finish to change the breakpoint or click Cancel to exit the wizard without making any changes.

Breakpoints can be enabled and disabled with pop-up menus in the Breakpoints view or the editor and by check box in the Breakpoints view. When a breakpoint is enabled, it will cause all threads to suspend whenever it is hit. When a breakpoint is disabled, it will not cause threads to suspend. For information about enabling and disabling breakpoints, see the related topic.

In the Breakpoints view, there are two indicators to the left of a set breakpoint (). To the far left is a check box indicating whether the breakpoint is enabled. When enabled, the check box contains a check mark. (See pointer A. in the following diagram.) When disabled, the check box does not contain a check mark. (See pointer B. in the following diagram.)

breakpoints view

An indicator with a check mark overlay, shows a breakpoint that has been successfully installed by the debug engine. If the breakpoint is enabled, this indicator is filled; if the breakpoint is disabled, this indicator is not filled. In the editor, line breakpoints are indicated by an indicator with a check mark overlay, indicating a breakpoint that has been successfully installed by the debug engine (if the breakpoint is enabled, this indicator is filled - if the breakpoint is disabled, this indicator is not filled).

Breakpoints must be installed to suspend execution. It is possible to add a breakpoint that is not valid for the current debug session. This breakpoint will not be installed until it is part of a debug session that includes a debug engine that will recognize the breakpoint.

In the editor, line, statement, and entry breakpoint indicators are displayed in the marker bar to the left of the editor. Indicators for line, statement, entry, address, watch, and load breakpoints are displayed in the Breakpoints view.

While in the Breakpoints view, the source editor will open to the location of a breakpoint if you do one of the following:

  • Double-click the breakpoint.
  • Select the breakpoint and click the Go to File For Breakpoint push button.
  • Right-click on the breakpoint and select Go to File from the pop-up menu.