harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r813730 - in /harmony/enhanced/jdktools/branches/java6/modules/jpda/src: main/native/jdwp/common/agent/core/ test/java/org/apache/harmony/jpda/tests/framework/jdwp/ test/java/org/apache/harmony/jpda/tests/jdwp/Events/
Date Fri, 11 Sep 2009 09:08:26 GMT
Author: odeakin
Date: Fri Sep 11 09:08:26 2009
New Revision: 813730

URL: http://svn.apache.org/viewvc?rev=813730&view=rev
Log:
Final fix for HARMONY-6305 ([jdktools][jdwp] Unexpected VM_DEATH events running JDWP tests
in Java 6 branch) - Match the RI behaviour for MonitorWait and MonitorWaited events, and fix
tests for MonitorContendedEnter and MonitorContendedEntered events expecting the wrong behaviour.

Modified:
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/VmMirror.java
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnterTest.java
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnteredTest.java

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp?rev=813730&r1=813729&r2=813730&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp
Fri Sep 11 09:08:26 2009
@@ -2474,23 +2474,11 @@
 
     jvmtiError err;
     EventInfo eInfo;
+
     memset(&eInfo, 0, sizeof(eInfo));
     eInfo.kind = JDWP_EVENT_MONITOR_WAIT;
     eInfo.thread = thread;
-
-JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
-        &eInfo.method, &eInfo.location));
-    if (err != JVMTI_ERROR_NONE) {
-        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAIT: %d", err));
-        return;
-    }
-
-    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodDeclaringClass(eInfo.method,
-        &eInfo.cls));
-    if (err != JVMTI_ERROR_NONE) {
-        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAIT: %d", err));
-        return;
-    }
+    eInfo.cls = jni->GetObjectClass(object);
 
     JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(eInfo.cls,
         &eInfo.signature, 0));
@@ -2509,6 +2497,12 @@
     }
 #endif // NDEBUG
 
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
+        &eInfo.method, &eInfo.location));
+    if (err != JVMTI_ERROR_NONE) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAIT: %d", err));
+        return;
+    }
 
     jint eventCount = 0;
     RequestID *eventList = 0;
@@ -2556,23 +2550,11 @@
 
     jvmtiError err;
     EventInfo eInfo;
+
     memset(&eInfo, 0, sizeof(eInfo));
     eInfo.kind = JDWP_EVENT_MONITOR_WAITED;
     eInfo.thread = thread;
-
-	JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
-            &eInfo.method, &eInfo.location));
-    if (err != JVMTI_ERROR_NONE) {
-        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAITED: %d", err));
-        return;
-    }
-
-    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodDeclaringClass(eInfo.method,
-        &eInfo.cls));
-    if (err != JVMTI_ERROR_NONE) {
-        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAITED: %d", err));
-        return;
-    }
+    eInfo.cls = jni->GetObjectClass(object);
 
     JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(eInfo.cls,
         &eInfo.signature, 0));
@@ -2591,6 +2573,12 @@
     }
 #endif // NDEBUG
 
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
+        &eInfo.method, &eInfo.location));
+    if (err != JVMTI_ERROR_NONE) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "JDWP error in MONITOR_WAITED: %d", err));
+        return;
+    }
 
     jint eventCount = 0;
     RequestID *eventList = 0;
@@ -2637,9 +2625,11 @@
     bool isAgent = GetThreadManager().IsAgentThread(jni, thread);
     jvmtiError err;
     EventInfo eInfo;
+
     memset(&eInfo, 0, sizeof(eInfo));
     eInfo.kind = JDWP_EVENT_MONITOR_CONTENDED_ENTER;
     eInfo.thread = thread;
+
     JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
         &eInfo.method, &eInfo.location));
     if (err != JVMTI_ERROR_NONE) {
@@ -2654,7 +2644,6 @@
         return;
     }
 
-
     JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(eInfo.cls,
         &eInfo.signature, 0));
     JvmtiAutoFree jafSignature(eInfo.signature);
@@ -2714,9 +2703,11 @@
     bool isAgent = GetThreadManager().IsAgentThread(jni, thread);
     jvmtiError err;
     EventInfo eInfo;
+
     memset(&eInfo, 0, sizeof(eInfo));
     eInfo.kind = JDWP_EVENT_MONITOR_CONTENDED_ENTERED;
     eInfo.thread = thread;
