The Eclipse IDE offers a number of debugging features and techniques:
- Breakpoint-setting
- Run > Toggle Breakpoint or double-click in the left margin.
-
Tip: To set or toggle a
program breakpoint, double-click in the left margin next to the Procedure Division heading, or use the Breakpoints view. Program breakpoints
are supported in native COBOL only, and are not supported with nested programs.
By default, a program breakpoint causes execution to stop on any entry point to the program and on return to the program from
a call. To specify that a program breakpoint causes execution to stop only when the Procedure Division entry point is called,
open the launch configuration of the project (click
Run > Run Configurations), and check
Program breakpoint on main entry point only on the
General tab of the configuration.
- Data item values
- To display a data item's value, you can hover over it, or alternatively right-click it and click
Inspect COBOL.
- Debug configurations
- Run > Debug Configurations. You can have multiple debug configurations and swap between them. These settings here override the project run-time settings
- Main program to debug
- Run > Debug. On the General tab, specify the main program file.
- Reset execution
- Moves the execution point to the cursor position. The shortcut key is
Alt+F12, R.
- Preferences
- Window > Preferences > Micro Focus > COBOL > Debug. Among other things, you can choose to display hexadecimal and byte values of data items.
- Run to line
- You can position your cursor anywhere in your code to instruct the debugger to run from the current execution point to the
line on which the cursor is positioned. The feature can save time when debugging as you do not have to use the step functions
to step through individual lines of code. You can use Run to line in both the main source code and copybook code. To use,
position the cursor in the code and the click
or use the shortcut
CTRL+R.
- Reverse debugging
-
Restriction:
This feature is only supported on the following platforms:
- Red Hat Linux (x86 and x64)
- SUSE Linux Enterprise Server (SLES) 12 SP2 (x64 only)
Additional restrictions apply. For details, see the
Reverse Debugging and Live Recording topic in the
Known Issues and Restrictions > Problem Determination and Diagnostic Tools section of this documentation.
Note: Windows users: to use this option, you must connect to
Micro Focus Enterprise Developer UNIX Components running on one of the supported platforms listed above.
When the
Enable reverse debug box on the
Debug Configurations dialog is checked for the active debug configuration, the
Enterprise Developer debugger records your debug session as you step forward through a program or application. You can then access the recorded
information by stepping backwards through the application. Stepping backwards puts you into reverse mode where what you see
is from a recording, and is not live. Therefore, input is not accepted when running in reverse mode. You can also step forwards
within the recorded session, and proceed in live mode when you reach the point at which you first stepped back. Once in live
mode, input is again accepted.
When in reverse mode, the debugger behaves much the same as it does in live mode, showing program position, stage of debugging,
and variable names and values.
- Stop debugging
- . You can also click the red square at the top
- Watchpoint-setting
- or double-click in the left margin.
Restriction: This feature is not supported for JVM COBOL.
- Inspect COBOL variables
- Allows you to inspect COBOL variables. The cursor in the editor has to be positioned on a data item, or a data item can be
selected. Inspecting works like Expressions view - any text can be selected in the editor (COBOL Editor or Copy View) for
evaluation.
- For native (local and remote projects):
- For JVM COBOL projects:
Inspect can also be triggered from a context menu in the editor or by using the
Ctrl+Shift+I shortcut.
Restriction: Only inspection of data items is supported. More complex expressions like arithmetic operations or method calls are not currently
supported.
- Keyboard shortcuts - debugging
-
- F5 = Step into the next statement at the current line of code and suspend execution. Equivalent of clicking
.
- F6 = Step over the next statement at the currently executing line of code without entering it, and suspend execution. The
method will be executed normally. Equivalent of clicking
.
- F7 = Return from a method or paragraph that has been stepped into, and suspend execution. The remainder of the code inside
the method is executed normally. Equivalent of clicking
.
- F8 = Resume execution of the program from a suspended line of code. Equivalent of clicking
.
You can also click the
Drop to Frame button
to reposition you at the start of the current method.
- Keyboard shortcuts - Reverse debugging
-
Restriction:
This feature is only supported on the following platforms:
- Red Hat Linux (x86 and x64)
- SUSE Linux Enterprise Server (SLES) 12 SP2 (x64 only)
Additional restrictions apply. For details, see the
Reverse Debugging and Live Recording topic in the
Known Issues and Restrictions > Problem Determination and Diagnostic Tools section of this documentation.
When the
Enable reverse debug Debug Option is checked, the following shortcuts are also available:
- Ctrl+F5 = Step into the previous statement at the current line of code. Equivalent of clicking
.
- Ctrl+F6 = Step over the previous statement at the current line of code without entering it. Equivalent of clicking
.
- Ctrl+F7 = Return from a method or paragraph that has been stepped back into in reverse mode. Equivalent of clicking
.
- Ctrl+F8 = Resume execution in reverse mode. Execution stops when it reaches the start of the recording or encounters a breakpoint.
Equivalent of clicking
.
- Querying the value of a data item or the file status of an internal file name
- Hold the mouse pointer over a data item or internal file name and the current value or file status displays as a Text Hover.
The values of variables and file statuses of internal file names contained on the current execution line and previous line
are displayed in
Variables View (usually displayed in the top right of the IDE).
- Dealing with unassigned linkage items
-
If the debugger steps on a line with an unassigned linkage item (for example, if you are debugging only a part of your application
and no memory has been allocated to that linkage item), debugging terminates. To assign linkage to that data item and continue
debugging, you need to select the data item, right-click it and click
Inspect COBOL. When prompted, confirm and assign a value to the data item. Alternatively, to assign linkage, you can right-click the data
item in the
Variables view and click
Change Value.