The Eclipse IDE offers a number of debugging features.
- 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.
- Stop debugging
- Run > Terminate. You can also click the red square at the top
- Watchpoint-setting
- Run > Toggle Watchpoint 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):
Run > Inspect COBOL item
- For JVM COBOL projects:
Run > Inspect
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.