+
     JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFrameLocation(thread, 0,
         &eInfo.method, &eInfo.location));
     if (err != JVMTI_ERROR_NONE) {

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/VmMirror.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/VmMirror.java?rev=813730&r1=813729&r2=813730&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/VmMirror.java
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/framework/jdwp/VmMirror.java
Fri Sep 11 09:08:26 2009
@@ -1053,6 +1053,19 @@
         return setEvent(event);
     }
 
+    public ReplyPacket setMonitorContendedEnterForClassMatch(String classRegexp) {
+        // Prepare corresponding event
+        byte eventKind = JDWPConstants.EventKind.MONITOR_CONTENDED_ENTER;
+        byte suspendPolicy = JDWPConstants.SuspendPolicy.ALL;
+        EventMod[] mods = new EventMod[] { new EventMod() };
+        mods[0].classPattern = classRegexp;
+        mods[0].modKind = EventMod.ModKind.ClassMatch;
+        Event event = new Event(eventKind, suspendPolicy, mods);
+
+        // Set event
+        return setEvent(event);
+    }
+
     /**
      * Set MonitorContendedEntered event request for given class's reference type
      * 
@@ -1072,6 +1085,19 @@
         // Set event
         return setEvent(event);
     }
+
+    public ReplyPacket setMonitorContendedEnteredForClassMatch(String classRegexp) {
+        // Prepare corresponding event
+        byte eventKind = JDWPConstants.EventKind.MONITOR_CONTENDED_ENTERED;
+        byte suspendPolicy = JDWPConstants.SuspendPolicy.ALL;
+        EventMod[] mods = new EventMod[] { new EventMod() };
+        mods[0].classPattern = classRegexp;
+        mods[0].modKind = EventMod.ModKind.ClassMatch;
+        Event event = new Event(eventKind, suspendPolicy, mods);
+
+        // Set event
+        return setEvent(event);
+    }
     
     /**
      * Set MonitorWait event request for given class's reference type

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnterTest.java?rev=813730&r1=813729&r2=813730&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnterTest.java
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnterTest.java
Fri Sep 11 09:08:26 2009
@@ -33,15 +33,12 @@
         return "org.apache.harmony.jpda.tests.jdwp.Events.MonitorContendedEnterAndEnteredDebuggee";
     }
 
-    public void testMonitorContendedEnterForClassOnly() {
+    public void testMonitorContendedEnterForClassMatch() {
         synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
-
-        // Attain Object class id
-        long monitorRefTypeID = getClassIDBySignature(monitorSignature);
-        logWriter.println("==> Object ReferenceType ID = " + monitorRefTypeID);
         
-        // Set MONITOR_CONTENDED_ENTER request for MockMonitorClass
-        debuggeeWrapper.vmMirror.setMonitorContendedEnterForClassOnly(monitorRefTypeID);
+        // Set MONITOR_CONTENDED_ENTER request for MonitorContendedEnterAndEnteredDebuggee
+        logWriter.println("==> Debuggee class pattern to match = " + getDebuggeeClassName()
+ "*");
+        debuggeeWrapper.vmMirror.setMonitorContendedEnterForClassMatch(getDebuggeeClassName()+"*");
 
         // Verify received event
         verifyEvent();

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnteredTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnteredTest.java?rev=813730&r1=813729&r2=813730&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnteredTest.java
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/test/java/org/apache/harmony/jpda/tests/jdwp/Events/MonitorContendedEnteredTest.java
Fri Sep 11 09:08:26 2009
@@ -33,15 +33,12 @@
         return "org.apache.harmony.jpda.tests.jdwp.Events.MonitorContendedEnterAndEnteredDebuggee";
     }
 
-    public void testMonitorContendedEntteredForClassOnly() {
+    public void testMonitorContendedEnteredForClassMatch() {
         synchronizer.receiveMessage(JPDADebuggeeSynchronizer.SGNL_READY);
 
-        // Attain Object class id
-        long monitorRefTypeID = getClassIDBySignature(monitorSignature);
-        logWriter.println("==> Object ReferenceType ID = " + monitorRefTypeID);
-        
-        // Set MONITOR_CONTENDED_ENTERED request for MockMonitorClass
-        debuggeeWrapper.vmMirror.setMonitorContendedEnteredForClassOnly(monitorRefTypeID);
+        // Set MONITOR_CONTENDED_ENTERED request for MonitorContendedEnterAndEnteredDebuggee
+        logWriter.println("==> Debuggee class pattern to match = " + getDebuggeeClassName()
+ "*");
+        debuggeeWrapper.vmMirror.setMonitorContendedEnteredForClassMatch(getDebuggeeClassName()+"*");
 
         // Verify received event
         verifyEvent();



Mime
View raw message