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