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