Is there currently a way to debug COBOL and Java source together?

Question ID : 34
Created on 2009-08-31 at 4:34 PM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=34



Question:

I'd like to be able to step debug through COBOL source into a call to Java and have a Java debugger pop-up or attach and allow me to step through the Java source. How can I currently do that? 

Also, is there a way to step from a Java debugger into the COBOL source and have the isCOBOL debugger take over?

Answer:

A document is available from Veryant that describes a method for doing this using the Eclipse plug-in. 

The basic steps are:
  1. Use Eclipse Ganymede or other IDE based on Eclipse 3.4. You can download "Eclipse IDE for Java Developers (85 MB)" from http://www.eclipse.org/downloads/packages/release/ganymede/sr2
  2. To add the isCOBOL IDE Plugins, select "Software Updates" from the Help menu and click on "Add Site". Enter http://support.veryant.it/eclipse in the Location field, and press OK. Click the checkbox next to "isCOBOL Update Site" and all of the checkboxes in the items that begin with "isCOBOL". Click on "Install..." and follow the prompts
  3. Once you have created or imported your COBOL project, create a new Debug Launch Configuration for your COBOL program
  4. Allow the Java debugger to attach to the COBOL program by adding remote debug options to the System Properties. For example, copy/paste the following (all on one line):
    -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
  5. Create a new Debug Configuration for a Remote Java Application setting Connection Type to Standard (Socket Attach), and the Connection Properties to Host: localhost and Port: 8000
  6. Start the COBOL program using the Debug Launch Configuration from steps 3 and 4
  7. Start the Java Debugger using the Debug Configuration from step 5
  8. To "step into" or "return from" Java code called from COBOL or COBOL code called from Java, first set breakpoints in the Java debugger or COBOL debugger at the appropriate entry or exit points.

An alternative is to start debugging in the isCOBOL debugger, and then use the remote debug feature in a Java source level debugger such as jswat to attach to the running Java process and step through the Java code.

If you are starting with a Java program and want to step into a COBOL object method or program add the following to your Java program's VM arguments:

-Discobol.rundebug=2

Create a debug configuration using "Remote isCOBOL Application". When you step into a call to COBOL from Java, the isCOBOL framework will listen for a debugger. At that point run your remote isCOBOL application debug configuration and you will be able to step through the COBOL source code.


Back to Original Question