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