Skip to content

allenzhu/SeeVar

Repository files navigation

SeeVar

See the attribute of the object in java heap.
It depends on SA(Serviceability Agent) which provides a set of APIs for the Java programming language which model the state of Sun Microsystems Java HotSpot Virtual Machine. So it is convenient for Java programmer to retrieve the information of the vm internal with it. Many java diagnose tools build upon it, such as jstack, jmap and so on.

Usage

javac -cp .:$JAVA_HOME/lib/sa-jdi.jar *.java
java -cp .:$JAVA_HOME/lib/sa-jdi.jar FetchObj $classname $attribute $type $verbose $pid

Parameter

classname : full name of the class
attribute : attribute name of the class
type : type of the attribute
verbose : wheather need output the detail info or not (true or false)
pid : the process id which need to be attached

Output(without verbose)

java -cp .:$JAVA_HOME/lib/sa-jdi.jar FetchObj Run2 foo int false 26899
Run2 @ 0xe96ec530 (object size = 24)
foo:20
Run2 @ 0xe96ec548 (object size = 24)
foo:30
Run2 @ 0xe96ec560 (object size = 24)
foo:40
Run2 @ 0xe96ec578 (object size = 24)
foo:50
Run2 @ 0xe96ec590 (object size = 24)
foo:60
total Run2 instance count:5
done.cost:1690

Reference

http://static.usenix.org/event/jvm01/full_papers/russell/russell_html/
http://hllvm.group.iteye.com/group/topic/34278

About

see the variable of the object in the heap

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages