Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Attaching dbx to a Running Java Application

You can attach dbx to a running Java application if you specified the options shown in the following example when you started the application. After starting the application, you would use the dbx command with the process ID of the running Java process to start debugging.

$ java -agentlib:dbx_agent myclass.class
$ dbx - 2345

    For the JVM software to locate libdbx_agent.so, you need to add the appropriate path to LD_LIBRARY_PATH before running the Java application:

  • 32-bit version of the JVM software on a system running the Solaris Oracle OS: add /install-dir/SUNWspro/lib/libdbx_agent.so

  • 64-bit version of the JVM software on a SPARC based system running the Oracle Solaris OS: add /install-dir/SUNWspro/lib/v9/libdbx_agent.so to LD_LIBRARY_PATH

  • 64-bit version of the JVM software on an x64 based system running the Linux OS: add/install-dir/sunstudio12/lib/amd64/libdbx_agent.so to LD_LIBRARY_PATH

install-dir is the location where the Oracle Solaris Studio is installed.

When you attach dbx to the running application, dbx starts debugging the application in Java mode.

If your Java application requires 64-bit object libraries, include the -d64 option when you start the application. Then when you attach dbx to the application, dbx will use the 64-bit JVM software on which the application is running.

$ java -agentlib:dbx_agent
$ dbx - 2345

The following task explains how to attach dbx to a specific Java process using a process ID.

To Attach to a Running Java Process

  1. Ensure that the JVM software can find libdbx_agent.so by adding libdbx_agent.so to your LD_LIBRARY_PATH as explained in the previous section.
  2. Start your Java application by typing:

    java –agentlib:dbx_agent myclass.class

  3. Then you can attach to the process by starting dbx with the process ID:

    dbx -process-ID