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