Sun Studio 12: Debugging a Program With dbx

ProcedureTo Attach to a Running Java Process

  1. Ensure that the JVMTM software can find libdbx_agent.so by adding libdbx_agent.so to your LD_LIBRARY_PATH. libdbx_agent.so:

    • If you are using the 32-bit version of the JVM software on a system running the Solaris OS, add /installation_directory/SUNWspro/libdbx_agent.so to LD_LIBRARY_PATH.

    • If you are using the 64-bit version of the JVM software on a SPARC based system running the Solaris OS, add /installation_directory/SUNWspro/lib/v9/libdbx_agent.so to LD_LIBRARY_PATH.

    • If you are using the 64-bit version of the JVM software on an x64 based system running the Linux OS, add /installation_directory/sunstudio12/lib/amd64/libdbx_agent.so to LD_LIBRARY_PATH.

    The installation_directory is the location where the Sun Studio software is installed.

  2. Start your Java application by typing:

    java -Djava.compiler=NONE -Xdebug -Xnoagent -Xrundbx_agent myclass.class

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

    dbx -process_id