Enabling remote debugging for user exits

While you are developing your user exits, you might want to use a debugger to help locate problems in your code.

Because exits run inside the Java virtual machine that runs the agent, you cannot use the direct debugging support that is typically included in an integrated development environment. However, you can enable remote debugging of the JVM and then connect a suitable remote debugger.

To enable remote debugging, use the standard JVM parameters -Xdebug and -Xrunjdwp. These properties are passed to the JVM that runs the agent by the BFG_JVM_PROPERTIES environment variable. For example, on UNIX the following commands start the agent and cause the JVM to listen for debugger connections on TCP port 8765.

export BFG_JVM_PROPERTIES="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8765"
fteStartAgent -F TEST_AGENT
The agent does not start until the debugger connects. Use the set command on Windows instead of the export command.

You can also use other communication methods between the debugger and JVM. For example, the JVM can open the connection to the debugger instead of vice versa, or you can use shared memory instead of TCP. See the Java Platform Debugger Architecture documentation for further details.

You must use the -F (foreground) parameter when you start the agent in remote debug mode.

Using the Eclipse debugger

The following steps apply to the remote debugging capability in the Eclipse development environment. You can also use other remote debuggers that are JPDA-compatible.
  1. Click Run > Open Debug Dialog (or Run > Debug Configurations or Run > Debug Dialog depending on your version of Eclipse).
  2. Double-click Remote Java Application in the list of configuration types to create a debug configuration.
  3. Complete the configuration fields and save the debug configuration. If you have already started the agent JVM in debug mode, you can connect to the JVM now.