Previous Topic Next topic Print topic


Launch a debug session

There are several debug options and configurations. In the following steps, you create a debug session.
  1. In order to debug a program, you need to compile the project for debugging. Select your project in the COBOL Explorer view and from the main menu click Project > Properties , expand the Micro Focus node and choose Build Configuration.
  2. Select Compile for debugging and click OK.
  3. Build the project. As well as an updated .class file, when compiling Eclipse also creates an .idy file which is necessary for debugging.
  4. You need to configure how debugging will work. Select your project in the COBOL Explorer view and from the main menu click Run > Debug Configurations

    The Debug Configurations dialog is displayed.

  5. Create a new debug configuration by double-clicking on the COBOL JVM Application tree item. A default COBOL Launch Configuration is displayed.
  6. Specify the location of the Main class by clicking Search and choosing JVMWorldClass - com.microfocus.examples.
  7. Choose Stop in main.
  8. Click Debug.
    Note: Eclipse might show you a dialog box about switching to the Debug perspective. It displays this message each time a debug session starts and is about to stop at a line of code, unless you click the check box that says you always want to switch to the Debug perspective.

    The application starts running, and stops at the first instruction in the Main method of the class set class1 to new JVMWorldClass.

    The Debug window shows the threads that are running in the application. Each thread can be expanded to show the call stack for that thread, together with the source code positions. If the sources are available, you can double-click on a call stack entry to go to that location of code, and see the values of local variables as they were on the stack at that point in the execution. In addition, an application window opens where the specific steps in your application will be displayed as debugging takes place.

    The Variables view displays data items and internal file names that are referenced on the current line and in the previous stepped statement. This allows you to view the before and after values or statuses of a particular item. You can set breakpoints by double-clicking in the margin at the far left of the source view and then run the program to the breakpoint by clicking Run > Resume.
    Tip: Use the following techniques to help you debug programs:
    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.
    To query 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).
    To deal 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