Previous Topic Next topic Print topic


Debugging COBOL Projects Using a Remote Machine

Before you start debugging a program you need to create a debug configuration. Different types of COBOL debug configurations are available for different types of debug sessions, but remote projects use the same debug configuration types as local projects - you just need to specify connection properties such as machine name and port number.

If you have developed a remote COBOL project on a machine using a local Eclipse installation and a remote UNIX machine running Micro Focus Enterprise Developer UNIX Components, use debug configurations in the same way as locally-developed projects. However, you do not need to start the cobdebugremote (or cobdebugremote64 for a 64-bit process) or identify a port for it to listen on, merely select the remote project in the debug configuration.

Performance considerations

When debugging a remote program, the performance of the network, specifically the latency between the local and remote machines, will have an effect on the responsiveness of Eclipse. Whenever Eclipse has to show the new execution position, a number of messages are sent from the remote machine, over the network, to get the required information. The effect of this is that it can take a few seconds after a Step command is issued before Eclipse has updated the screen and is ready for the next command.

You can mitigate this delay by closing any unnecessary debug views. For instance, by closing the Expressions view and the Variables view, the number of messages that are sent is reduced, which allows Eclipse to update quicker.

Large programs can also suffer from a large delay the first time that the program is displayed in the debugger and an expression is evaluated. You can reduce this delay by following these steps:

  1. Create a text file called debugconfig.xml.
  2. Add the following lines, and then save the file:
    <?xml version="1.0" encoding="utf-8" ?>
    <NativeDebuggerOptions>
      <DebugOption Option="REMOTECHECKER" Value="yes"/>
    </NativeDebuggerOptions>
  3. At a command or shell prompt, set the environment variable DEBUG_CONFIG to the full path name for debugconfig.xml.
  4. Start Eclipse from the same command or shell prompt.

Projects developed on a local machine

You can debug local projects while running them on a remote machine, or while your local project interacts with applications running on a remote machine.

The remote machine can be a Windows or UNIX environment, with either the COBOL development system or Enterprise Server installed. The two systems must be networked using TCP/IP. You need to ensure that the remote machine has access to the debug symbol (.idy) files in your project, which are normally in the output directory of your project (a location specified in the build configuration). To do this, set up the project subdirectory on the local machine as a network share with the remote machine. Alternatively, you can copy or FTP the .idy files to a directory on the remote machine. You then need to configure the directory paths that are used to search for the application's .idy files.

Remote debugging of local projects is handled by the cobdebugremote (Windows) or cobdebugremote32 (UNIX) process (or cobdebugremote64 for a 64-bit process), located in $COBDIR/bin of the remote machine.

Note: If you intend to remotely debug callable shared objects (.so), you must set the COBIDY environment variable to the location of the .idy file before you start cobdebugremote32 or cobdebugremote64.
You must start the process before communication can be established. This process terminates automatically when you terminate the debug session either by disconnecting from or stopping the debugged application. You can use the following options:
no options
Starts the process and opens a random port for remote connections. The port number is displayed in the console.
machine=name
Specify the machine that the process is running on. Only valid with the stop option.
port
port=nnnnn
Specify the port to use to listen for connection requests.
port=nnnnn-yyyyy
Specify the range of ports to use. If port nnnnn is in use, the next port is tried until a free port is found. If no free ports are found in the range, the utility returns an error.
Note: You must enter the same number you set as the port option in the cobdebugremote port field of your debug configuration.
repeat
After the debug session has been completed, start listening for another connection. If no option is specified, the process exits after the debug session has completed.
stop
Causes the process that is listening on the port to exit. Must be used with the port option. This is only valid when the process is waiting for a connection.
Tip: Because you need to start the process for every debug session, Micro Focus recommends you use the repeat options, as this ensures the process listens for another connection after the debug session has completed.

Projects developed on a remote UNIX machine

To enable remote debugging using a COBOL Application debug configuration, you need to have an X window implementation installed and running before you start to debug, so that the output of a remote application running on a UNIX machine can be viewed on your local machine. You do not need X window for other debug configuration types.

Windows:

Micro Focus ViewNow X is provided as part of Enterprise Developer. See Installing X Windows on Windows in the Installation section. Find the ViewNow X documentation on the Micro Focus Infocenter.

UNIX:
Ensure the local X11 server can receive connections from the remote machine. You can do this using the xhost + command or by enabling SSH port forwarding. Alternatively, enable TCP/IP connections for X11 by setting a value in a configuration file in a manner appropriate to your operating system. For example:
  • Red Hat: run the gdmsetup utility and deselect Deny TCP connections to Xserver in the Security tab (this configures DisallowTCP=false in /etc/gdm/custom.conf)
  • SUSE: set DISPLAYMANAGER_XSERVER_TCP_PORT_6000_OPEN="yes" in /etc/sysconfig/displaymanager

You need to specify the details about the display that the X11 server tries to contact in the IDE preferences:

  1. Click Window > Preferences > Micro Focus > Debug.
  2. Type the display details in the Default X Server (DISPLAY) field.

    The default Default X Server (DISPLAY) value is clientMachineName:0.0. This configuration applies to both remote COBOL and PL/I projects.

Projects developed on a remote UNIX machine running behind a firewall

If the remote machine is running behind a firewall but is accessible via SSH you need to use a proxy server to handle traffic to the remote machine. Enterprise Developer supports the SOCKS5 internet protocol. This enables you to route network traffic through SSH to the remote machine. To use SOCKS with a proxy server perform the following steps:

  1. Click Window > Preferences > General > Network Connections.
  2. In the Active Provider list, select Manual.
  3. In the Proxy entries table, click the SOCKS row.
  4. Click Edit.

    This opens the Edit Proxy Entry dialog box for the SOCKS schema.

  5. In the Host field, type the host_name where your proxy server is running.
  6. In the Port field, type the port_number used by your chosen proxy client.

    If your proxy server is configured to request authentication you need to specify the details:

    1. Check Requires Authentication.
    2. Type the username in the User field.
    3. Type the password in the Password field.
  7. Click OK.

If you are going to use the COBOL Application debug configuration you also need to use SSH port forwarding to route X Server display to the local machine. This means you need to specify the remote machine port (rather than the local machine port) when specifying the display in the preferences:

  1. Click Window > Preferences > Micro Focus > Debug.
  2. Type the display details in the Default X Server (DISPLAY) field - for example localhost:0.
  3. Click OK.

See To create a connection to a remote UNIX host running behind a firewall for details of how to use SOCKS with PuTTY as the proxy server.

Previous Topic Next topic Print topic