harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r797395 - /harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp
Date Fri, 24 Jul 2009 09:48:01 GMT
Author: regisxu
Date: Fri Jul 24 09:48:00 2009
New Revision: 797395

URL: http://svn.apache.org/viewvc?rev=797395&view=rev
Log:
Apply patch for HARMONY-6284: [JDWP][Java6] The capability of HCR should be checked in case
selective debug is enabled

Modified:
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp?rev=797395&r1=797394&r2=797395&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ThreadReference.cpp
Fri Jul 24 09:48:00 2009
@@ -269,18 +269,40 @@
         }
 #endif
         
-        jboolean isObsolete;
-        JVMTI_TRACE(LOG_DEBUG, err, jvmti->IsMethodObsolete(frame_buffer[j].method, &isObsolete));
-
         // we should return 0 as the methodID for obsolete method.
-        if(isObsolete) {	 
+
+        jvmtiCapabilities caps;
+        memset(&caps, 0, sizeof(caps));
+
+        JVMTI_TRACE(LOG_DEBUG, err, jvmti->GetCapabilities(&caps));
+        if (err != JVMTI_ERROR_NONE) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "Unable to get capabilities: %d", err));
+            return err;
+        }
+       // When selective debug is enabled, HCR is not allowed. So we need to check if HCR
is disabled first before invoking IsMethodObsolete.
+       // If so, just return the methodID directly.
+        if(caps.can_redefine_classes != 1) {
             m_cmdParser->reply.WriteLocation(jni, typeTag,
-                        declaring_class, 0,
+                        declaring_class, frame_buffer[j].method,
                         frame_buffer[j].location);
-        } else {
-            m_cmdParser->reply.WriteLocation(jni, typeTag,
+        }else {
+            jboolean isObsolete;
+            JVMTI_TRACE(LOG_DEBUG, err, jvmti->IsMethodObsolete(frame_buffer[j].method,
&isObsolete));
+            if (err != JVMTI_ERROR_NONE) {
+                JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "Frames: IsMethodObsolete return error
code: %d", err));
+                return err;
+            }
+            if(isObsolete) {
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Frames: the method is obsolete: frame#=%d,
loc=%lld, methodID=%p, classID=%p, typeTag=%d",
+                            j, frame_buffer[j].location, frame_buffer[j].method, declaring_class,
typeTag));
+                m_cmdParser->reply.WriteLocation(jni, typeTag,
+                            declaring_class, 0,
+                            frame_buffer[j].location);
+            }else {
+                m_cmdParser->reply.WriteLocation(jni, typeTag,
                         declaring_class, frame_buffer[j].method,
                         frame_buffer[j].location);
+            }
         }
     }
 



Mime
View raw message