Java debugging

safepoint?

http://xiao-feng.blogspot.co.uk/2008/01/gc-safe-point-and-safe-region.html

dude seems to know a lot about harmoney and other java

http://xiao-feng.blogspot.co.uk/

So either Oracle Java HotSport virtuak machine

JRockit

OpenJDK

= hprof =

HPROF: Heap and CPU Profiling Agent (JVMTI Demonstration Code)

java -agentlib:hprof=help

hprof binary format

files can be viewed with `jmap`

= jdwp =

Java Debugger JDWP Agent Library

java -agentlib:jdwp=help

apparently this invocation is to be deprecated at some point java -Xdebug -Xrunjdwp:[help]|[ =, ...]

/usr/lib/jvm/java-6-sun/bin/java -cp /opt/glassfish31/glassfish/modules/glassfish.jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009

= JPDA =

jva platform debugger architecture

Start server in debug mode ready for JPDA-based debugger

jdb
jdb - java debugger

is a demonstration of the JPDA (jva platform debugger architecture)

Another way to use jdb is by attaching it to a Java VM that is already running. Syntax for Starting a VM to which jdb will attach when the VM is running is as follows. This loads in-process debugging libraries and specifies the kind of connection to be made.

For example, the following command will run the MyClass application, and allow jdb to connect to it at a later time.

You can then attach jdb to the VM with the following commmand:

jmap
jmap prints shared object memory maps or heap memory details of a given process or core file or a remote debug server. If the given process is running on a 64-bit VM, you may need to specify the -J-d64 option, e.g.:

http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/jdb.html

jstack
jstack prints Java stack traces of Java threads for a given Java process or core file or a remote debug server.

http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstack.html

jsadebug
jsadebugd attaches to a Java process or core file and acts as a debug server.

Remote clients such as jstack, jmap, and jinfo can attach to the server using Java Remote Method Invocation (RMI). Before starting jsadebugd, rmiregistry must be started with:

rmiregistry -J-Xbootclasspath/p:$JAVA_HOME/lib/sajdi.jar

http://docs.oracle.com/javase/6/docs/technotes/tools/share/jsadebugd.html

other options
Monitoring and Managing Java SE 6 Platform Applications http://java.sun.com/developer/technicalArticles/J2SE/monitoring/

JVM tool interface; http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions

osgi telnet port:6666

-Xprof

for debugging profiles the running process and sends to standard output

options that are specified with - xx are not stable, and may be removed or changed

Java HotSpot specific options

http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

-XX:-HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./java_pid .hprof -XX:ErrorFile=./hs_err_pid .log