Hi all,
I found that when I detached a java process and attached another java process,
the “universe” command of CLHSDB didn’t show the right information. But when I
restarted CLHSDB and attached to the same process the problem disappeared:
hsdb> attach 29211
Attaching to process 29211, please wait...
hsdb> universe
Heap Parameters:
ParallelScavengeHeap [ PSYoungGen [ eden =
[0x00000000ee200000,0x00000000ee289aa8,0x00000000eef70000] , from =
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000] ] PSOldGen [
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000] ] ] hsdb>
hsdb> detach
hsdb> attach 29887
Attaching to process 29887, please wait...
hsdb> universe
Heap Parameters:
unknown subtype of CollectedHeap @ 0x0000000000d56fb0
(0x00000000ca600000,0x0000000100000000)
hsdb> quit
[~]$ java -cp .:$JAVA_HOME/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
hsdb> attach 29887
Attaching to process 29887, please wait...
hsdb> universe
Heap Parameters:
ParallelScavengeHeap [ PSYoungGen [ eden =
[0x00000000ee200000,0x00000000ee289a68,0x00000000eef70000] , from =
[0x00000000ef1a0000,0x00000000ef1a0000,0x00000000ef3d0000] , to =
[0x00000000eef70000,0x00000000eef70000,0x00000000ef1a0000] ] PSOldGen [
[0x00000000ca600000,0x00000000ca600000,0x00000000cc9c0000] ] ] hsdb>
I think it’s caused by the wrong definition of “typeToVtbl” field of
BasicTypeDataBase. Since typeToVtbl should be recreated every time SA attaches
to a new process, it should not be static. So I made a small patch fo fix it:
diff -r ec2eddfed950
agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java
---
a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java
Tue Feb 26 14:09:52 2013 +0100
+++
b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java
Thu Feb 28 11:57:55 2013 +0800
@@ -150,7 +150,7 @@
return VM.getVM().getOopSize();
}
- static HashMap typeToVtbl = new HashMap();
+ private HashMap typeToVtbl = new HashMap();
private Address vtblForType(Type type) {
Address vtblAddr = (Address)typeToVtbl.get(type);
After applying this patch, the problem I mentioned above disappeared.
Regards,
Yunda
________________________________
This email (including any attachments) is confidential and may be legally
privileged. If you received this email in error, please delete it immediately
and do not copy it or use it for any purpose or disclose its contents to any
other person. Thank you.
本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。