1N/A<
h1>Command line HSDB</
h1>
1N/AWhen debugging remote core dumps it is easier to work with command line tools instead of
1N/AGUI tools. Command line HSDB (CLHSDB) tool is alternative to SA GUI tool HSDB.
1N/AThere is also JavaScript based SA command line interface called <
a href="jsdb.html">jsdb</
a>.
1N/ABut, CLHSDB supports Unix shell-like (or
dbx/
gdb-like) command line interface with
1N/AEach CLHSDB command can have zero or more arguments and optionally end with output redirection
1N/A(or append) to a file. Commands may be stored in a file and run using <
b>source</
b> command.
1N/A<
b>help</
b> command prints usage message for all supported commands (or a specific command)
1N/A<
h3>Annotated output of CLHSDB help command</
h3>
1N/A assert true | false <
font color="red">turn
on/
off asserts in SA code</
font>
1N/A attach pid | exec core <
font color="red">attach SA to a process or core</
font>
1N/A class name <
font color="red">find a Java class from debuggee and print oop</
font>
1N/A classes <
font color="red">print all loaded Java classes with klassOop</
font>
1N/A detach <
font color="red">detach SA from current target</
font>
1N/A dis address [ length ] <
font color="red">disassemble (
sparc/
x86) specified number of instructions from given address</
font>
1N/A dumpclass { address | name } [ directory ] <
font color="red">dump .class file for given klassOop or class name</
font>
1N/A dumpheap [ file ] <
font color="red">dump heap in hprof binary format</
font>
1N/A echo [ true | false ] <
font color="red">turn
on/
off command echo mode</
font>
1N/A examine [
address/
count ] | [ address,address] <
font color="red">show contents of memory from given address</
font>
1N/A field [ type [ name fieldtype isStatic offset address ] ] <
font color="red">print info about a field of HotSpot type</
font>
1N/A findpc address <
font color="red">print info. about pointer location</
font>
1N/A flags [ flag ] <
font color="red">show all -XX flag name value pairs. or just show given flag</
font>
1N/A help [ command ] <
font color="red">print help message for all commands or just given command</
font>
1N/A history <
font color="red">show command history. usual !command-number syntax works.</
font>
1N/A inspect expression <
font color="red">inspect a given oop</
font>
jdis address <
font color="red">show bytecode disassembly of a given methodOop</
font>
jhisto <
font color="red">show Java heap histogram</
font>
jseval script <
font color="red">evaluate a given string as JavaScript code</
font>
jsload file <
font color="red">load and evaluate a JavaScript file</
font>
jstack [-v] <
font color="red">show Java stack trace of all Java threads. -v is verbose mode</
font>
livenmethods <
font color="red">show all live nmethods</
font>
mem address [ length ] <
font color="red">show contents of memory -- also shows closest
ELF/
COFF symbol if found</
font>
pmap <
font color="red">show Solaris pmap-like output</
font>
print expression <
font color="red">print given klassOop, methodOop or arbitrary address</
font>
printas type expression <
font color="red">print given address as given HotSpot type. eg. print JavaThread <address></
font>
printstatics [ type ] <
font color="red">print static fields of given HotSpot type (or all types if none specified)</
font>
pstack [-v] <
font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode</
font>
quit <
font color="red">quit CLHSDB tool</
font>
reattach <
font color="red">detach and re-attach SA to current target</
font>
scanoops start end [ type ] <
font color="red">scan a Oop from given start to end address</
font>
search [ heap | codecache | threads ] value <
font color="red">search a value in heap or codecache or threads</
font>
source filename <
font color="red">load and execute CLHSDB commands from given file</
font>
symbol name <
font color="red">show address of a given
ELF/
COFF symbol</
font>
sysprops <
font color="red">show all Java System properties</
font>
threads <
font color="red">show all Java threads</
font>
type [ type [ name super isOop isInteger isUnsigned size ] ] <
font color="red">show info. on HotSpot type</
font>
universe <
font color="red">print gc universe</
font>
verbose true | false <
font color="red">turn
on/
off verbose mode</
font>
versioncheck [ true | false ] <
font color="red">turn
on/
off debuggee VM version check</
font>
whatis address <
font color="red">print info about any arbitrary address</
font>
where { -a | id } <
font color="red">print Java stack trace of given Java thread or all Java threads (-a)</
font>
<
h3>JavaScript integration</
h3>
<
p>Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
by implementing more commands in a JavaScript file and by loading it by <
b>jsload</
b> command. <
b>jseval</
b>
command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
may be exposed as a CLHSDB command by registering it using JavaScript <
b><
code>registerCommand</
code></
b>
function. This function accepts command name, usage and name of the JavaScript implementation function
<
h3>Simple CLHSDB command implemented in JavaScript</
h3>
function helloImpl(name) {
println("hello, " + name);
// register the above JavaScript function as CLHSDB command
registerCommand("hello", "hello name", "helloImpl");
"
test.js" can be loaded in CLHSDB prompt using <
b>jsload</
b> command using