duke@435: duke@435: duke@435: duke@435: Using HotSpot Serviceability Agent (SA) duke@435: duke@435: duke@435: duke@435:

Using HotSpot Serviceability Agent (SA)

duke@435: duke@435:

HSDB GUI

duke@435:

duke@435: The top-level GUI program using the HotSpot Serviceability Agent APIs is duke@435: called HSDB, the "HotSpot Debugger". To run it, type "hsdbproc.sh" duke@435: or "hsdbwindbg.bat" or 64-bit variants (on Unix, Windows platforms duke@435: respectively). More info. on HSDB GUI are in hsdb.html. duke@435:

duke@435: duke@435:

SA Modes

duke@435:

duke@435: There are three modes for the SA debugger: duke@435:

duke@435:

duke@435: The remote case requires two programs to be running on the remote machine: duke@435: the rmiregistry (see the script "start-rmiregistry.sh" in this directory; duke@435: run this in the background) and the debug server (see the script duke@435: "start-debug-server-proc.sh"), in that order. start-rmiregistry.sh takes no duke@435: arguments; start-debug-server-proc.sh (or -windbg.bat) takes as argument duke@435: the process ID or the executable and core file names to allow remote debugging duke@435: of. duke@435:

duke@435: duke@435:

Command line HSDB

duke@435:

duke@435: There are also command line HSDB variants ("clhsdbproc.sh" or "clhsdbwindbg.bat" duke@435: or 64-bit variants). There is also a JavaScript based command line interface duke@435: called "jsdbproc.sh" [or "jsdbwindbg.bat" or 64-bit variants]. More details on duke@435: command line interfaces can be found in duke@435:

duke@435:

duke@435: duke@435:

Other command line tools

duke@435:

duke@435: The following table lists all SA command line tools. <xxx>windbg.bat duke@435: files are for Windows. .sh files are for Solaris. <xxx>64.sh are for duke@435: 64 bit debugees. duke@435:

duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435: duke@435:
duke@435: Tool duke@435: duke@435: Description duke@435:
duke@435: dumpflagsproc.sh, duke@435: dumpflagsproc64.sh, duke@435: dumpflagswindbg.bat duke@435: dumpflagswindbg64.bat duke@435: duke@435: dumps name and value of all -XX JVM command line arguments passed duke@435: to debuggee. duke@435:
duke@435: duke@435: dumpsyspropsproc.sh, duke@435: dumpsyspropsproc64.sh, duke@435: dumpsyspropswindbg.bat duke@435: dumpsyspropswindbg64.bat duke@435: duke@435: This prints name and value of Java level System properties. duke@435:
duke@435: duke@435: heapdumpproc.sh, duke@435: heapdumpproc64.sh, duke@435: heapdumpwindbg.bat duke@435: heapdumpwindbg64.bat duke@435: duke@435: Dumps heap in a file in hprof binary format. duke@435:
duke@435: duke@435: heapsumproc.sh, duke@435: heapsumproc64.sh, duke@435: heapsumwindbg.bat duke@435: heapsumwindbg64.bat duke@435: duke@435: Prints summary information on Java heap. duke@435:
duke@435: jcoreproc.sh, duke@435: jcoreproc64.sh, duke@435: jcorewindbg.bat duke@435: jcorewindbg64.bat duke@435: duke@435: This can retrieve .class files from the debuggee. duke@435: set the environment variable JCORE_PACKAGES to comman separated list of duke@435: packages whose classes have to be retrieved from the core file. duke@435:
duke@435: jstackproc.sh, duke@435: jstackproc64.sh, duke@435: jstackwindbg.bat duke@435: jstackwindbg64.bat duke@435: duke@435: used to get java stack trace for all java threads. duke@435:
duke@435: jhistoproc.sh, duke@435: jhistoproc64.sh, duke@435: jhistowindbg.bat duke@435: jhistowindbg64.bat duke@435: duke@435: used to get object histogram of java heap. duke@435:
duke@435: permstatproc.sh, duke@435: permstatproc64.sh, duke@435: permstatwindbg.bat duke@435: permstatwindbg64.bat duke@435: duke@435: To gather statistics on perm. generation. duke@435:
duke@435: pstackproc.sh, duke@435: pstackproc64.sh, duke@435: pstackwindbg.bat duke@435: pstackwindbg64.bat duke@435: duke@435: This is cross platform mixed mode pstack utility. This works on any (non-java as well) process, core dump. For java process and core dumps, this prints both java and C/C++ frames. duke@435:
duke@435: pmapproc.sh, duke@435: pmapproc64.sh, duke@435: pmapwindbg.bat duke@435: pmapwindbg64.bat duke@435: duke@435: This is cross platform Solaris pmap-like utility. duke@435:
duke@435: soqlproc.sh, duke@435: soqlproc64.sh, duke@435: soqlwindbg.bat duke@435: soqlwindbg64.bat duke@435: duke@435: This is command line SOQL - Simple Object Query Language tool. duke@435: SOQL is SQL-like query language to query Java heap. duke@435:
duke@435: start-debug-server-proc.sh, duke@435: start-debug-server-proc64.sh, duke@435: start-debug-server-windbg.bat, duke@435: start-debug-server-windbg64.bat, duke@435: start-rmiregistry.bat, duke@435: start-rmiregistry64.bat, duke@435: start-rmiregistry.sh duke@435: start-rmiregistry64.sh duke@435: duke@435: These scripts are used to run SA remotely. duke@435:
duke@435: minqi@4267:

C2 Compilation Replay

minqi@4267:

minqi@4267: When a java process crashes in compiled method, usually a core file is saved. minqi@4267: The C2 replay function can reproduce the compiling process in the core. minqi@4267: c2replay.html minqi@4267: duke@435:

Debugging transported core dumps

duke@435:

duke@435: When a core dump is moved from the machine where it was produced to a duke@435: difference machine, it may not always be possible for SA to debug the same. duke@435: More info. on debugging on transported core dumps is in duke@435: transported_core.html. duke@435:

duke@435: duke@435:

SA Bugs

duke@435:

duke@435: Not all of the possible states of target VMs have been tested (or duke@435: supportable) with SA. For example, the SA will probably not work at all duke@435: if it freezes the target VM during certain phases of GC. When filing bugs duke@435: a pointer to a core file (see gcore(1)) which the SA can not handle well duke@435: is best. duke@435:

duke@435: duke@435: duke@435: