[PATCH] A small fix on "scanoops" command in CLHSDB

云达(Yunda) yunda.mly at taobao.com
Wed Mar 6 16:10:35 PST 2013


Staffan,

Thanks for doing this, too☺

Regards,
Yunda

From: Staffan Larsen [mailto:staffan.larsen at oracle.com]
Sent: Tuesday, March 05, 2013 9:21 PM
To: 云达(Yunda)
Cc: Krystal Mo; serviceability-dev at openjdk.java.net
Subject: Re: [PATCH] A small fix on "scanoops" command in CLHSDB

I have created issue JDK-8009457 to track this. Still waiting for a review, though.

Thanks,
/Staffan

On 22 feb 2013, at 04:32, 云达 <yunda.mly at taobao.com<mailto:yunda.mly at taobao.com>> wrote:


Staffan & Kris,

Thank both of you for reviewing this. Hope you two could be official Reviewer soon ☺

Regards,
Yunda

发件人: Staffan Larsen [mailto:staffan.larsen at oracle.com<http://oracle.com>]
发送时间: 2013年2月21日 18:21
收件人: Krystal Mo
抄送: 云达; serviceability-dev at openjdk.java.net<mailto:serviceability-dev at openjdk.java.net>
主题: Re: [PATCH] A small fix on "scanoops" command in CLHSDB

I think this looks good, too. I'm not an official Reviewer, either.

Thanks,
/Staffan

On 21 feb 2013, at 04:32, Krystal Mo <krystal.mo at oracle.com<mailto:krystal.mo at oracle.com>> wrote:

Hi Yunda,

This patch looks reasonable to me. But you'll need an official Reviewer to review this.

- Kris
On 2013/2/19 1:24, 云达 wrote:
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


[X]

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.

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



[X]

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/20130307/42f38c6a/attachment-0001.html 


More information about the serviceability-dev mailing list