Hello Jie Yu.  You are correct that the only way to debug without starting
the Java program in debug mode with -agentlib:.... is to use the SAPIDAttachingConnector, and then you can only read information out of the VM - you can't modify the state. For JDK 7, we are investigating a feature we call 'attach on demand debugging'
which would do just what you are asking for.

The 'SA' in SAPIDAttachingConnector stands for Serviceability Agent.
All the files under the hotspot/agent directory that you reference below
are part of the Serviceability Agent.    You can find out more about the
SA here:
  http://openjdk.java.net/groups/hotspot/docs/Serviceability.html#bsa

SA is also used by HotSpot engineers to debug HotSpot itself.  The
files you mention under the hotspot/livejvm are used for that.

HTH
- jjh


Jie Yu wrote:
Hi,

I am a student from Fudan University, China. I am working on a project that 
uses JPDA of JDK6. I want to debug a live java program that is not start with 
any debug options (e.g. -agentlib:jdwp or -Xdebug). For this reason, I can 
choose the SAPIDAttachingConnector. But the VirtualMachine object returned by 
this connector's attach() method is 'read-only', meaning that I cannot modify 
the state of the live java program. Is there any other options for me? I scan 
the source tree of openjdk, and find that in 
hotspot/agent/src/share/classes/sun/jvm/hotspot/livejvm, there are some related 
source files. What are these files for? Are they related to my problem?

Best regards,

Jie Yu


Reply via email to