Debugging Using the Remote Development Extensions

The following information applies when you use Visual Studio Code to debug applications that use character screens for input/output on a remote Linux machine and you use the Remote-SSH extension to connect to the machine.

If the application being debugged contains any screen I/O, you need to interact with the application in a window on the desktop. The debugger must be set up to allow the information to appear in an X terminal. These are the steps to enable this support:

  1. On the remote Linux machine - ensure that X11 Forwarding is enabled in the SSH configuration for the remote machine. The following options must be set:
    • Set ForwardX11 to yes
    • Set ForwardX11 to yes

    ForwardX11Trusted yes

  2. On your local machine that has Visual Studio Code - ensure that an X-Server is running.
  3. From your local machine, connect an X terminal to the remote machine. This enables the X11 forwarding.
  4. Get the value of DISPLAY - for example, execute the following command at the terminal:
    echo $DISPLAY

    This typically is a value such as localhost:10.0.

  5. Do not close this X terminal otherwise the X11 forwarding required by the debugger does not remain active.
  6. Add the following environment variables to the debug configuration launch.json file for the application to be debugged in Visual Studio Code:
                "env": [
                    { "name": "DISPLAY", "value": "<The value obtained from the X terminal>"},
                    { "name": "TERM", "value": "xterm"}
                ]

    When you start debugging the application, an X terminal is displayed containing the screen I/O for the application.

See the Remote COBOL Development topic for more details about how to set up a remote SSH connection for remote development.