[PATCH] A small fix on "scanoops" command in CLHSDB
=?gb2312?B?1Ma07w==?=
yunda.mly at taobao.com
Tue Feb 19 01:24:43 PST 2013
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.
±¾µçÓÊ(°üÀ¨Èκθ½¼þ)¿ÉÄܺ¬ÓлúÃÜ×ÊÁϲ¢ÊÜ·¨Âɱ£»¤¡£ÈçÄú²»ÊÇÕýÈ·µÄÊÕ¼þÈË£¬ÇëÄúÁ¢¼´É¾³ý±¾Óʼþ¡£Çë²»Òª½«±¾µçÓʽøÐи´ÖƲ¢ÓÃ×÷ÈκÎÆäËûÓÃ;¡¢»ò͸¶±¾ÓʼþÖ®ÄÚÈÝ¡£Ð»Ð»¡£
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20130219/2e8b846a/attachment-0001.html
More information about the serviceability-dev
mailing list