7.10.2 -XX:[+|-]HitachiLocalsInStackTrace
-XX:[+|-]HitachiLocalsInStackTrace adds the local variable information of each method to the stack traces that are generated when thread dumps are output, and then outputs the stack traces.
Description
-XX:[+|-]HitachiLocalsInStackTrace adds the local variable information of each method to the stack traces that are generated when thread dumps are output, and then outputs the stack traces.
Syntax
-XX:[+|-]HitachiLocalsInStackTrace
Specifiable values
Type: String
- -XX:+HitachiLocalsInStackTrace
-
Outputs local variable information to the stack traces that are generated when thread dumps are output.
- -XX:-HitachiLocalsInStackTrace
-
Does not output local variable information to the stack traces that are generated when thread dumps are output.
Examples
An example of the output (in the simple output format) when the following Java program example is used is shown below.
- Java program example
class Example2 { public static void main(String[] args) { Example2 e2 = new Example2(); e2.method(); // 4th line } synchronized void method() { int l1 = 1; float l2 = 2.0f; String l3 = "local 3"; Character l4 = new Character('X'); Object l5 = new Thread(); Object[] l6 = new Thread[10]; <Here, a thread dump is output!> // 15th line } }
- Example of output
-
When the -XX:+HitachiLocalsSimpleFormat option and the -XX:+HitachiTrueTypeInLocals option are specified:
"main" #1 prio=5 os_prio=0 jid=<N/A> tid=0x0000000000297800 nid=0x11500 runnable [0x0000000002a8f000..0x0000000002a8f6c0] java.lang.Thread.State: RUNNABLE stack= [0x0000000002a90000..0x0000000002994000..0x0000000002991000..0x0000000002990000] [user cpu time=3790ms, kernel cpu time=78ms] [blocked count=0, waited count=0] at Example2.method(Unknown Source) - locked <0x00000000120d03a8> (a Example2) locals: (Example2) this = <0x00000000120d03a8> (int) l1 = 1 (float) l2 = 2 (java.lang.String) l3 = <0x00000000120d03b8> (java.lang.Character) l4 = <0x00000000120d0600> (java.lang.Object) l5 = <0x00000000120d07f8> (java.lang.Object[]) l6 = <0x00000000120d0bc8> at Example2.main(Unknown Source) locals: (java.lang.String[]) args [arg1] = <0x00000000120d0390> (Example2) e2 = <0x00000000120d03a8>
Notes
-
To collect all local variable information, when you create the class file by using javac, you must embed local variable information in the class file by specifying the -g option or the -g:vars option. If you create the class file without specifying either the -g option or the -g:vars option, the local variable information will be output within the collectable range.
-
In general, the threads collecting the stack trace information do not match the threads that are to be collected. To collect the information, the target threads must be terminated, and the toString method cannot be called. For this reason, the specification of the -XX:HitachiCallToString option becomes invalid.
-
When the local variable information of a method containing a complicated control structure and many lines is output, analysis takes a long time. Therefore, the output of extended thread dumps and the acquisition of thread stack traces might take a long time.