agent/doc/clhsdb.html

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 5029
7b23cb975cf2
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

duke@435 1 <html>
duke@435 2 <head>
duke@435 3 <title>
duke@435 4 Command line HSDB
duke@435 5 </title>
duke@435 6 </head>
duke@435 7 <body>
duke@435 8
duke@435 9 <h1>Command line HSDB</h1>
duke@435 10 <p>
duke@435 11 When debugging remote core dumps it is easier to work with command line tools instead of
duke@435 12 GUI tools. Command line HSDB (CLHSDB) tool is alternative to SA GUI tool HSDB.
duke@435 13 </p>
duke@435 14
duke@435 15 <p>
duke@435 16 There is also JavaScript based SA command line interface called <a href="jsdb.html">jsdb</a>.
duke@435 17 But, CLHSDB supports Unix shell-like (or dbx/gdb-like) command line interface with
iignatyev@5029 18 support for output redirection/appending (familiar &gt;, &gt;&gt;), command history and so on.
duke@435 19 Each CLHSDB command can have zero or more arguments and optionally end with output redirection
duke@435 20 (or append) to a file. Commands may be stored in a file and run using <b>source</b> command.
duke@435 21 <b>help</b> command prints usage message for all supported commands (or a specific command)
duke@435 22 </p>
duke@435 23
duke@435 24 <h3>Shell/batch scripts to run command line HSDB</h3>
duke@435 25
duke@435 26 <ul>
duke@435 27 <li>clhsdbproc.sh
duke@435 28 <li>clhsdbproc64.sh
duke@435 29 <li>clhsdbwindbg.bat
duke@435 30 <li>clhsdbwindbg64.bat
duke@435 31 </ul>
duke@435 32
duke@435 33 <h3>Annotated output of CLHSDB help command</h3>
duke@435 34
duke@435 35 <pre>
duke@435 36 <code>
duke@435 37 Available commands:
duke@435 38 assert true | false <font color="red">turn on/off asserts in SA code</font>
duke@435 39 attach pid | exec core <font color="red">attach SA to a process or core</font>
minqi@4267 40 buildreplayjars [all | boot | app] <font color="red">build jars for replay, boot.jar for bootclasses, app.jar for application classes</font>
duke@435 41 class name <font color="red">find a Java class from debuggee and print oop</font>
coleenp@4037 42 classes <font color="red">print all loaded Java classes with Klass*</font>
duke@435 43 detach <font color="red">detach SA from current target</font>
duke@435 44 dis address [ length ] <font color="red">disassemble (sparc/x86) specified number of instructions from given address</font>
minqi@4267 45 dissemble address <font color="red">disassemble nmethod</font>
minqi@4267 46 dumpcfg -a | id <font color="red">Dump the PhaseCFG for every compiler thread that has one live</font>
coleenp@4037 47 dumpclass { address | name } [ directory ] <font color="red">dump .class file for given Klass* or class name</font>
minqi@4267 48 dumpcodecache <font color="red">dump codecache contents</font>
duke@435 49 dumpheap [ file ] <font color="red">dump heap in hprof binary format</font>
minqi@4267 50 dumpideal -a | id <font color="red">dump ideal graph like debug flag -XX:+PrintIdeal</font>
minqi@4267 51 dumpilt -a | id <font color="red">dump inline tree for C2 compilation</font>
iignatyev@5029 52 dumpreplaydata &lt;address&gt; | -a | &lt;thread_id&gt; [&gt;replay.txt] <font color="red">dump replay data into a file</font>
duke@435 53 echo [ true | false ] <font color="red">turn on/off command echo mode</font>
duke@435 54 examine [ address/count ] | [ address,address] <font color="red">show contents of memory from given address</font>
duke@435 55 field [ type [ name fieldtype isStatic offset address ] ] <font color="red">print info about a field of HotSpot type</font>
duke@435 56 findpc address <font color="red">print info. about pointer location</font>
duke@435 57 flags [ flag ] <font color="red">show all -XX flag name value pairs. or just show given flag</font>
duke@435 58 help [ command ] <font color="red">print help message for all commands or just given command</font>
duke@435 59 history <font color="red">show command history. usual !command-number syntax works.</font>
duke@435 60 inspect expression <font color="red">inspect a given oop</font>
minqi@4267 61 intConstant [ name [ value ] ] <font color="red">print out hotspot integer constant(s)</font>
coleenp@4037 62 jdis address <font color="red">show bytecode disassembly of a given Method*</font>
duke@435 63 jhisto <font color="red">show Java heap histogram</font>
duke@435 64 jseval script <font color="red">evaluate a given string as JavaScript code</font>
duke@435 65 jsload file <font color="red">load and evaluate a JavaScript file</font>
duke@435 66 jstack [-v] <font color="red">show Java stack trace of all Java threads. -v is verbose mode</font>
duke@435 67 livenmethods <font color="red">show all live nmethods</font>
minqi@4267 68 longConstant [ name [ value ] ] <font color="red">print out hotspot long constant(s)s</font>
duke@435 69 mem address [ length ] <font color="red">show contents of memory -- also shows closest ELF/COFF symbol if found</font>
duke@435 70 pmap <font color="red">show Solaris pmap-like output</font>
coleenp@4037 71 print expression <font color="red">print given Klass*, Method* or arbitrary address</font>
duke@435 72 printas type expression <font color="red">print given address as given HotSpot type. eg. print JavaThread &lt;address&gt;</font>
minqi@4267 73 printmdo -a | expression <font color="red">print method data oop</font>
duke@435 74 printstatics [ type ] <font color="red">print static fields of given HotSpot type (or all types if none specified)</font>
duke@435 75 pstack [-v] <font color="red">show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode</font>
duke@435 76 quit <font color="red">quit CLHSDB tool</font>
duke@435 77 reattach <font color="red">detach and re-attach SA to current target</font>
minqi@4267 78 revptrs <font color="red">find liveness of oops</font>
duke@435 79 scanoops start end [ type ] <font color="red">scan a Oop from given start to end address</font>
duke@435 80 search [ heap | codecache | threads ] value <font color="red">search a value in heap or codecache or threads</font>
duke@435 81 source filename <font color="red">load and execute CLHSDB commands from given file</font>
duke@435 82 symbol name <font color="red">show address of a given ELF/COFF symbol</font>
duke@435 83 sysprops <font color="red">show all Java System properties</font>
minqi@4267 84 thread id <font color="red">show thread of id</font>
duke@435 85 threads <font color="red">show all Java threads</font>
duke@435 86 tokenize ...
duke@435 87 type [ type [ name super isOop isInteger isUnsigned size ] ] <font color="red">show info. on HotSpot type</font>
duke@435 88 universe <font color="red">print gc universe</font>
minqi@4267 89 vmstructsdump <font color="red">dump hotspot type library in text</font>
duke@435 90 verbose true | false <font color="red">turn on/off verbose mode</font>
duke@435 91 versioncheck [ true | false ] <font color="red">turn on/off debuggee VM version check</font>
duke@435 92 whatis address <font color="red">print info about any arbitrary address</font>
duke@435 93 where { -a | id } <font color="red">print Java stack trace of given Java thread or all Java threads (-a)</font>
duke@435 94 </code>
duke@435 95 </pre>
duke@435 96
duke@435 97 <h3>JavaScript integration</h3>
duke@435 98
iignatyev@5029 99 <p>Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
duke@435 100 by implementing more commands in a JavaScript file and by loading it by <b>jsload</b> command. <b>jseval</b>
duke@435 101 command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
duke@435 102 may be exposed as a CLHSDB command by registering it using JavaScript <b><code>registerCommand</code></b>
iignatyev@5029 103 function. This function accepts command name, usage and name of the JavaScript implementation function
duke@435 104 as arguments.
duke@435 105 </p>
duke@435 106
duke@435 107 <h3>Simple CLHSDB command implemented in JavaScript</h3>
duke@435 108
duke@435 109 <b>File: test.js</b>
duke@435 110 <pre>
duke@435 111 <code>
duke@435 112 function helloImpl(name) {
duke@435 113 println("hello, " + name);
duke@435 114 }
duke@435 115
duke@435 116 // register the above JavaScript function as CLHSDB command
duke@435 117 registerCommand("hello", "hello name", "helloImpl");
duke@435 118 </code>
duke@435 119 </pre>
duke@435 120 ---------<br>
duke@435 121
duke@435 122 "test.js" can be loaded in CLHSDB prompt using <b>jsload</b> command using
duke@435 123
duke@435 124 <pre>
duke@435 125 <code>
duke@435 126 hsdb&gt; jsload test.js
duke@435 127 </code>
duke@435 128 </pre>
duke@435 129
iignatyev@5029 130 <h3>Compilation Replay</h3>
minqi@4267 131 <p>
minqi@4267 132 When a java process crashes in compiled method, usually a core file is saved.
iignatyev@5029 133 The replay function can reproduce the compiling process in the core.
iignatyev@5029 134 <a href="cireplay.html">cireplay.html</a>
minqi@4267 135
duke@435 136 </body>
duke@435 137 </html>

mercurial