Just-In-Time Debugging

Note:
  • This functionality requires a licensed version of a Micro Focus Visual COBOL or Enterprise Developer product on the same machine. See Installation for details.
  • The following information applies to native COBOL code.

You can use Visual Studio Code as the just-in-time (JIT) debugger in the following scenarios:

JIT debugging support has the following requirements:

You can register Visual Studio Code as the JIT debugger in one of the following ways:

Use a command from the Command Palette on Windows

By default on Windows, the Micro Focus COBOL or Enterprise product installed on your machine is the default JIT debugger for COBOL applications. You can register Visual Studio Code as the JIT debugger on your machine as shown below if you want to use it for JIT debugging without using the COBCONFIG environment variable:

  • Run the command COBOL: Register VS Code as the JIT debugger from the command palette.

    This replaces the value specified by the main COBOL product installation to use either Eclipse or Visual Studio as debugger.

To restore the original value of the JIT debugger for COBOL:

  • Run the command COBOL: Unregister VS Code as the JIT debugger from the command palette.

    This unregisters the Visual Studio Code JIT debugger.

In addition, if you have either Visual COBOL for Eclipse or Enterprise Developer for Eclipse installed, you must disable the Enable JIT debugging setting from Preferences > Micro Focus > COBOL > Debug.

Use a COBOL Run-Time System configuration file

You can use Visual Studio Code as the JIT debugger if you create a COBOL run-time configuration file with the location of the JIT debugger, and then set the COBCONFIG environment variable to that file. This ensures that Visual Studio Code will be launched for just-in-time debugging.

  1. Create a run-time configuration file that contains the following line:
    Windows:
    set debugger_command="extension-folder\\bin\\debugadapter\\win-x86\\MicroFocus.VsCodeDebugProtocol64.exe %%P%X"

    Linux:

    set debugger_command="<extension-folder>/bin/debugadapter/linux-x64/MicroFocus.VsCodeDebugProtocol"

    You must specify extension-folder as a full path. The name of the extension in the extensions folder is micro-focus.amc.mfcobol-<version>.

    Tip: You can use the command COBOL: Configure COBCONFIG for JIT debugging from the Command Palette to add the information to an existing .cfg file, or to update the value if it is already present in the .cfg file, rather than setting it manually.
  2. Set the COBCONFIG environment variable to the configuration file - follow the links below for instructions.
Important: Previous versions of this Visual Studio Code extension used the MicroFocus.VSCodeJIT.exe (Windows) and the MicroFocus.VSCodeJIT executable (UNIX). For any .cfg file in which the debugger_command value is set to these executables, run the COBOL: Configure COBCONFIG for JIT debugging from the Command Palette in order to change the value to the new executables.