Previous Topic Next topic Print topic


Debugging Commands and Options

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 Run > Run to line 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.
Using keyboard shortcuts
  • 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.
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.

Previous Topic Next topic Print topic