annotate agent/doc/clhsdb.html @ 1553:573e8ea5fd68 hs19-b02 jdk7-b96

Merge
author trims
date Tue, 01 Jun 2010 11:28:04 -0700
parents a61af66fc99e
children da91efe96a93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 <html>
a61af66fc99e Initial load
duke
parents:
diff changeset
2 <head>
a61af66fc99e Initial load
duke
parents:
diff changeset
3 <title>
a61af66fc99e Initial load
duke
parents:
diff changeset
4 Command line HSDB
a61af66fc99e Initial load
duke
parents:
diff changeset
5 </title>
a61af66fc99e Initial load
duke
parents:
diff changeset
6 </head>
a61af66fc99e Initial load
duke
parents:
diff changeset
7 <body>
a61af66fc99e Initial load
duke
parents:
diff changeset
8
a61af66fc99e Initial load
duke
parents:
diff changeset
9 <h1>Command line HSDB</h1>
a61af66fc99e Initial load
duke
parents:
diff changeset
10 <p>
a61af66fc99e Initial load
duke
parents:
diff changeset
11 When debugging remote core dumps it is easier to work with command line tools instead of
a61af66fc99e Initial load
duke
parents:
diff changeset
12 GUI tools. Command line HSDB (CLHSDB) tool is alternative to SA GUI tool HSDB.
a61af66fc99e Initial load
duke
parents:
diff changeset
13 </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
14
a61af66fc99e Initial load
duke
parents:
diff changeset
15 <p>
a61af66fc99e Initial load
duke
parents:
diff changeset
16 There is also JavaScript based SA command line interface called <a href="jsdb.html">jsdb</a>.
a61af66fc99e Initial load
duke
parents:
diff changeset
17 But, CLHSDB supports Unix shell-like (or dbx/gdb-like) command line interface with
a61af66fc99e Initial load
duke
parents:
diff changeset
18 support for output redirection/appending (familiar >, >>), command history and so on.
a61af66fc99e Initial load
duke
parents:
diff changeset
19 Each CLHSDB command can have zero or more arguments and optionally end with output redirection
a61af66fc99e Initial load
duke
parents:
diff changeset
20 (or append) to a file. Commands may be stored in a file and run using <b>source</b> command.
a61af66fc99e Initial load
duke
parents:
diff changeset
21 <b>help</b> command prints usage message for all supported commands (or a specific command)
a61af66fc99e Initial load
duke
parents:
diff changeset
22 </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
23
a61af66fc99e Initial load
duke
parents:
diff changeset
24 <h3>Shell/batch scripts to run command line HSDB</h3>
a61af66fc99e Initial load
duke
parents:
diff changeset
25
a61af66fc99e Initial load
duke
parents:
diff changeset
26 <ul>
a61af66fc99e Initial load
duke
parents:
diff changeset
27 <li>clhsdbproc.sh
a61af66fc99e Initial load
duke
parents:
diff changeset
28 <li>clhsdbproc64.sh
a61af66fc99e Initial load
duke
parents:
diff changeset
29 <li>clhsdbwindbg.bat
a61af66fc99e Initial load
duke
parents:
diff changeset
30 <li>clhsdbwindbg64.bat
a61af66fc99e Initial load
duke
parents:
diff changeset
31 </ul>
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 <h3>Annotated output of CLHSDB help command</h3>
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 <pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
36 <code>
a61af66fc99e Initial load
duke
parents:
diff changeset
37 Available commands:
a61af66fc99e Initial load
duke
parents:
diff changeset
38 assert true | false <font color="red">turn on/off asserts in SA code</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
39 attach pid | exec core <font color="red">attach SA to a process or core</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
40 class name <font color="red">find a Java class from debuggee and print oop</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
41 classes <font color="red">print all loaded Java classes with klassOop</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
42 detach <font color="red">detach SA from current target</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
43 dis address [ length ] <font color="red">disassemble (sparc/x86) specified number of instructions from given address</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
44 dumpclass { address | name } [ directory ] <font color="red">dump .class file for given klassOop or class name</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
45 dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
46 echo [ true | false ] <font color="red">turn on/off command echo mode</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
47 examine [ address/count ] | [ address,address] <font color="red">show contents of memory from given address</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
48 field [ type [ name fieldtype isStatic offset address ] ] <font color="red">print info about a field of HotSpot type</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
49 findpc address <font color="red">print info. about pointer location</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
50 flags [ flag ] <font color="red">show all -XX flag name value pairs. or just show given flag</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
51 help [ command ] <font color="red">print help message for all commands or just given command</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
52 history <font color="red">show command history. usual !command-number syntax works.</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
53 inspect expression <font color="red">inspect a given oop</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
54 jdis address <font color="red">show bytecode disassembly of a given methodOop</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
55 jhisto <font color="red">show Java heap histogram</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
56 jseval script <font color="red">evaluate a given string as JavaScript code</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
57 jsload file <font color="red">load and evaluate a JavaScript file</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
58 jstack [-v] <font color="red">show Java stack trace of all Java threads. -v is verbose mode</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
59 livenmethods <font color="red">show all live nmethods</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
60 mem address [ length ] <font color="red">show contents of memory -- also shows closest ELF/COFF symbol if found</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
61 pmap <font color="red">show Solaris pmap-like output</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
62 print expression <font color="red">print given klassOop, methodOop or arbitrary address</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
63 printas type expression <font color="red">print given address as given HotSpot type. eg. print JavaThread &lt;address&gt;</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
64 printstatics [ type ] <font color="red">print static fields of given HotSpot type (or all types if none specified)</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
65 pstack [-v] <font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
66 quit <font color="red">quit CLHSDB tool</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
67 reattach <font color="red">detach and re-attach SA to current target</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
68 scanoops start end [ type ] <font color="red">scan a Oop from given start to end address</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
69 search [ heap | codecache | threads ] value <font color="red">search a value in heap or codecache or threads</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
70 source filename <font color="red">load and execute CLHSDB commands from given file</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
71 symbol name <font color="red">show address of a given ELF/COFF symbol</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
72 sysprops <font color="red">show all Java System properties</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
73 threads <font color="red">show all Java threads</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
74 tokenize ...
a61af66fc99e Initial load
duke
parents:
diff changeset
75 type [ type [ name super isOop isInteger isUnsigned size ] ] <font color="red">show info. on HotSpot type</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
76 universe <font color="red">print gc universe</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
77 verbose true | false <font color="red">turn on/off verbose mode</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
78 versioncheck [ true | false ] <font color="red">turn on/off debuggee VM version check</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
79 whatis address <font color="red">print info about any arbitrary address</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
80 where { -a | id } <font color="red">print Java stack trace of given Java thread or all Java threads (-a)</font>
a61af66fc99e Initial load
duke
parents:
diff changeset
81 </code>
a61af66fc99e Initial load
duke
parents:
diff changeset
82 </pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 <h3>JavaScript integration</h3>
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 <p>Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
a61af66fc99e Initial load
duke
parents:
diff changeset
87 by implementing more commands in a JavaScript file and by loading it by <b>jsload</b> command. <b>jseval</b>
a61af66fc99e Initial load
duke
parents:
diff changeset
88 command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
a61af66fc99e Initial load
duke
parents:
diff changeset
89 may be exposed as a CLHSDB command by registering it using JavaScript <b><code>registerCommand</code></b>
a61af66fc99e Initial load
duke
parents:
diff changeset
90 function. This function accepts command name, usage and name of the JavaScript implementation function
a61af66fc99e Initial load
duke
parents:
diff changeset
91 as arguments.
a61af66fc99e Initial load
duke
parents:
diff changeset
92 </p>
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 <h3>Simple CLHSDB command implemented in JavaScript</h3>
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 <b>File: test.js</b>
a61af66fc99e Initial load
duke
parents:
diff changeset
97 <pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
98 <code>
a61af66fc99e Initial load
duke
parents:
diff changeset
99 function helloImpl(name) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 println("hello, " + name);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // register the above JavaScript function as CLHSDB command
a61af66fc99e Initial load
duke
parents:
diff changeset
104 registerCommand("hello", "hello name", "helloImpl");
a61af66fc99e Initial load
duke
parents:
diff changeset
105 </code>
a61af66fc99e Initial load
duke
parents:
diff changeset
106 </pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
107 ---------<br>
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 "test.js" can be loaded in CLHSDB prompt using <b>jsload</b> command using
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 <pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
112 <code>
a61af66fc99e Initial load
duke
parents:
diff changeset
113 hsdb&gt; jsload test.js
a61af66fc99e Initial load
duke
parents:
diff changeset
114 </code>
a61af66fc99e Initial load
duke
parents:
diff changeset
115 </pre>
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 </body>
a61af66fc99e Initial load
duke
parents:
diff changeset
118 </html>