duke@435: duke@435:
duke@435:duke@435: When debugging remote core dumps it is easier to work with command line tools instead of duke@435: GUI tools. Command line HSDB (CLHSDB) tool is alternative to SA GUI tool HSDB. duke@435:
duke@435: duke@435:duke@435: There is also JavaScript based SA command line interface called jsdb. duke@435: But, CLHSDB supports Unix shell-like (or dbx/gdb-like) command line interface with iignatyev@5029: support for output redirection/appending (familiar >, >>), command history and so on. duke@435: Each CLHSDB command can have zero or more arguments and optionally end with output redirection duke@435: (or append) to a file. Commands may be stored in a file and run using source command. duke@435: help command prints usage message for all supported commands (or a specific command) duke@435:
duke@435: duke@435:
duke@435:
duke@435: Available commands:
duke@435: assert true | false turn on/off asserts in SA code
duke@435: attach pid | exec core attach SA to a process or core
minqi@4267: buildreplayjars [all | boot | app] build jars for replay, boot.jar for bootclasses, app.jar for application classes
duke@435: class name find a Java class from debuggee and print oop
coleenp@4037: classes print all loaded Java classes with Klass*
duke@435: detach detach SA from current target
duke@435: dis address [ length ] disassemble (sparc/x86) specified number of instructions from given address
minqi@4267: dissemble address disassemble nmethod
minqi@4267: dumpcfg -a | id Dump the PhaseCFG for every compiler thread that has one live
coleenp@4037: dumpclass { address | name } [ directory ] dump .class file for given Klass* or class name
minqi@4267: dumpcodecache dump codecache contents
duke@435: dumpheap [ file ] dump heap in hprof binary format
minqi@4267: dumpideal -a | id dump ideal graph like debug flag -XX:+PrintIdeal
minqi@4267: dumpilt -a | id dump inline tree for C2 compilation
iignatyev@5029: dumpreplaydata <address> | -a | <thread_id> [>replay.txt] dump replay data into a file
duke@435: echo [ true | false ] turn on/off command echo mode
duke@435: examine [ address/count ] | [ address,address] show contents of memory from given address
duke@435: field [ type [ name fieldtype isStatic offset address ] ] print info about a field of HotSpot type
duke@435: findpc address print info. about pointer location
duke@435: flags [ flag ] show all -XX flag name value pairs. or just show given flag
duke@435: help [ command ] print help message for all commands or just given command
duke@435: history show command history. usual !command-number syntax works.
duke@435: inspect expression inspect a given oop
minqi@4267: intConstant [ name [ value ] ] print out hotspot integer constant(s)
coleenp@4037: jdis address show bytecode disassembly of a given Method*
duke@435: jhisto show Java heap histogram
duke@435: jseval script evaluate a given string as JavaScript code
duke@435: jsload file load and evaluate a JavaScript file
duke@435: jstack [-v] show Java stack trace of all Java threads. -v is verbose mode
duke@435: livenmethods show all live nmethods
minqi@4267: longConstant [ name [ value ] ] print out hotspot long constant(s)s
duke@435: mem address [ length ] show contents of memory -- also shows closest ELF/COFF symbol if found
duke@435: pmap show Solaris pmap-like output
coleenp@4037: print expression print given Klass*, Method* or arbitrary address
duke@435: printas type expression print given address as given HotSpot type. eg. print JavaThread <address>
minqi@4267: printmdo -a | expression print method data oop
duke@435: printstatics [ type ] print static fields of given HotSpot type (or all types if none specified)
duke@435: pstack [-v] show mixed mode stack trace for all Java, non-Java threads. -v is verbose mode
duke@435: quit quit CLHSDB tool
duke@435: reattach detach and re-attach SA to current target
minqi@4267: revptrs find liveness of oops
duke@435: scanoops start end [ type ] scan a Oop from given start to end address
duke@435: search [ heap | codecache | threads ] value search a value in heap or codecache or threads
duke@435: source filename load and execute CLHSDB commands from given file
duke@435: symbol name show address of a given ELF/COFF symbol
duke@435: sysprops show all Java System properties
minqi@4267: thread id show thread of id
duke@435: threads show all Java threads
duke@435: tokenize ...
duke@435: type [ type [ name super isOop isInteger isUnsigned size ] ] show info. on HotSpot type
duke@435: universe print gc universe
minqi@4267: vmstructsdump dump hotspot type library in text
duke@435: verbose true | false turn on/off verbose mode
duke@435: versioncheck [ true | false ] turn on/off debuggee VM version check
duke@435: whatis address print info about any arbitrary address
duke@435: where { -a | id } print Java stack trace of given Java thread or all Java threads (-a)
duke@435:
duke@435:
duke@435:
duke@435: Few CLHSDB commands are already implemented in JavaScript. It is possible to extend CLHSDB command set
duke@435: by implementing more commands in a JavaScript file and by loading it by jsload command. jseval
duke@435: command may be used to evaluate arbitrary JavaScript expression from a string. Any JavaScript function
duke@435: may be exposed as a CLHSDB command by registering it using JavaScript registerCommand
iignatyev@5029: function. This function accepts command name, usage and name of the JavaScript implementation function
duke@435: as arguments.
duke@435:
duke@435:
duke@435: function helloImpl(name) {
duke@435: println("hello, " + name);
duke@435: }
duke@435:
duke@435: // register the above JavaScript function as CLHSDB command
duke@435: registerCommand("hello", "hello name", "helloImpl");
duke@435:
duke@435:
duke@435: ---------
duke@435:
duke@435: hsdb> jsload test.js
duke@435:
duke@435:
duke@435:
iignatyev@5029: minqi@4267: When a java process crashes in compiled method, usually a core file is saved. iignatyev@5029: The replay function can reproduce the compiling process in the core. iignatyev@5029: cireplay.html minqi@4267: duke@435: duke@435: