Setting a line breakpoint

A line breakpoint is set on an executable line of a program.

About this task

Line breakpoints can be set in the Breakpoints view or from the editor. Line breakpoints can be set before or during a debug session. For setting a breakpoint before debugging, see the related task below.

To set a line breakpoint from the Breakpoints view, do the following:

Procedure

  1. Right-click in the Breakpoints view and select Add Breakpoint > Line from the pop-up menu. This will invoke the Add a Line Breakpoint wizard, from which you will complete all other steps.
  2. In the Program field, select the program to which the breakpoint will apply from the program names in this selection list. Otherwise, enter a new program name.
  3. In the Module field, select the module to which the breakpoint will apply from the module names in this selection list. Otherwise, enter a new module name.
  4. If different source views are supported by the debug engine, the Views section allows you to choose the radio button for the view in which you want to set the breakpoint.
  5. In the Source field, enter the file name of the source with which you want the breakpoint associated.

    If the source code consists of several files (that is, if one or more files include other files), you can specify which source file the breakpoint should be set in. Otherwise, enter a new source file name.

  6. In the Line field, enter the line number where the breakpoint is to be set.
  7. To set optional parameters for the breakpoint or make the breakpoint conditional upon optional parameters, click Next >. For information about setting conditional breakpoints and optional breakpoint parameters, see the related topics below.
  8. If you do not wish to set optional parameters for the breakpoint, click Finish to set the breakpoint and close the Add a Line Breakpoint wizard.

Results

In the Add a Line Breakpoint wizard Required information page, all fields must be completed with valid entries before the breakpoint can be set.

Note: The selection lists in the Module and Source fields are primed from the previous field with values for the current debug session. For example, if a program is selected or entered in the Program field, then the Module field selection list will include only those modules that apply to that program (if the specified program is being debugged in the current debug session). In turn, the Source field selection list will only include source files that apply to the program and module that was specified.

To add a line breakpoint in the editor, do the following:

  1. In the editor, open the file where you want to add the breakpoint, if it is not already open.
  2. Do one of the following:
    • If you are using the Debugger editor or the LPEX editor, right-click directly to the left of the line where you want to add the breakpoint and select Add Breakpoint from the pop-up menu.
    • If you are using the C/C++ editor, double-click the marker bar (the vertical bar to the left of the main text area) directly to the left of the line where you want to add the breakpoint.
  3. A new line breakpoint marker appears in both the Breakpoints view and on the marker bar (directly to the left of the line where you added the breakpoint).

When a breakpoint is enabled, the thread suspends before that line of code is executed. The debugger selects the thread that has been stopped by the breakpoint and automatically displays the stack frames for that thread. The line where the breakpoint was set is highlighted in the editor.


Feedback