The Eclipse IDE offers a number of debugging features and techniques:
- Breakpoint-setting
- Run > Toggle Breakpoint or double-click in the left margin.
- Data item values
- To display a data item's value, you can hover over it, or alternatively right-click it and click
Inspect item.
Inspect can also be triggered from a context menu in the editor or by using the
Ctrl+Shift+I shortcut.
- 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.
- 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.
-
Note: You can set a watchpoint or data break on a variable by setting a breakpoint on its declaration line.
-
Note: The variable's address and size are being stored away for watch instead of the procedure name and variable name. This allows
the address/size to be monitored from the time it is established until the time you cancel the watch. The debugger is stopped
as soon as it recognizes a change of value - regardless of where it is in the program.
Since the watch is active until you cancel it, it is possible to be watching an address/size which is no longer allocated
or active depending on the flow of the program. In this situation, execution will be stopped if/when the memory space is reused
for some other reason.
- 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.
- 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).