assert true | false Enable or disable asserts throughout the SA implementation. Defauls to true. attach pid | exec core Attach to the specified JVM process (pid) or to a JVM core file. "exec" is the location of executable and core is the location of the core file. buildreplayjars [ all | app | boot ] | [ prefix ] class name Prints the address of the InstanceKlass object for the class specified by name. For exampe java.lang.Thread or java/lang/Thread. This InstanceKlass object can be used in other commands that take a VM object such as "inspect". Can only be used to lookup InstanceKlass types, not ArrayKlass. ArrayKlass objects can be discovered by dumping all classes using the "classes" command. classes Prints the entire dictionary of loaded classes, which includes the class name and address of each Klass object, including array classes. The Klass object can be passed to other commands that take a VM object such as "inspect". detach Detach from the JVM process or core that was attached to with the "attach" command. dis address [length] Disassemble a raw address, such as JVM code. disassemble address Disassemble a CodeBlob (VM generated code). The specified address can be anywhere in the CodeBlob. The entire CodeBlob will be disassembled. dumpcfg { -a | id } Dump the PhaseCFG for every compiler thread that has one live. Use -a for all compiler threads and "id" to specify a specific compiler thread. "id" is the address of the CompilerThread VM object. If no PhaseCFG is live, just the address of the compiler thread is dumped. dumpclass {address | name} [directory] Dump the class file for the class specifed by its "address" or name. The class file is generated in the directory specified. dumpcodecache Dump all code blobs in the entire code cache. dumpheap [filename] Dump the heap as an hprof file (binary heap). The default file name is heap.bin. dumpideal { -a | id } Do a full dump of the nodes reachable from root in each compiler thread. Either all compiler threads (-a) or just the specified compiler thread (id) are dumped. "id" is the address of the CompilerThread VM object. dumpilt { -a | id } Dumps the InlineTree of a C2 compile. Either all compiler threads (-a) or just the specified compiler thread (id) are dumped. "id" is the address of the CompilerThread VM object. dumpreplaydata {
| -a | } echo [ true | false ] Turn the echoing of clhsdb commands on or off. Default is off. This is useful for test frameworks that send commands to a clhsdb process and then print the output of the command. By turning on echoing, the command will be included in this output. examine [ address/count ] | [ address,address] ***Note "count" is optional. Need to fix this in the help output. Dumps the memory at the speficed address or address range. "count" is the number of machine words. field [ type [ name fieldtype isStatic offset address ] ] With no arguments, prints information about every field in every hotspot type. The format is exactly as the syntax of this command. For example: field CollectedHeap _reserved MemRegion false 32 0x0 The field belongs to the type "CollectedHeap", the field name is "_reserved", the field type is "MemRegion", it is not static, the offset in the CollectedHeap type is 32, and the address is given as 0x0 since it is an instance fields. Likewise static fields have an offset of 0x0 and a real address is provided. The "type" argument can be specified to just list the fields of the specifid VM type, and additionally the "name" field can be speficied to just list the specified field of the specified type. When all arguments are specified, this creates a new field for the speficied type. This is useful if the field was left out of vmstructs, but you want it included in dumps of VM objects of the specified type. For example, when the "inspect" command is used to print the fields of a VM object. You can also first use the "type" command to adding a new type, and the "field" command to populate the fields of the new type. findpc address Attempts to figure out what is stored at the specfied address, and display information about the address. The information displayed depends on the type of data the address points to. It will search for a matching native symbols in the VM excutable, libs, and data sections. It will also search the code cache, the GC heap, JNI Handles, and thread stacks. If in none of these, it tries to determine if the address represents a VM Metadata object. findsym name Finds the native symbol specified by "name". The address is displayed. flags [ flag | -nd ] With no arguments displays information about all VM command line flags. The "flag" option can be used to limit the output to just the specified flag. "-nd" is used to disable the printing of flags that retain their default values. g1regiondetails Prints the details (ranges) of all the g1 regions. Only valid when using G1. help [ command ] Displays all help, or help for a specific command. history History of clhsdb commands issued so far inspect expression **** address instead of expression Inspect a VM object, java heap object, or CodeBlob at specified address. For a VM object, all known fields (as defined in vmstructs) are displayed. For a java heap object, all fields of the object are displayed. For a CodeBlob, any address in the blob can be specified. The fields of the CodeBlob object are dumped. Use "disassemble" for a disassembly of the CodeBlob. Also see "print" command for dumping VM MetaData and CodeBlob objects in more useful ways. intConstant [ name [ value ] ] Display the "int" constants from vmstructs. With no arguments, all constants are displayed. With just the "name" argument, only the named argument is displayed. If the "value" argument is also specified, then a new "int" constant is added with the specified name and value. NOTE: It is not under how this command is useful. jdis address jhisto jstack [-v] livenmethods Print all nmethod CodeBlobs that are referenced from frames in the java stack. longConstant [ name [ value ] ] Display the "long" constants from vmstructs. With no arguments, all constants are displayed. With just the "name" argument, only the named argument is displayed. If the "value" argument is also specified, then a new "long" constant is added with the specified name and value. NOTE: It is not under how this command is useful. pmap print expression Print out information about a VM Metadata object located at the specified address, or for the CodeBlob containing the specified address. This is similar to the "inspect" command, except rather than just dumping the fields of the object, the object is displayed in a more useful way such as including the disassembled bytecodes of a Method object. For VM Metadata objects, the object at the specified address needs to be an instance of a subclass of the VM Metadata type, such as InstanceKlass, Method, Field, and ConstantPool objects. The information displayed varies depending on the type. For a CodeBlob address, the CodeBlob will be disassembled. printall printas type expression This is similar to using the inspect command on an VM object, but casts the object to the specified type. This is useful when the VM object is a subclass of a type known to SA, but the subclass type is not know to SA. printmdo [ -a | expression ] Prints the VM MethodData object at the specified address, or all MethodData objects if -a is specified. MethodData object pointers can be found in the Method::_method_data field. printstatics [ type ] pstack [-v] quit reattach revptrs address scanoops start end [ type ] search [ heap | perm | rawheap | codecache | threads ] value perm is no longer supported source filename symbol address sysprops thread { -a | id } threads tokenize ... type [ type [ name super isOop isInteger isUnsigned size ] ] ***name is not actually an argument. Remove from help. universe verbose true | false versioncheck [ true | false ] vmstructsdump where { -a | id } ---------------------- How to display the value of static fields of a java class: # Get the InstanceKlass for the class hsdb> class java.lang.System java/lang/System @0x000000080000f388 # inspect the InstanceKlass hsdb> inspect 0x000000080000f388 Type is InstanceKlass (size of 480) ... OopHandle Klass::_java_mirror: OopHandle @ 0x000000080000f400 ... # Indirect (twice) from the _java_mirror OopHandle to the oop for the Class instance hsdb> examine 0x000000080000f400 0x000000080000f400: 0x00007f401c12e5e8 hsdb> examine 0x00007f401c12e5e8 0x00007f401c12e5e8: 0x00000007fef00770 hsdb> findpc 0x00000007fef00770 Address 0x00000007fef00770: In unknown section of Java heap # Inspect the Class instance. The value of static fields will be dumped. hsdb> inspect 0x00000007fef00770 instance of Oop for java/lang/Class @ 0x00000007fef00770 @ 0x00000007fef00770 (size = 160) in: Oop for java/io/BufferedInputStream @ 0x00000000820233f0 out: Oop for java/io/PrintStream @ 0x0000000082023470 err: Oop for java/io/PrintStream @ 0x00000000820236f0 NEVER: 1 MAYBE: 2 allowSecurityManager: 2 --------------------- vmstructs commands intConstant [ name [ value ] ] longConstant [ name [ value ] ] field [ type [ name fieldtype isStatic offset address ] ] type [ type [ name super isOop isInteger isUnsigned size ] ] vmstructsdump compiler related commands dis address [length] disassemble address dumpcfg { -a | id } dumpclass {address | name} [directory] dumpcodecache dumpideal { -a | id } dumpilt { -a | id } dumpreplaydata {
| -a | } buildreplayjars [ all | app | boot ] | [ prefix ] livenmethods inspect expression print expression printmdo [ -a | expression ] search [ heap | perm | rawheap | codecache | threads ] value heap commands dumpheap [filename] g1regiondetails jhisto inspect expression revptrs address scanoops start end [ type ] universe search [ heap | perm | rawheap | codecache | threads ] value commands for VM types inspect expression printstatics [ type ] printas type expression symbol address field [ type [ name fieldtype isStatic offset address ] ] type [ type [ name super isOop isInteger isUnsigned size ] ] commands for VM MetaData class name classes jdis address inspect expression print expression printmdo [ -a | expression ] clhsdb general purpose commands assert true | false echo [ true | false ] verbose true | false versioncheck [ true | false ] help [ command ] history quit attach pid | exec core detach reattach source filename tokenize ... stack and thread commands jstack [-v] pstack [-v] thread { -a | id } threads where { -a | id } search [ heap | perm | rawheap | codecache | threads ] value miscellaneous VM commands flags [ flag | -nd ] pmap printall sysprops memory commands examine [ address/count ] | [ address,address] findpc address findsym name search [ heap | perm | rawheap | codecache | threads ] value