Hi all,

When I use “scanoops” command in CLHSDB, I find that if the type doesn’t exist, 
the output will be all the oops in the scope [start, end]. (see below) I think 
that’s irrational because all the oops between 0x00000000ee2000a0 and 
0x00000000ee200550 are of type “java/lang/Class” and there’s no type 
“java/lang/Class2” or “com/taobao/Test” at all!

hsdb> scanoops 0x00000000ee2000a0 0x00000000ee200550
0x00000000ee2000a0 java/lang/Class
0x00000000ee200118 java/lang/Class
0x00000000ee200190 java/lang/Class
0x00000000ee200208 java/lang/Class
0x00000000ee200280 java/lang/Class
0x00000000ee2002f8 java/lang/Class
0x00000000ee200370 java/lang/Class
0x00000000ee2003e8 java/lang/Class
0x00000000ee200460 java/lang/Class
0x00000000ee2004d8 java/lang/Class
hsdb> scanoops 0x00000000ee2000a0 0x00000000ee200550 java/lang/Class2
0x00000000ee2000a0 java/lang/Class
0x00000000ee200118 java/lang/Class
0x00000000ee200190 java/lang/Class
0x00000000ee200208 java/lang/Class
0x00000000ee200280 java/lang/Class
0x00000000ee2002f8 java/lang/Class
0x00000000ee200370 java/lang/Class
0x00000000ee2003e8 java/lang/Class
0x00000000ee200460 java/lang/Class
0x00000000ee2004d8 java/lang/Class
hsdb> scanoops 0x00000000ee2000a0 0x00000000ee200550 com/taobao/Test
0x00000000ee2000a0 java/lang/Class
0x00000000ee200118 java/lang/Class
0x00000000ee200190 java/lang/Class
0x00000000ee200208 java/lang/Class
0x00000000ee200280 java/lang/Class
0x00000000ee2002f8 java/lang/Class
0x00000000ee200370 java/lang/Class
0x00000000ee2003e8 java/lang/Class
0x00000000ee200460 java/lang/Class
0x00000000ee2004d8 java/lang/Class

I know the reason is that the usage of scanoops is “scanoops start end [ type 
]” and “type” is optional. When you don’t input the “type”, the output will be 
all the oops in the scope [start, end]. But I think the two situations are 
different and CLHSDB should give right prompt. So I made a small fix:

diff -r b5e3ec9c69fa 
agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
--- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java   Mon Feb 
18 12:49:53 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Tue Feb 19 
16:43:45 2013 +0800
@@ -1132,6 +1132,10 @@
                     Klass klass = null;
                     if (t.countTokens() == 1) {
                         klass = 
SystemDictionaryHelper.findInstanceKlass(t.nextToken());
+                        if(klass == null) {
+                            out.println("No such type.");
+                            return;
+                        }
                     }
                     while (base != null && base.lessThan(end)) {
                         long step = stride;

And the effect will be:
hsdb> scanoops 0x0000000758600000 0x000000075860ffff com/taobao/Test
No such type.

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.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。

Reply via email to