Remote debugging

CodeGuide supports remote debugging using JPDA (Java Platform Debugger Architecture). TCP/IP socket communication is used for communication between CodeGuide and the debugged process. JPDA is part of all recent JDKs (JDK 1.3 or later).

 

 

Preparation

Make sure that both computers are connected to the network and that no firewall blocks TCP/IP packets on between the two computers. The port which is used can be configured in the Preferences dialog, the default is 20500.

 

It is important that the source code for the debugged application is available on the machine running CodeGuide and that the application was compiled from this code. A mismatch between the source code residing on the machine running CodeGuide and the remote machine results in missing source file warnings and bogus information displayed during execution.

 

You cannot debug more than one application at the same time. CodeGuide does not allow simultaneous debugging of several applications either local or remote. Cross-platform debugging is supported as well. CodeGuide can run on Windows for example while the debugged application runs on Linux or vice versa.

 

There are two ways to engage in remote debugging:

 

  1. CodeGuide can act as a debugging server in which case the debugged process has to connect to CodeGuide.

  2. CodeGuide can attach to an already running application.

 

 

CodeGuide as a debugging server

In order to allow remote applications to connect to CodeGuide the Start remote debugging server option in the Debugging section of the Preferences dialog has to be enabled. If this option is enabled and no error message was displayed applications can now connect to CodeGuide to engage remote debugging.

 

The remote Java VM has to be invoked with special options in order to tell it to connect to CodeGuide for debugging.

 

These options can be shown using the Debugging server information dialog. This dialog is accessible via the Debug | Debugging server information... menu entry.

 

This dialog only display information about the debugging server. It is not necessary to show this dialog prior to starting the remote application.

 

When the remote VM is started with these options it automatically connects to CodeGuide. As soon as the remote VM connects CodeGuide shows the Debug browser and the application can be debugged just as if it were running locally.

 

 

Attaching to a remote debuggee

CodeGuide can attach to an already running application as well. The debug server does not need to be running in this case.

 

The remote VM has to be started with additional commandline options to allow remote attachment:

 

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$PORT$,server=y

 

where $PORT$ is the port which will be used for debugger communication.

 

When the remote VM is running you can attach to it using the Debug | Attach to remote process... menu entry.

 

 

 

This dialog shows the additional commandline options needed for the remote VM (see above) so you can start it if you have not done so already. You have to specify the name or IP address of the remote host and the port which is used for communication. Press the Connect... button to connect to the remote VM. If CodeGuide can connect to the remote VM the dialog will disappear and the Debug browser will be shown. You can now debug the application just as if it were running locally.