Breakpoints Menu

The Breakpoints menu contains commands for managing a program's breakpoints.

The Breakpoints Menu

A breakpoint is a location in your program's code that you designate. It causes control to return to the debugger. Control is returned before the code at the breakpoint location is executed.

Breakpoints are displayed in the source. An enabled breakpoint shows as B in column 1, a disabled breakpoint as b (lowercase) instead. The @ sign (showing the program's current location) displays over the B if the current line is also a breakpoint.

Breakpoints are saved between sessions. The breakpoints are stored in a file that is named username.adb, where username is your login name, as known by the runtime. This file is placed in the directory named by the ACUCOBOL environment variable, or the current directory, if that variable is not set. In addition to your breakpoints, the run-all-threads state is recorded, as well as the last size of the debugger's window. Keep in mind that although breakpoints are saved between sessions, they are not saved between compiles.

Menu Option Description
Allows you to set a breakpoint at a paragraph. Selecting Set displays the Set Breakpoint dialog.

The Set Breakpoint dialog prompts you for a breakpoint Location, Condition, and Skip count.

Set Breakpoint Field      Description
Location This field prompts you for a hexadecimal address and a program name, although the current cursor location is supplied as the default breakpoint address location. Hexadecimal addresses are specified with a . (period) as the first character, as described in Program Addresses. A breakpoint is set at that address in the program. If you omit the program name, the current program is used. To obtain the hexadecimal address of a line of code, use the compiler's program listing.

Suppose you want to set a breakpoint in a called program in the run unit, but you do not know the exact address. First, make sure you've compiled the called program with source-level debugging. Then, from the current program, set the breakpoint at address 0, called-program-name. The debugger breaks as soon as the called program is entered. You see the called program's source code on the screen, and the called program's name on the command line. The called program is now the current program, and you can use Set or Toggle at Cursor to set the desired breakpoint.

If you have compiled with line numbers, you can use an alternate notation to set a breakpoint within a called program. Instead of specifying an exact address, provide the file name for the ACUCOBOL-GT source file or COPY file, followed by a colon (":") and the line number. The syntax is:

   b [path/]filename.cbl:line

For example, in the command window, you could type:

   b invoice.cbl:559

or

   b /usr/copylib/mtrec.cpy:312

Note that when you use this method to set a breakpoint in a COPY file, the line number should be relative to the specific file, not to the main program. Also, if you set a breakpoint in an object module that has not yet been loaded, you will see a warning message, Breakpoint saved for future COBOL module. When the object is loaded, the breakpoint is set without further user intervention.

Condition Breakpoints can have a condition, known as the When Condition, specified for them. The condition is entered into the Condition field. The breakpoint is activated only when the condition is true. For breakpoints with a skip count (see below), the skip count is decreased only when the condition is true. Conditions are simple comparisons between two numeric or alphanumeric data items or literals, including figurative constants (exception: the ALL literal is not supported). The allowed comparisons are =, <, >, <= and >=. You may place the word NOT before any of these operators. The comparisons are done according to the rules for COBOL. Any data items referenced must exist in the program containing the breakpoint. If the condition is not meaningful or is illegal (including table boundary violations), then the breakpoint is immediately activated when it is reached and an error message follows.
Skip count In the Skip count field, enter the number of times to skip the breakpoint. The breakpoint does not activate until the skip count reaches zero. The keyboard form of this command is
b address, counter

This command can also be set from the command line with:

b address [,program] [,SKIP count] [,WHEN condition]

A second command that is also supported but does not allow conditions to be set is:

b address [,program] [,count]
*Toggle at Cursor Line Sets or removes a breakpoint at the source line containing the cursor.

To use this command from the keyboard, press F4. The F4 key works on lines that do not contain verbs. The closest previous line with a verb is the location used.

*Disable/enable at Cursor Line Allows you to keep a breakpoint location while turning off the breakpoint. You can disable/enable breakpoints from the menu or from the Breakpoint dialog box.
View Is the same as the list breakpoints command (B). It displays a dialog box that lists all of your breakpoints and allows you to modify them, add new ones, view the next line of code containing a breakpoint, disable a breakpoint, and clear a breakpoint. It shows the location and skip count for each breakpoint. For breakpoints that are located in the current program, the paragraph they are contained in is also listed.
Clear Removes a breakpoint. At the prompt, you can enter either the breakpoint's paragraph name or hexadecimal address. Hexadecimal addresses are specified with a . (period) as the first character, as described in Program Addresses. Exact addresses are given in the View command described above.

To use this command from the keyboard, type C address.

Clear All Removes all breakpoints.

To use this command from the keyboard, type CA.