index.html 4.8 KB
Newer Older
D
duke 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
<html>
<head>
<title>
Using HotSpot Serviceability Agent (SA)
</title>
</head>
<body>
<h1>Using HotSpot Serviceability Agent (SA)</h1>

<h3>HSDB GUI</h3>
<p>
The top-level GUI program using the HotSpot Serviceability Agent APIs is
called <b>HSDB</b>, the "HotSpot Debugger". To run it, type "hsdbproc.sh" 
or "hsdbwindbg.bat" or 64-bit variants (on Unix, Windows platforms 
respectively). More info. on HSDB GUI are in <a href="hsdb.html">hsdb.html</a>.
</p>

<h3>SA Modes</h3>
<p>
There are three modes for the SA debugger: 
<ul>
<li>attaching to a local process,
<li>opening a core file, and 
<li>attaching to a remote "debug server". 
</ul>
<p>
The remote case requires two programs to be running on the remote machine:
the rmiregistry (see the script "start-rmiregistry.sh" in this directory;
run this in the background) and the debug server (see the script
"start-debug-server-proc.sh"), in that order. start-rmiregistry.sh takes no
arguments; start-debug-server-proc.sh (or -windbg.bat) takes as argument 
the process ID or the executable and core file names to allow remote debugging
of. 
</p>

<h3>Command line HSDB</h3>
<p>
There are also command line HSDB variants ("clhsdbproc.sh" or "clhsdbwindbg.bat"
or 64-bit variants). There is also a JavaScript based command line interface
called "jsdbproc.sh" [or "jsdbwindbg.bat" or 64-bit variants]. More details on 
command line interfaces can be found in 
<ul>
<li><a href="clhsdb.html">clhsdb.html</a>
<li><a href="jsdb.html">jsdb.html</a>
</ul> 
</p>

<h3>Other command line tools</h3>
<p>
The following table lists all SA command line tools. &lt;xxx&gt;windbg.bat 
files are for Windows. .sh files are for Solaris. &lt;xxx&gt;64.sh are for 
64 bit debugees.
</p>

<table border="1">
<tr>
<th>
Tool
</th>
<th>
Description
</th>
</tr>

<tr>
<td>
dumpflagsproc.sh,
dumpflagsproc64.sh,
dumpflagswindbg.bat
dumpflagswindbg64.bat
</td>
<td>
dumps name and value of all -XX JVM command line arguments passed
to debuggee. 
</td>
</tr>

<tr>
<td>
<a name="dumpsysprops"></a>
dumpsyspropsproc.sh,
dumpsyspropsproc64.sh,
dumpsyspropswindbg.bat
dumpsyspropswindbg64.bat
</td>
<td>
This prints name and value of Java level System properties.
</td>
</tr>

<tr>
<td>
<a name="heapdump"></a>
heapdumpproc.sh,
heapdumpproc64.sh,
heapdumpwindbg.bat
heapdumpwindbg64.bat
</td>
<td>
Dumps heap in a file in hprof binary format.
</td>
</tr>

<tr>
<td>
<a name="heapsum"></a>
heapsumproc.sh,
heapsumproc64.sh,
heapsumwindbg.bat
heapsumwindbg64.bat
</td>
<td>
Prints summary information on Java heap.
</td>
</tr>


<tr>
<td>
jcoreproc.sh,
jcoreproc64.sh,
jcorewindbg.bat
jcorewindbg64.bat
</td>
<td>
This can retrieve .class files from the debuggee.
set the environment variable <b>JCORE_PACKAGES</b> to comman separated list of
packages whose classes have to be retrieved from the core file.
</td>
</tr>

<tr>
<tr>
<td>
jstackproc.sh,
jstackproc64.sh,
jstackwindbg.bat
jstackwindbg64.bat
</td>
<td>
used to get java stack trace for all java threads.
</td>
</tr>

<tr>
<td>
jhistoproc.sh,
jhistoproc64.sh,
jhistowindbg.bat
jhistowindbg64.bat
</td>
<td>
used to get object histogram of java heap.
</td>
</tr>

<tr>
<td>
permstatproc.sh,
permstatproc64.sh,
permstatwindbg.bat
permstatwindbg64.bat
</td>
<td>
To gather statistics on perm. generation.
</td>
</tr>

<a name="mixed_pstack"></a>
<tr>
<tr>
<td>
pstackproc.sh,
pstackproc64.sh,
pstackwindbg.bat
pstackwindbg64.bat
</td>
<td>
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. 
</td>
</tr>

<tr>
<td>
pmapproc.sh,
pmapproc64.sh,
pmapwindbg.bat
pmapwindbg64.bat
</td>
<td>
This is cross platform Solaris pmap-like utility. 
</td>
</tr>

<tr>
<td>
soqlproc.sh,
soqlproc64.sh,
soqlwindbg.bat
soqlwindbg64.bat
</td>
<td>
This is command line SOQL - Simple Object Query Language tool.
SOQL is SQL-like query language to query Java heap.
</td>
<tr>
<td>
start-debug-server-proc.sh,
start-debug-server-proc64.sh,
start-debug-server-windbg.bat,
start-debug-server-windbg64.bat,
start-rmiregistry.bat,
start-rmiregistry64.bat,
start-rmiregistry.sh
start-rmiregistry64.sh
</td>
<td>
These scripts are used to run SA remotely. 
</td>
</tr>
</table>

<h3>Debugging transported core dumps</h3>
<p>
When a core dump is moved from the machine where it was produced to a
difference machine, it may not always be possible for SA to debug the same.
More info. on debugging on transported core dumps is in
<a href="transported_core.html">transported_core.html</a>.
</p>

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

</body>
</html>