harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r794726 [9/15] - in /harmony/enhanced/jdktools/branches/java6/modules/jpda: ./ src/main/native/include/ src/main/native/jdwp/common/agent/commands/ src/main/native/jdwp/common/agent/core/ src/main/native/jdwp/common/generic/ src/main/native...
Date Thu, 16 Jul 2009 15:57:41 GMT
Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.cpp?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.cpp (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.cpp Thu Jul 16 15:57:37 2009
@@ -16,16 +16,7 @@
  *  limitations under the License.
  */
 
-/**
- * @author Anatoly F. Bondarenko
- * @version $Revision: 1.17 $
- */
-
-// ObjectManager.cpp - implementation of 'class ObjectManager :public AgentBase'
 // Provide mapping between JDWP IDs and corresponding JVMTI, JNI data types
-
-#include <string.h>
-
 #include "jni.h"
 #include "jvmti.h"
 #include "jdwp.h"
@@ -33,11 +24,13 @@
 #include "AgentBase.h"
 #include "AgentEnv.h"
 #include "MemoryManager.h"
-#include "AgentException.h"
+#include "ExceptionManager.h"
 #include "Log.h"
 
 #include "ObjectManager.h"
 
+#include <string.h>
+
 using namespace jdwp;
 
 // =============================================================================
@@ -64,19 +57,56 @@
 const ObjectID FREE_OBJECTID_SIGN = -1;
 const ObjectID OBJECTID_MINIMUM = 1;
 
-ObjectID ObjectManager::MapToObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject) throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapToObjectID(" << JNIEnvPtr << ',' << jvmObject << ')');
+jboolean ObjectManager::FindObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject, ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "FindObjectID(%p,%p,%lld)", JNIEnvPtr, jvmObject, objectID));
 
     if (jvmObject == NULL) {
-        JDWP_TRACE_MAP("## MapToObjectID: map NULL jobject");
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "## FindObjectID: find NULL jobject"));
+        return false;
+    }
+
+    // get object HASH CODE
+    jint hashCode = -1;
+    if (GetObjectHashCode(jvmObject, &hashCode) != JVMTI_ERROR_NONE) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "## FindObjectID: GetObjectHashCode failed"));
+        return false;
+    }
+
+    // get HASH INDEX
+    size_t idx = size_t(hashCode) & HASH_TABLE_MSK;
+
+     // LOCK objectID table
+    MonitorAutoLock objectIDTableLock(m_objectIDTableMonitor JDWP_FILE_LINE);
+
+    // find EXISTING objectID
+    ObjectIDItem* objectIDItem = m_objectIDTable[idx];
+    ObjectIDItem* objectIDItemEnd = objectIDItem + m_maxAllocatedObjectID[idx];
+    while (objectIDItem != objectIDItemEnd) {
+        if (objectIDItem->objectID != FREE_OBJECTID_SIGN &&
+            JNIEnvPtr->IsSameObject(objectIDItem->mapObjectIDItem.jvmObject, jvmObject) == JNI_TRUE &&
+            objectID == objectIDItem->objectID) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "FindObjectID: find object, it is a valid object id"));
+            return true;
+        }
+        objectIDItem++;
+    }
+    return false;
+}
+
+
+ObjectID ObjectManager::MapToObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapToObjectID(%p,%p)", JNIEnvPtr, jvmObject));
+
+    if (jvmObject == NULL) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToObjectID: map NULL jobject"));
         return JDWP_OBJECT_ID_NULL;
     }
 
     // get object HASH CODE
     jint hashCode = -1;
     if (GetObjectHashCode(jvmObject, &hashCode) != JVMTI_ERROR_NONE) {
-        JDWP_TRACE_MAP("## MapToObjectID: GetObjectHashCode failed");
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToObjectID: GetObjectHashCode failed"));
+        return JDWP_OBJECT_ID_NULL;
     }
 
     // get HASH INDEX
@@ -112,8 +142,8 @@
              *   suppose just this case is here
             */
             JNIEnvPtr->ExceptionClear();
-            JDWP_TRACE_MAP("## MapToObjectID: NewWeakGlobalRef returned NULL");
-            throw OutOfMemoryException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToObjectID: NewWeakGlobalRef returned NULL"));
+            return JDWP_OBJECT_ID_NULL;
         }
         if (m_freeObjectIDItems[idx] == NULL) {
             // expand table
@@ -148,8 +178,8 @@
     return objectID;
 } // MapToObjectID()
 
-jobject ObjectManager::MapFromObjectID(JNIEnv* JNIEnvPtr, ObjectID objectID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapFromObjectID(" << JNIEnvPtr << ',' << objectID << ')');
+jobject ObjectManager::MapFromObjectID(JNIEnv* JNIEnvPtr, ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapFromObjectID(%p,%lld)", JNIEnvPtr, objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -158,8 +188,8 @@
     // check decoded object ID
     if (objectID <= 0 || objectID > m_maxAllocatedObjectID[idx]) {
         // It is DEBUGGER ERROR: request for ObjectID which was never allocated
-        JDWP_TRACE_MAP("## MapFromObjectID: invalid object ID: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromObjectID: invalid object ID: %lld", objectID));
+        return NULL;
     }
 
     // take object from table
@@ -170,8 +200,8 @@
     ObjectIDItem* objectIDItem = m_objectIDTable[idx] + objectID - 1;
     if (objectIDItem->objectID == FREE_OBJECTID_SIGN) {
         // It is DEBUGGER ERROR: Corresponding jobject is DISPOSED
-        JDWP_TRACE_MAP("## MapFromObjectID: corresponding jobject has been disposed: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromObjectID: corresponding jobject has been disposed: %lld", objectID));
+        return NULL;
     }
     jvmObject = objectIDItem->mapObjectIDItem.jvmObject;
     } // synchronized block: objectIDTableLock
@@ -179,15 +209,15 @@
     // Check if corresponding jobject has been Garbage collected*/
     if (JNIEnvPtr->IsSameObject(jvmObject, NULL) == JNI_TRUE) {
         // Corresponding jobject is Garbage collected
-        JDWP_TRACE_MAP("## MapFromObjectID: corresponding jobject has been Garbage collected: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromObjectID: corresponding jobject has been Garbage collected: %lld", objectID));
+        return NULL;
     }
 
     return jvmObject;
 } // MapFromObjectID()
 
-jboolean ObjectManager::IsValidObjectID(ObjectID objectID) throw () {
-    JDWP_TRACE_ENTRY("IsValidObjectID(" << objectID << ')');
+jboolean ObjectManager::IsValidObjectID(JNIEnv* JNIEnvPtr,ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "IsValidObjectID(%lld)", objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -199,20 +229,29 @@
         return JNI_FALSE;
     }
 
+    jobject jvmObject;
     { // synchronized block: objectIDTableLock
         MonitorAutoLock objectIDTableLock(m_objectIDTableMonitor JDWP_FILE_LINE);
         ObjectIDItem* objectIDItem = m_objectIDTable[idx] + objectID - 1;
         if (objectIDItem->objectID == FREE_OBJECTID_SIGN) {
-        // this ObjectID is DISPOSED
+            // this ObjectID is DISPOSED
+            return JNI_FALSE;
+        }
+        jvmObject = objectIDItem->mapObjectIDItem.jvmObject;
+    } // synchronized block: objectIDTableLock
+    
+    // Check if corresponding jobject has been Garbage collected*/
+    if (JNIEnvPtr->IsSameObject(jvmObject, NULL) == JNI_TRUE) {
+        // Corresponding jobject is Garbage collected
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "## IsValidObjectID: corresponding jobject has been Garbage collected: %lld", objectID));
         return JNI_FALSE;
     }
-    } // synchronized block: objectIDTableLock
-
+        
     return JNI_TRUE;
 } // IsValidObjectID() 
 
-void ObjectManager::DisableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("DisableCollection(" << JNIEnvPtr << ',' << objectID << ')');
+int ObjectManager::DisableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "DisableCollection(%p,%lld)", JNIEnvPtr, objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -221,8 +260,10 @@
     // check decoded object ID
     if (objectID <= 0 || objectID > m_maxAllocatedObjectID[idx]) {
         // It is DEBUGGER ERROR: request for ObjectID which was never allocated
-        JDWP_TRACE_MAP("## DisableCollection: invalid object ID: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisableCollection: invalid object ID: %lld", objectID));
+        AgentException ex(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_SET_EXCEPTION(ex);
+        return JDWP_ERROR_INVALID_OBJECT;
     }
 
     { // synchronized block: objectIDTableLock
@@ -230,36 +271,43 @@
         ObjectIDItem* objectIDItem = m_objectIDTable[idx] + objectID - 1;
         if (objectIDItem->objectID == FREE_OBJECTID_SIGN) {
             // It is DEBUGGER ERROR: Corresponding jobject is DISPOSED
-            JDWP_TRACE_MAP("## DisableCollection: corresponding jobject has been disposed: " << objectID);
-            throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisableCollection: corresponding jobject has been disposed: %lld", objectID));
+            AgentException ex(JDWP_ERROR_INVALID_OBJECT);
+            JDWP_SET_EXCEPTION(ex);
+            return JDWP_ERROR_INVALID_OBJECT;
         }
     
         jobject jvmObject = objectIDItem->mapObjectIDItem.jvmObject;
         if (JNIEnvPtr->IsSameObject(jvmObject, NULL) == JNI_TRUE) {
             // Corresponding jobject is Garbage collected
-            JDWP_TRACE_MAP("## DisableCollection: corresponding jobject has been Garbage collected: " << objectID);
-            throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisableCollection: corresponding jobject has been Garbage collected: %lld", objectID));
+            AgentException ex(JDWP_ERROR_INVALID_OBJECT);
+            JDWP_SET_EXCEPTION(ex);
+            return JDWP_ERROR_INVALID_OBJECT;
         }
         if (objectIDItem->mapObjectIDItem.globalRefKind == NORMAL_GLOBAL_REF) {
             // Repeated request for DisableCollection
-            JDWP_TRACE_MAP("<= DisableCollection: corresponding jobject has a global reference");
-            return;
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= DisableCollection: corresponding jobject has a global reference"));
+            return JDWP_ERROR_NONE;
         }
     
         jobject newGlobRef = JNIEnvPtr->NewGlobalRef(jvmObject);
         if (newGlobRef == NULL) {
-            JDWP_TRACE_MAP("## DisableCollection: NewGlobalRef returned NULL");
-            throw OutOfMemoryException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisableCollection: NewGlobalRef returned NULL"));
+            AgentException ex(JDWP_ERROR_OUT_OF_MEMORY);
+            JDWP_SET_EXCEPTION(ex);
+            return JDWP_ERROR_OUT_OF_MEMORY;
         }
-        JNIEnvPtr->DeleteWeakGlobalRef(jvmObject);
+        JNIEnvPtr->DeleteWeakGlobalRef((jweak)jvmObject);
         objectIDItem->mapObjectIDItem.globalRefKind = NORMAL_GLOBAL_REF;
         objectIDItem->mapObjectIDItem.jvmObject = newGlobRef;
     } // synchronized block: objectIDTableLock
 
+    return JDWP_ERROR_NONE;
 } // DisableCollection() 
 
-void ObjectManager::EnableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("EnableCollection(" << JNIEnvPtr << ',' << objectID << ')');
+int ObjectManager::EnableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "EnableCollection(%p,%lld)", JNIEnvPtr, objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -268,13 +316,13 @@
     // check decoded object ID
     if (objectID <= 0 || objectID > m_maxAllocatedObjectID[idx]) {
         /* It is DEBUGGER ERROR: request for ObjectID which was never allocated
-         * JDWP_TRACE_MAP("## EnableCollection: throw AgentException(JDWP_ERROR_INVALID_OBJECT)#1");
+         * JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## EnableCollection: throw AgentException(JDWP_ERROR_INVALID_OBJECT)#1"));
          * throw AgentException(JDWP_ERROR_INVALID_OBJECT);
          * EnableCollection Command (ObjectReference Command Set) does not 
          * assume INVALID_OBJECT reply - so simply return:
         */
-        JDWP_TRACE_MAP("## EnableCollection: invalid object ID: " << objectID);
-        return;
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## EnableCollection: invalid object ID: %lld", objectID));
+        return JDWP_ERROR_NONE;
     }
 
     { // synchronized block: objectIDTableLock
@@ -286,15 +334,15 @@
              * EnableCollection Command (ObjectReference Command Set) does not 
              * assume INVALID_OBJECT reply - so simply return:
             */
-            JDWP_TRACE_MAP("## EnableCollection: corresponding jobject has been disposed: " << objectID);
-            return;
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## EnableCollection: corresponding jobject has been disposed: %lld", objectID));
+            return JDWP_ERROR_NONE;;
         }
         
         if (objectIDItem->mapObjectIDItem.globalRefKind == WEAK_GLOBAL_REF) {
             // Incorrect request for EnableCollection: 
             // ObjectID is in EnableCollection state
-            JDWP_TRACE_MAP("<= EnableCollection: corresponding jobject has a weak reference");
-            return;
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= EnableCollection: corresponding jobject has a weak reference"));
+            return JDWP_ERROR_NONE;;
         }
         
         jobject jvmObject = objectIDItem->mapObjectIDItem.jvmObject;
@@ -306,25 +354,28 @@
             */
             if (JNIEnvPtr->ExceptionCheck() == JNI_TRUE) {
                 JNIEnvPtr->ExceptionClear();
-                JDWP_TRACE_MAP("## EnableCollection: NewWeakGlobalRef returned NULL due to OutOfMemoryException");
-                throw OutOfMemoryException();
+                JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## EnableCollection: NewWeakGlobalRef returned NULL due to OutOfMemoryException"));
+                AgentException ex(JDWP_ERROR_OUT_OF_MEMORY);
+                JDWP_SET_EXCEPTION(ex);
+                return JDWP_ERROR_OUT_OF_MEMORY;
             }
             /* else requested jobject is garbage collected
              * As EnableCollection Command (ObjectReference Command Set) does not 
              * assume INVALID_OBJECT reply - so simply return:
             */
-            JDWP_TRACE_MAP("## EnableCollection: NewWeakGlobalRef returned NULL");
-            return;
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## EnableCollection: NewWeakGlobalRef returned NULL"));
+            return JDWP_ERROR_NONE;
         }
         JNIEnvPtr->DeleteGlobalRef(jvmObject);
         objectIDItem->mapObjectIDItem.globalRefKind = WEAK_GLOBAL_REF;
         objectIDItem->mapObjectIDItem.jvmObject = newWeakGlobRef;
     } // synchronized block: objectIDTableLock
 
+    return JDWP_ERROR_NONE;
 } // EnableCollection()
 
-jboolean ObjectManager::IsCollectionDisabled(ObjectID objectID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("IsCollectionDisabled(" << objectID << ')');
+/*jboolean ObjectManager::IsCollectionDisabled(ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "IsCollectionDisabled(%lld)", objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -335,8 +386,9 @@
     // check decoded object ID
     if (objectID <= 0 || objectID > m_maxAllocatedObjectID[idx]) {
         // It is DEBUGGER ERROR: request for ObjectID which was never allocated
-        JDWP_TRACE_MAP("## IsCollectionDisabled: invalid object ID: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IsCollectionDisabled: invalid object ID: %lld", objectID));
+	AgentException ex(JDWP_ERROR_INVALID_OBJECT);
+	THROW(ex);
     }
 
     jboolean result;
@@ -345,8 +397,9 @@
     ObjectIDItem* objectIDItem = m_objectIDTable[idx] + objectID - 1;
     if ( objectIDItem->objectID == FREE_OBJECTID_SIGN ) {
         // It is DEBUGGER ERROR: Corresponding jobject is DISPOSED
-        JDWP_TRACE_MAP("## IsCollectionDisabled: corresponding jobject has been disposed: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IsCollectionDisabled: corresponding jobject has been disposed: %lld", objectID));
+	AgentException ex(JDWP_ERROR_INVALID_OBJECT);
+	THROW(ex);
     }
     result = JNI_FALSE;
     if (objectIDItem->mapObjectIDItem.globalRefKind != WEAK_GLOBAL_REF) {
@@ -355,10 +408,10 @@
     } // synchronized block: objectIDTableLock
 
     return result;
-} // IsCollectionDisabled() 
+} // IsCollectionDisabled() */
 
-jboolean ObjectManager::IsCollected(JNIEnv* JNIEnvPtr, ObjectID objectID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("IsCollected(" << JNIEnvPtr << ',' << objectID << ')');
+jboolean ObjectManager::IsCollected(JNIEnv* JNIEnvPtr, ObjectID objectID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "IsCollected(%p,%lld)", JNIEnvPtr, objectID));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -367,8 +420,8 @@
     // check decoded object ID
     if (objectID <= 0 || objectID > m_maxAllocatedObjectID[idx]) {
         // It is DEBUGGER ERROR: request for ObjectID which was never allocated
-        JDWP_TRACE_MAP("## IsCollected: invalid object ID: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## IsCollected: invalid object ID: %lld", objectID));
+        return JNI_FALSE;
     }
 
     jobject jvmObject;
@@ -378,8 +431,8 @@
     ObjectIDItem* objectIDItem = m_objectIDTable[idx] + objectID - 1;
     if ( objectIDItem->objectID == FREE_OBJECTID_SIGN) {
         // It is DEBUGGER ERROR: Corresponding jobject is DISPOSED
-        JDWP_TRACE_MAP("## IsCollected: corresponding jobject has been disposed: " << objectID);
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IsCollected: corresponding jobject has been disposed: %lld", objectID));
+        return JNI_FALSE;
     }
 
     jvmObject = objectIDItem->mapObjectIDItem.jvmObject;
@@ -387,15 +440,15 @@
 
     if (JNIEnvPtr->IsSameObject(jvmObject, NULL) == JNI_TRUE) {
         // Corresponding jobject has been Garbage collected
-        JDWP_TRACE_MAP("<= IsCollected: JNI_TRUE");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= IsCollected: JNI_TRUE"));
         return JNI_TRUE;
     }
 
     return JNI_FALSE;
 } // IsCollected() 
 
-void ObjectManager::DisposeObject(JNIEnv* JNIEnvPtr, ObjectID objectID, jint refCount) throw () {
-    JDWP_TRACE_ENTRY("DisposeObject(" << JNIEnvPtr << ',' << objectID << ',' << refCount << ')');
+void ObjectManager::DisposeObject(JNIEnv* JNIEnvPtr, ObjectID objectID, jint refCount) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "DisposeObject(%p,%lld,%d)", JNIEnvPtr, objectID, refCount));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -407,7 +460,7 @@
          * JDWP spec does NOT provide to return reply for this command
          * so do nothing
         */
-        JDWP_TRACE_MAP("## DisposeObject: invalid object ID: " << objectID);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisposeObject: invalid object ID: %lld", objectID));
         return;
     }
 
@@ -417,7 +470,7 @@
         if (objectIDItem->objectID == FREE_OBJECTID_SIGN) {
             // It may be DEBUGGER ERROR: Corresponding jobject has been disposed already
             // - do nothing
-            JDWP_TRACE_MAP("## DisposeObject: corresponding jobject has been disposed: " << objectID);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DisposeObject: corresponding jobject has been disposed: %lld", objectID));
             return;
         }
         
@@ -425,7 +478,7 @@
         if (newRefCount > 0) {
             // Still early to dispose ObjectID 
             objectIDItem->mapObjectIDItem.referencesCount = newRefCount;
-            JDWP_TRACE_MAP("<= DisposeObject: still positive ref count: " << newRefCount);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= DisposeObject: still positive ref count: %d", newRefCount));
             return;
         }
         
@@ -433,7 +486,7 @@
         if (objectIDItem->mapObjectIDItem.globalRefKind == NORMAL_GLOBAL_REF) {
             JNIEnvPtr->DeleteGlobalRef(jvmObject);
         } else {
-            JNIEnvPtr->DeleteWeakGlobalRef(jvmObject);
+            JNIEnvPtr->DeleteWeakGlobalRef((jweak)jvmObject);
         }
         objectIDItem->objectID = FREE_OBJECTID_SIGN;
         objectIDItem->nextFreeObjectIDItem = m_freeObjectIDItems[idx];
@@ -442,8 +495,8 @@
 
 } // DisposeObject() 
 
-jint ObjectManager::IncreaseIDRefCount(ObjectID objectID, jint incrementValue) throw () {
-    JDWP_TRACE_ENTRY("IncreaseIDRefCount(" << objectID << ',' << incrementValue << ')');
+jint ObjectManager::IncreaseIDRefCount(ObjectID objectID, jint incrementValue) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "IncreaseIDRefCount(%lld,%d)", objectID, incrementValue));
 
     // decode object ID
     size_t idx = (size_t)objectID & HASH_TABLE_MSK;
@@ -453,7 +506,7 @@
     JDWP_ASSERT(objectID <= m_maxAllocatedObjectID[idx]);
     if (objectID == JDWP_OBJECT_ID_NULL) {
         // returned objectID is not real - it is possibly, so do nothing:
-        JDWP_TRACE_MAP("## IncreaseIDRefCount: invalid object ID: " << objectID);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IncreaseIDRefCount: invalid object ID: %lld", objectID));
         return 0;
     }
 
@@ -463,7 +516,7 @@
          * JDWP spec does NOT provide to return reply for this command
          * so do nothing
         */
-        JDWP_TRACE_MAP("## IncreaseIDRefCount: invalid object ID: " << objectID);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IncreaseIDRefCount: invalid object ID: %lld", objectID));
         return 0;
     }
 
@@ -474,7 +527,7 @@
     if (objectIDItem->objectID == FREE_OBJECTID_SIGN) {
         // Corresponding jobject is DISPOSED - unlikely but possibly theoretically
         // so do nothing
-        JDWP_TRACE_MAP("## IncreaseIDRefCount: corresponding jobject has been disposed: " << objectID);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## IncreaseIDRefCount: corresponding jobject has been disposed: %lld", objectID));
         return 0;
     }
     newRefCount = objectIDItem->mapObjectIDItem.referencesCount + incrementValue;
@@ -484,8 +537,8 @@
     return newRefCount;
 } // IncreaseIDRefCount() 
 
-void ObjectManager::InitObjectIDMap() throw () {
-    JDWP_TRACE_ENTRY("InitObjectIDMap()");
+void ObjectManager::InitObjectIDMap() {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "InitObjectIDMap()"));
 
     memset(m_objectIDTableSize, 0, sizeof(m_objectIDTableSize));
     memset(m_maxAllocatedObjectID, 0, sizeof(m_maxAllocatedObjectID));
@@ -493,8 +546,8 @@
     memset(m_freeObjectIDItems, 0, sizeof(m_freeObjectIDItems));
 } // InitObjectIDMap()
 
-void ObjectManager::ResetObjectIDMap(JNIEnv* JNIEnvPtr) throw (AgentException) {
-    JDWP_TRACE_ENTRY("ResetObjectIDMap(" << JNIEnvPtr << ')');
+void ObjectManager::ResetObjectIDMap(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "ResetObjectIDMap(%p)", JNIEnvPtr));
 
     for (size_t idx = 0; idx < HASH_TABLE_SIZE; idx++) {
         if (m_objectIDTable[idx]) {
@@ -505,7 +558,7 @@
                     if (objectIDItem->mapObjectIDItem.globalRefKind == NORMAL_GLOBAL_REF) {
                         JNIEnvPtr->DeleteGlobalRef(objectIDItem->mapObjectIDItem.jvmObject);
                     } else {
-                        JNIEnvPtr->DeleteWeakGlobalRef(objectIDItem->mapObjectIDItem.jvmObject);
+                        JNIEnvPtr->DeleteWeakGlobalRef((jweak)objectIDItem->mapObjectIDItem.jvmObject);
                     }
                 }
                 objectIDItem++;
@@ -521,23 +574,19 @@
 // Mapping: ReferenceTypeID <-> jclass (=> jobject)
 // Includes JDWP types: referenceTypeID, classID, interfaceID, arrayID
 
-// Constant defining initial value for ReferenceTypeID to be different from
-// ObjectID values
-const ReferenceTypeID REFTYPEID_MINIMUM = 1000000000;
-
-ReferenceTypeID ObjectManager::MapToReferenceTypeID(JNIEnv* JNIEnvPtr, jclass jvmClass) throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapToReferenceTypeID(" << JNIEnvPtr << ',' << jvmClass << ')');
+ReferenceTypeID ObjectManager::MapToReferenceTypeID(JNIEnv* JNIEnvPtr, jclass jvmClass) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapToReferenceTypeID(%p,%p)", JNIEnvPtr, jvmClass));
 
     if (jvmClass == NULL) {
-        JDWP_TRACE_MAP("## MapToReferenceTypeID: map NULL jclass");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToReferenceTypeID: map NULL jclass"));
         return JDWP_OBJECT_ID_NULL;
     }
 
     // get object HASH CODE
     jint hashCode = -1;
     if (GetObjectHashCode(jvmClass, &hashCode) != JVMTI_ERROR_NONE) {
-        JDWP_TRACE_MAP("## MapToReferenceTypeID: GetObjectHashCode failed");
-        throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToReferenceTypeID: GetObjectHashCode failed"));
+        return JDWP_OBJECT_ID_NULL;
     }
 
     // get HASH INDEX
@@ -570,8 +619,8 @@
              *   suppose just this case is here
             */
             JNIEnvPtr->ExceptionClear();
-            JDWP_TRACE_MAP("## MapToReferenceTypeID: NewWeakGlobalRef returned NULL due to OutOfMemoryException");
-            throw OutOfMemoryException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToReferenceTypeID: NewWeakGlobalRef returned NULL due to OutOfMemoryException"));
+            return JDWP_OBJECT_ID_NULL;
         }
         // expand table if needed
         if (m_refTypeIDTableUsed[idx] == m_refTypeIDTableSize[idx])
@@ -593,8 +642,8 @@
 } // MapToReferenceTypeID() 
 
 jclass ObjectManager::MapFromReferenceTypeID(JNIEnv* JNIEnvPtr,
-                                             ReferenceTypeID refTypeID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapFromReferenceTypeID(" << JNIEnvPtr << ',' << refTypeID << ')');
+                                             ReferenceTypeID refTypeID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapFromReferenceTypeID(%p,%lld)", JNIEnvPtr, refTypeID));
 
     refTypeID-= REFTYPEID_MINIMUM;
     jclass jvmClass;
@@ -611,10 +660,12 @@
 
     // check buffer index
     if (item >= m_refTypeIDTableUsed[idx]) {
-        if ( IsValidObjectID(refTypeID + REFTYPEID_MINIMUM) ) {
-            throw AgentException(JDWP_ERROR_INVALID_CLASS);
+        if ( IsValidObjectID(JNIEnvPtr, refTypeID + REFTYPEID_MINIMUM) ) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## MapFromReferenceTypeID: class is invalid"));
+            return NULL;
         } else {
-            throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## MapFromReferenceTypeID: object is invalid"));
+            return NULL;
         }
     }
 
@@ -622,30 +673,65 @@
 
     // check if corresponding jclass has been Garbage collected
     if (JNIEnvPtr->IsSameObject(jvmClass, NULL) == JNI_TRUE) {
-        JDWP_TRACE_MAP("## MapFromReferenceTypeID: corresponding jclass has been Garbage collected");
-        throw AgentException(JDWP_ERROR_INVALID_CLASS);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromReferenceTypeID: corresponding jclass has been Garbage collected"));
+        return NULL;
     }
 
     } // UNLOCK ReferenceTypeID table
 
     return jvmClass;
-} // MapFromReferenceTypeID() 
+} // MapFromReferenceTypeID()
+
+jboolean ObjectManager::IsValidReferenceTypeID(JNIEnv* JNIEnvPtr,ObjectID refTypeID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "IsValidReferenceTypeID(%p,%lld)", JNIEnvPtr, refTypeID));
+
+    refTypeID-= REFTYPEID_MINIMUM;
+    jclass jvmClass;
+
+    { // LOCK ReferenceTypeID table
+        
+    MonitorAutoLock refTypeIDTableLock(m_refTypeIDTableMonitor JDWP_FILE_LINE);
+
+    // calculate hash index
+    // masking guarantees the index will be in the range [0..HASH_TABLE_SIZE-1]
+    size_t idx = (size_t)refTypeID & HASH_TABLE_MSK;
 
-void ObjectManager::InitRefTypeIDMap() throw () {
-    JDWP_TRACE_ENTRY("InitRefTypeIDMap()");
+    // calculate buffer index
+    size_t item = (size_t)refTypeID >> HASH_TABLE_IDX;
+
+    // check buffer index
+    if (item < 0 || item >= m_refTypeIDTableUsed[idx]) {
+        return JNI_FALSE;
+    }
+
+    jvmClass = m_refTypeIDTable[idx][item];
+
+    // check if corresponding jclass has been Garbage collected
+    if (JNIEnvPtr->IsSameObject(jvmClass, NULL) == JNI_TRUE) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromReferenceTypeID: corresponding jclass has been Garbage collected"));
+        return JNI_FALSE;
+    }
+
+    } // UNLOCK ReferenceTypeID table
+
+    return JNI_TRUE;
+} // IsValidReferenceTypeID()   
+
+void ObjectManager::InitRefTypeIDMap() {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "InitRefTypeIDMap()"));
 
     memset(m_refTypeIDTable, 0, sizeof(m_refTypeIDTable));
     memset(m_refTypeIDTableSize, 0, sizeof(m_refTypeIDTableSize));
     memset(m_refTypeIDTableUsed, 0, sizeof(m_refTypeIDTableUsed));
 } // InitRefTypeIDMap()
 
-void ObjectManager::ResetRefTypeIDMap(JNIEnv* JNIEnvPtr) throw (AgentException) {
-    JDWP_TRACE_ENTRY("ResetRefTypeIDMap(" << JNIEnvPtr << ')');
+void ObjectManager::ResetRefTypeIDMap(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "ResetRefTypeIDMap(%p)", JNIEnvPtr));
 
     for (size_t idx = 0; idx < HASH_TABLE_SIZE; idx++) {
         if (m_refTypeIDTable[idx]) {
             for (size_t item = 0; item < m_refTypeIDTableUsed[idx]; item++)
-                JNIEnvPtr->DeleteWeakGlobalRef(m_refTypeIDTable[idx][item]);
+                JNIEnvPtr->DeleteWeakGlobalRef((jweak)m_refTypeIDTable[idx][item]);
             GetMemoryManager().Free(m_refTypeIDTable[idx] JDWP_FILE_LINE);
             m_refTypeIDTable[idx] = NULL;
             m_refTypeIDTableUsed[idx] = m_refTypeIDTableSize[idx] = 0;
@@ -661,17 +747,17 @@
  * FieldID (jlong) <-> jfieldID (_jfieldID*)
 */
    
-FieldID ObjectManager::MapToFieldID(JNIEnv* JNIEnvPtr, jfieldID jvmFieldID) throw () {
-    JDWP_TRACE_ENTRY("MapToFieldID(" << JNIEnvPtr << ',' << jvmFieldID << ')');
+FieldID ObjectManager::MapToFieldID(JNIEnv* JNIEnvPtr, jfieldID jvmFieldID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapToFieldID(%p,%p)", JNIEnvPtr, jvmFieldID));
 
     FieldID fieldID = reinterpret_cast<FieldID>(jvmFieldID);
     return fieldID;
 } // MapToFieldID() 
  
-jfieldID ObjectManager::MapFromFieldID(JNIEnv* JNIEnvPtr, FieldID fieldID) throw () {
-    JDWP_TRACE_ENTRY("MapFromFieldID(" << JNIEnvPtr << ',' << fieldID << ')');
+jfieldID ObjectManager::MapFromFieldID(JNIEnv* JNIEnvPtr, FieldID fieldID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapFromFieldID(%p,%p)", JNIEnvPtr, fieldID));
 
-    jfieldID jvmFieldID = reinterpret_cast<jfieldID>(static_cast<intptr_t>(fieldID));
+    jfieldID jvmFieldID = (jfieldID)(fieldID);
     return jvmFieldID;
 } // MapFromFieldID() 
 
@@ -682,17 +768,17 @@
  * MethodID (jlong) <-> jmethodID (_jmethodID*)
 */
    
-MethodID ObjectManager::MapToMethodID(JNIEnv* JNIEnvPtr, jmethodID jvmMethodID) throw () {
-    JDWP_TRACE_ENTRY("MapToMethodID(" << JNIEnvPtr << ',' << jvmMethodID << ')');
+MethodID ObjectManager::MapToMethodID(JNIEnv* JNIEnvPtr, jmethodID jvmMethodID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapToMethodID(%p,%p)", JNIEnvPtr, jvmMethodID));
 
     MethodID methodID = reinterpret_cast<MethodID>(jvmMethodID);
     return methodID;
 } // MapToMethodID() 
  
-jmethodID ObjectManager::MapFromMethodID(JNIEnv* JNIEnvPtr, MethodID methodID) throw () {
-    JDWP_TRACE_ENTRY("MapFromMethodID(" << JNIEnvPtr << ',' << methodID << ')');
+jmethodID ObjectManager::MapFromMethodID(JNIEnv* JNIEnvPtr, MethodID methodID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapFromMethodID(%p,%lld)", JNIEnvPtr, methodID));
 
-    jmethodID jvmMethodID = reinterpret_cast<jmethodID>(static_cast<intptr_t>(methodID));
+    jmethodID jvmMethodID = (jmethodID)(methodID);
     return jvmMethodID;
 } // MapFromMethodID() 
 
@@ -711,7 +797,7 @@
 const jlong FRAMEID_TABLE_INIT_SIZE = 128; // in ThreadFramesItem
 
 ObjectManager::ThreadFramesItem* ObjectManager::ExpandThreadFramesTable()
-        throw (AgentException) {
+        {
     if ( m_frameIDTableSize == 0 ) {
         m_frameIDTable =
             reinterpret_cast<ThreadFramesItem*>
@@ -742,7 +828,7 @@
 
 ObjectManager::ThreadFramesItem* ObjectManager::NewThreadFramesItem
         (JNIEnv* JNIEnvPtr, jthread jvmThread, jint framesCount)
-        throw (AgentException) {
+{
     ThreadFramesItem* threadFramesItem = m_frameIDTable;
     if ( m_freeItemsNumberInFrameIDTable == 0 ) {
         threadFramesItem = ExpandThreadFramesTable();
@@ -770,8 +856,8 @@
          *   suppose just this case is here
         */
         JNIEnvPtr->ExceptionClear();
-        JDWP_TRACE_MAP("## NewThreadFramesItem: OutOfMemoryException");
-        throw OutOfMemoryException();
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## NewThreadFramesItem: OutOfMemoryException"));
+        return NULL;
     }
 
     threadFramesItem->jvmThread = newWeakGlobRef;
@@ -784,9 +870,8 @@
 
 FrameID ObjectManager::MapToFrameID(JNIEnv* JNIEnvPtr, jthread jvmThread,
                                     jint frameDepth, jint framesCount)
-                                    throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapToFrameID(" << JNIEnvPtr << ',' << jvmThread 
-        << ',' << frameDepth << ',' << framesCount << ')');
+                                    {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapToFrameID(%p,%p,%d,%d)", JNIEnvPtr, jvmThread, frameDepth, framesCount));
 
     /* according to the JDWP agent policy it is supposed that passed jvmThread
      * is JNI global reference so do not check if the jvmThread is garbage
@@ -816,8 +901,8 @@
         if ( (frameDepth < 0) 
                 || (frameDepth >= framesCount) ) {
             // passed frameDepth is INVALID ");
-            JDWP_TRACE_MAP("## MapToFrameID: JDWP_ERROR_INVALID_LENGTH#1");
-            throw AgentException(JDWP_ERROR_INVALID_LENGTH);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToFrameID: JDWP_ERROR_INVALID_LENGTH#1"));
+            return 0;
         }
         threadFramesItem = NewThreadFramesItem(JNIEnvPtr, jvmThread, framesCount);
         // can be OutOfMemoryException, InternalErrorException
@@ -825,8 +910,8 @@
         if ( (frameDepth < 0) 
                 || (frameDepth >= threadFramesItem->framesCountOfThread) ) {
             // passed frameDepth is INVALID ");
-            JDWP_TRACE_MAP("## MapToFrameID: JDWP_ERROR_INVALID_LENGTH#2");
-            throw AgentException(JDWP_ERROR_INVALID_LENGTH);
+            JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapToFrameID: JDWP_ERROR_INVALID_LENGTH#2"));
+            return 0;
         }
     }
     frameID = threadFramesItem->currentFrameID + frameDepth;
@@ -835,8 +920,8 @@
 
 } // MapToFrameID() 
 
-jint ObjectManager::MapFromFrameID(JNIEnv* JNIEnvPtr, FrameID frameID) throw (AgentException) {
-    JDWP_TRACE_ENTRY("MapFromFrameID(" << JNIEnvPtr << ',' << frameID << ')');
+jint ObjectManager::MapFromFrameID(JNIEnv* JNIEnvPtr, FrameID frameID) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "MapFromFrameID(%p,%lld)", JNIEnvPtr, frameID));
 
     // searching for threadFramesItem for given FrameID
     jint frameIndex;
@@ -859,20 +944,20 @@
     }
     if ( tableIndex == m_frameIDTableSize ) {
         // threadFramesItem for given FrameID is not found out in table*/
-        JDWP_TRACE_MAP("## MapFromFrameID: JDWP_ERROR_INVALID_FRAMEID");
-        throw AgentException(JDWP_ERROR_INVALID_FRAMEID);
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## MapFromFrameID: JDWP_ERROR_INVALID_FRAMEID"));
+        return 0;
     }
     frameIndex = static_cast<jint>(frameID - threadFramesItem->currentFrameID);
     } // synchronized block: frameIDTableLock
     return frameIndex;
 } // MapFromFrameID() 
 
-void ObjectManager::DeleteFrameIDs(JNIEnv* JNIEnvPtr, jthread jvmThread) throw () {
-    JDWP_TRACE_ENTRY("DeleteFrameIDs(" << JNIEnvPtr << ',' << jvmThread << ')');
+void ObjectManager::DeleteFrameIDs(JNIEnv* JNIEnvPtr, jthread jvmThread) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "DeleteFrameIDs(%p,%p)", JNIEnvPtr, jvmThread));
 
     if ( JNIEnvPtr->IsSameObject(jvmThread, NULL) == JNI_TRUE ) {
         // jvmThread object is GARBAGE COLLECTED: possible case - do nothing
-        JDWP_TRACE_MAP("## DeleteFrameIDs: ignore NULL jthread");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "## DeleteFrameIDs: ignore NULL jthread"));
         return;
     }
 
@@ -905,8 +990,8 @@
     } // synchronized block: frameIDTableLock
 } // DeleteFrameIDs() 
 
-void ObjectManager::InitFrameIDMap() throw () {
-    JDWP_TRACE_ENTRY("InitFrameIDMap()");
+void ObjectManager::InitFrameIDMap() {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "InitFrameIDMap()"));
 
     m_frameIDTableSize = 0; 
     m_freeItemsNumberInFrameIDTable = 0; 
@@ -914,8 +999,8 @@
     m_maxAllocatedFrameID = 0;
 } // InitFrameIDMap()
 
-void ObjectManager::ResetFrameIDMap(JNIEnv* JNIEnvPtr) throw (AgentException) {
-    JDWP_TRACE_ENTRY("ResetFrameIDMap(" << JNIEnvPtr << ')');
+void ObjectManager::ResetFrameIDMap(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "ResetFrameIDMap(%p)", JNIEnvPtr));
 
     if ( m_frameIDTable != 0 ) {
         // delete all weak global references from frameIDTable
@@ -927,7 +1012,7 @@
                 threadFramesItem++;
                 continue;
             }
-            JNIEnvPtr->DeleteWeakGlobalRef(threadFramesItem->jvmThread);
+            JNIEnvPtr->DeleteWeakGlobalRef((jweak)threadFramesItem->jvmThread);
             threadFramesItem++;
         }
         AgentBase::GetMemoryManager().Free(m_frameIDTable JDWP_FILE_LINE);
@@ -938,8 +1023,8 @@
 
 // =============================================================================
 
-void ObjectManager::Init(JNIEnv* JNIEnvPtr) throw (AgentException) {
-    JDWP_TRACE_ENTRY("Init(" << JNIEnvPtr << ')');
+void ObjectManager::Init(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Init(%p)", JNIEnvPtr));
 
     InitObjectIDMap();
     InitRefTypeIDMap();
@@ -950,36 +1035,36 @@
     // can be AgentException(jvmtiError err);
 } // Init()
 
-void ObjectManager::Reset(JNIEnv* JNIEnvPtr) throw (AgentException) {
-    JDWP_TRACE_ENTRY("Reset(" << JNIEnvPtr << ')');
+void ObjectManager::Reset(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Reset(%p)", JNIEnvPtr));
 
     if (m_objectIDTableMonitor != 0){
-        JDWP_TRACE_MAP("=> m_objectIDTableMonitor ");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "=> m_objectIDTableMonitor "));
         m_objectIDTableMonitor->Enter(); 
-        JDWP_TRACE_MAP("<= m_objectIDTableMonitor");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= m_objectIDTableMonitor"));
         m_objectIDTableMonitor->Exit(); 
         ResetObjectIDMap(JNIEnvPtr); //    can    be InternalErrorException
     }
 
     if (m_refTypeIDTableMonitor != 0) {
-        JDWP_TRACE_MAP("=> m_refTypeIDTableMonitor");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "=> m_refTypeIDTableMonitor"));
         m_refTypeIDTableMonitor->Enter(); 
-        JDWP_TRACE_MAP("<= m_refTypeIDTableMonitor");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= m_refTypeIDTableMonitor"));
         m_refTypeIDTableMonitor->Exit(); 
         ResetRefTypeIDMap(JNIEnvPtr); // can be InternalErrorException
     }
 
     if (m_frameIDTableMonitor != 0) {
-        JDWP_TRACE_MAP("=> m_frameIDTableMonitor");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "=> m_frameIDTableMonitor"));
         m_frameIDTableMonitor->Enter(); 
-        JDWP_TRACE_MAP("<= m_frameIDTableMonitor");
+        JDWP_TRACE(LOG_RELEASE, (LOG_MAP_FL, "<= m_frameIDTableMonitor"));
         m_frameIDTableMonitor->Exit(); 
         ResetFrameIDMap(JNIEnvPtr); // can be InternalErrorException
     }
 } // Reset()
 
-void ObjectManager::Clean(JNIEnv* JNIEnvPtr) throw () {
-    JDWP_TRACE_ENTRY("Clean(" << JNIEnvPtr << ')');
+void ObjectManager::Clean(JNIEnv* JNIEnvPtr) {
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Clean(%p)", JNIEnvPtr));
 
     if (m_objectIDTableMonitor != 0)
         delete m_objectIDTableMonitor;
@@ -989,7 +1074,7 @@
         delete m_frameIDTableMonitor;
 } // Clean()
 
-ObjectManager::ObjectManager () throw ()
+ObjectManager::ObjectManager ()
 {
     m_objectIDTableMonitor = 0;
     m_refTypeIDTableMonitor = 0;
@@ -1001,7 +1086,7 @@
 #endif // NDEBUG
 }
 
-ObjectManager::~ObjectManager () throw () {
+ObjectManager::~ObjectManager () {
 }
 
 // =============================================================================

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.h?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.h (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ObjectManager.h Thu Jul 16 15:57:37 2009
@@ -15,12 +15,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Anatoly F. Bondarenko
- * @version $Revision: 1.9.2.1 $
- */
-
 /**
  * @file
  * ObjectManager.h
@@ -38,8 +32,15 @@
 #include "jdwpTypes.h"
 #include "AgentMonitor.h"
 
+#if defined(ZOS)
+#include <inttypes.h>
+#endif
+
 namespace jdwp {
 
+    // Constant defining initial value for ReferenceTypeID to be different from  ObjectID values
+    const ReferenceTypeID REFTYPEID_MINIMUM = 1000000000;
+
     // hash table parameters
     enum {
         // hash table buffer incrementation value
@@ -81,6 +82,20 @@
         // Public primitives of Mapping 
     // =========================================================================
     public:
+        /** 
+         * Find the JVM object of the type <code>jobject</code> in map 
+         * according to JDWP identifier of the type <code>ObjectID</code> 
+         *
+         * @param JNIEnvPtr - the JNI interface pointer used to call
+         *                    necessary JNI functions
+         * @param objectID  - the JDWP identifier of the <code>ObjectID</code>
+         *                    type to be mapped.
+         *
+         * @return Returns true when get a same object identifer as the second 
+         *                    parameter according to specified <code>jobject</code>,
+         *                    otherwise return false.
+         */
+        jboolean FindObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject, ObjectID objectID);
 
         // Mapping: <code>ObjectID</code> <-> <code>jobject</code>
         // Includes the following JDWP types: <code>objectID</code>, <code>threadID</code>, 
@@ -123,8 +138,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        ObjectID MapToObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject)
-            throw (AgentException);
+        ObjectID MapToObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject);
 
         /** 
          * Maps the JDWP identifier of the type <code>ObjectID</code> to the 
@@ -143,8 +157,7 @@
          *            or was disposed; or corresponding <code>jvmObject</code>
          *            has been unloaded and garbage-collected.
          */
-        jobject MapFromObjectID(JNIEnv* JNIEnvPtr, ObjectID objectID)
-            throw (AgentException);
+        jobject MapFromObjectID(JNIEnv* JNIEnvPtr, ObjectID objectID);
 
         /** 
          * Changes a condition of corresponding <code>jvmObject</code> so, 
@@ -165,8 +178,7 @@
          *            if out-of-memory error has occurred during execution 
          *            of the given function.
          */
-        void DisableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID)
-            throw (AgentException);
+        int DisableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID);
 
         /** 
          * Changes a condition of corresponding <code>jvmObject</code> so, that
@@ -183,8 +195,7 @@
          *            out-of-memory error has occurred during execution of the 
          *            given function.
          */
-        void EnableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID)
-            throw (AgentException);
+        int EnableCollection(JNIEnv* JNIEnvPtr, ObjectID objectID);
 
         /** 
          * Checks if garbage collection is disabled for corresponding 
@@ -201,7 +212,7 @@
          *            if the given <code>ObjectID</code> was never allocated
          *            or was disposed.
          */
-        jboolean IsCollectionDisabled(ObjectID objectID) throw (AgentException);
+        //jboolean IsCollectionDisabled(ObjectID objectID);
   
         /** 
          * Checks if corresponding <code>jvmObject</code> has been 
@@ -220,8 +231,7 @@
          *            if the given <code>ObjectID</code> was never allocated 
          *            or was disposed.
          */
-        jboolean IsCollected(JNIEnv* JNIEnvPtr, ObjectID objectID)
-            throw (AgentException);
+        jboolean IsCollected(JNIEnv* JNIEnvPtr, ObjectID objectID);
 
         /** 
          * Disposes corresponding <code>jvmObject</code> defining by given 
@@ -248,8 +258,7 @@
          *                     enables to avoid a situation when the used  
          *                     <code>ObjectID</code> can be disposed.
          */
-        void DisposeObject(JNIEnv* JNIEnvPtr, ObjectID objectID, jint refCount)
-             throw ();
+        void DisposeObject(JNIEnv* JNIEnvPtr, ObjectID objectID, jint refCount);
 
         /** 
          * Increases the count of references to given <code>ObjectID</code> 
@@ -265,8 +274,7 @@
          * @return Returns the new value of the references count after
          *         increasing.
          */
-        jint IncreaseIDRefCount(ObjectID objectID, jint incrementValue = 1)
-            throw ();
+        jint IncreaseIDRefCount(ObjectID objectID, jint incrementValue = 1);
 
     // =========================================================================
         // Mapping: <code>ReferenceTypeID</code> <-> <code>jclass</code> (=> <code>jobject</code>)
@@ -308,8 +316,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        ReferenceTypeID MapToReferenceTypeID(JNIEnv* JNIEnvPtr, jclass jvmClass)
-            throw (AgentException);
+        ReferenceTypeID MapToReferenceTypeID(JNIEnv* JNIEnvPtr, jclass jvmClass);
 
         /** 
          * Maps the JDWP identifier of the type <code>ReferenceTypeID</code> to 
@@ -330,8 +337,23 @@
          *            type or a corresponding JVM <code>jclass</code> has been unloaded and 
          *            garbage-collected.
          */
-        jclass MapFromReferenceTypeID(JNIEnv* JNIEnvPtr, ReferenceTypeID refTypeID)
-            throw (AgentException);
+        jclass MapFromReferenceTypeID(JNIEnv* JNIEnvPtr, ReferenceTypeID refTypeID);
+        
+        /** 
+         * Checks if the passed <code>objID</code> of JDWP identifier is a valid
+         * <code>ReferenceTypeID</code>, that is currently it represents in the JDI 
+         * level the JVM reference type.
+         * 
+         * @param JNIEnvPtr - the JNI interface pointer used to call
+         *                    necessary JNI functions
+         * @param objID  - the JDWP identifier of the type 
+         *                    <code>ObjectID</code> to be checked
+         *
+         * @return Returns the <code>JNI_TRUE</code> value if the passed 
+         *         <code>objID</code> is a valid <code>ReferenceTypeID</code>, 
+         *         <code>JNI_FALSE</code> otherwise.
+         */
+        jboolean IsValidReferenceTypeID(JNIEnv* JNIEnvPtr,ObjectID objID);
 
     // =========================================================================
         // Mapping: <code>FieldID</code> <-> <code>jfieldID</code>
@@ -350,7 +372,7 @@
          * @return Returns the JDWP identifier of the type <code>FieldID</code>
          *         to which <code>jvmFieldID</code> is mapped.
          */
-        FieldID MapToFieldID(JNIEnv* JNIEnvPtr, jfieldID jvmFieldID) throw ();
+        FieldID MapToFieldID(JNIEnv* JNIEnvPtr, jfieldID jvmFieldID);
 
         /** 
          * Maps the JDWP identifier of the type <code>FieldID</code> to the 
@@ -364,7 +386,7 @@
          * @return Returns the JVM identifier of the type <code>jfieldID</code>
          *         to which <code>fieldID</code> is mapped.
          */
-        jfieldID MapFromFieldID(JNIEnv* JNIEnvPtr, FieldID fieldID) throw ();
+        jfieldID MapFromFieldID(JNIEnv* JNIEnvPtr, FieldID fieldID);
 
     // =========================================================================
         // Mapping: <code>MethodID</code> <-> <code>jmethodID</code>
@@ -383,8 +405,7 @@
          * @return Returns the JDWP identifier of the type <code>MethodID</code> to which
          *         <code>jvmMethodID</code> is mapped.
          */
-        MethodID MapToMethodID(JNIEnv* JNIEnvPtr, jmethodID jvmMethodID)
-            throw ();
+        MethodID MapToMethodID(JNIEnv* JNIEnvPtr, jmethodID jvmMethodID);
 
         /** 
          * Maps the JDWP identifier of the type <code>MethodID</code> to the 
@@ -398,8 +419,7 @@
          * @return Returns the JVM identifier of the type <code>jmethodID</code> to 
          *         which methodID is mapped to.
          */
-        jmethodID MapFromMethodID(JNIEnv* JNIEnvPtr, MethodID methodID)
-            throw ();
+        jmethodID MapFromMethodID(JNIEnv* JNIEnvPtr, MethodID methodID);
 
     // =========================================================================
         // Mapping: <code>FrameID</code> <-> <code>jthread</code> + <code>depth (jint)</code>
@@ -439,8 +459,7 @@
          *            current stack frames.
          */
         FrameID MapToFrameID(JNIEnv* JNIEnvPtr, jthread jvmThread,
-                             jint frameDepth, jint framesCount)
-            throw (AgentException);
+                             jint frameDepth, jint framesCount);
 
         /** 
          * Maps the JDWP identifier of the type <code>FrameID</code> to the 
@@ -459,8 +478,7 @@
          *            identifier, that is it does not identify any stack frame 
          *            at the current moment.
          */
-        jint MapFromFrameID(JNIEnv* JNIEnvPtr, FrameID frameID)
-            throw (AgentException);
+        jint MapFromFrameID(JNIEnv* JNIEnvPtr, FrameID frameID);
 
         /** 
          * Deletes all JDWP frames' identifiers registered at present for the 
@@ -475,8 +493,7 @@
          *                     defining the JVM thread, which <code>FrameIDs</code> 
          *                     have to be deleted for
          */
-        void DeleteFrameIDs(JNIEnv* JNIEnvPtr, jthread jvmThread)
-            throw ();
+        void DeleteFrameIDs(JNIEnv* JNIEnvPtr, jthread jvmThread);
 
     // =========================================================================
         /** 
@@ -493,7 +510,7 @@
          * @exception AgentException(jvmtiError) that 
          *            may be thrown by the <code>AgentMonitor</code> constructor.
          */
-        void Init(JNIEnv* JNIEnvPtr) throw (AgentException);
+        void Init(JNIEnv* JNIEnvPtr);
 
         /** 
          * Releases resources of the ObjectManager class instance 
@@ -509,7 +526,7 @@
          *            is the same as <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        void Reset(JNIEnv* JNIEnvPtr) throw (AgentException);
+        void Reset(JNIEnv* JNIEnvPtr);
  
         /** 
          * Releases resources of the ObjectManager class instance  
@@ -519,17 +536,17 @@
          * @param JNIEnvPtr  - the JNI interface pointer used to call
          *                     necessary JNI functions
          */
-        void Clean(JNIEnv* JNIEnvPtr) throw ();
+        void Clean(JNIEnv* JNIEnvPtr);
 
         /** 
          * Constructor for the ObjectManager class instance.
          */
-        ObjectManager() throw ();
+        ObjectManager();
 
         /** 
          * Destructor for the ObjectManager class instance.
          */
-        ~ObjectManager () throw ();
+        ~ObjectManager ();
 
 
     // =========================================================================
@@ -635,7 +652,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        void ExpandObjectIDTable() throw (AgentException);
+        void ExpandObjectIDTable();
 
         /** 
          * Maps the JVM object of the type <code>jobject</code> to the JDWP 
@@ -658,14 +675,15 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        ObjectID MapToNewObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject)
-            throw (AgentException);
+        ObjectID MapToNewObjectID(JNIEnv* JNIEnvPtr, jobject jvmObject);
 
         /** 
          * Checks if the passed <code>ObjectID</code> JDWP identifier is valid
          * <code>ObjectID</code>, that is currently it represents in the JDI 
          * level the JVM object of the <code>jobject</code> type.
          * 
+         * @param JNIEnvPtr - the JNI interface pointer used to call
+         *                    necessary JNI functions
          * @param objectID  - the JDWP identifier of the type 
          *                    <code>ObjectID</code> to be checked
          *
@@ -673,14 +691,14 @@
          *         <code>objectID</code> is valid, <code>JNI_FALSE</code> 
          *         otherwise.
          */
-        jboolean IsValidObjectID(ObjectID objectID) throw ();
+        jboolean IsValidObjectID(JNIEnv* JNIEnvPtr, ObjectID objectID);
 
         /** 
          * Initializes the fields of the ObjectManager class used 
          * for <code>ObjectID</code> values mapping. It is called by the 
          * Init() function.
          */
-        void InitObjectIDMap() throw ();
+        void InitObjectIDMap();
 
         /** 
          * Disposes all allocated <code>ObjectID</code> values and releases memory 
@@ -696,7 +714,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        void ResetObjectIDMap(JNIEnv* JNIEnvPtr) throw (AgentException);
+        void ResetObjectIDMap(JNIEnv* JNIEnvPtr);
 
     // =========================================================================
         // Mapping: <code>ReferenceTypeID</code> <-> <code>jclass</code>
@@ -728,7 +746,7 @@
          * for <code>ReferenceTypeIDs</code> mapping. It is called by the 
          * Init() function.
          */
-        void InitRefTypeIDMap() throw ();
+        void InitRefTypeIDMap();
 
         /** 
          * Deletes all weak Global References for allocated 
@@ -744,7 +762,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        void ResetRefTypeIDMap(JNIEnv* JNIEnvPtr) throw (AgentException);
+        void ResetRefTypeIDMap(JNIEnv* JNIEnvPtr);
 
     // =========================================================================
         // Mapping: <code>FrameID</code> <-> <code>jthread</code> + <code>depth (jint)</code>
@@ -826,7 +844,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        ThreadFramesItem* ExpandThreadFramesTable() throw (AgentException);
+        ThreadFramesItem* ExpandThreadFramesTable();
 
         /** 
          * Allocates the new ThreadFramesItem to map the stack 
@@ -854,14 +872,13 @@
          *            unexpected internal JDWP agent error has occurred.
          */
         ThreadFramesItem* NewThreadFramesItem(JNIEnv* JNIEnvPtr, 
-            jthread jvmThread, jint framesCount)
-            throw (AgentException);
+            jthread jvmThread, jint framesCount);
 
         /** 
          * Initializes the fields of the ObjectManager class used for 
          * <code>FrameIDs</code> mapping. It is called by the Init() function.
          */
-        void InitFrameIDMap() throw ();
+        void InitFrameIDMap();
 
         /** 
          * Releases memory from under the table of <code>FrameIDs</code>. 
@@ -876,7 +893,7 @@
          *            <code>AgentException(JDWP_ERROR_INTERNAL)</code> - if an 
          *            unexpected internal JDWP agent error has occurred.
          */
-        void ResetFrameIDMap(JNIEnv* JNIEnvPtr) throw (AgentException);
+        void ResetFrameIDMap(JNIEnv* JNIEnvPtr);
     // =========================================================================
 
     // =========================================================================

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.cpp?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.cpp (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.cpp Thu Jul 16 15:57:37 2009
@@ -15,31 +15,24 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Pavel N. Vyssotski
- * @version $Revision: 1.7 $
- */
-// OptionParser.cpp
-
-#include <cstring>
-
 #include "AgentBase.h"
 #include "MemoryManager.h"
-#include "AgentException.h"
+#include "ExceptionManager.h"
 #include "Log.h"
 
 #include "OptionParser.h"
 
+#include <string.h>
+
 using namespace jdwp;
-using namespace std;
 
-OptionParser::OptionParser() throw()
+OptionParser::OptionParser()
 {
     m_optionCount = 0;
     m_optionString = 0;
     m_options = 0;
     m_help = false;
+    m_version = false;
     m_suspend = true;
     m_server = false;
     m_timeout = 0;
@@ -53,28 +46,38 @@
     m_launch = 0;
 }
 
-bool OptionParser::AsciiToBool(const char *str) throw(IllegalArgumentException)
+bool OptionParser::IsValidBool(const char *str)
 {
-    if (strcmp("y", str) == 0) {
+    if (strcmp("y", str) == 0
+         || strcmp("n", str) == 0) {
         return true;
-    } else if (strcmp("n", str) == 0) {
+    } else {
+        AgentException ex(JDWP_ERROR_ILLEGAL_ARGUMENT);
+        JDWP_SET_EXCEPTION(ex);
         return false;
+    }
+}
+
+bool OptionParser::AsciiToBool(const char *str)
+{
+    if (*str == 'y') {
+        return true;
     } else {
-        throw IllegalArgumentException();
+        return false;
     }
 }
 
-void OptionParser::Parse(const char* str) throw(AgentException)
+int OptionParser::Parse(const char* str)
 {
     size_t i;
     int k;
 
     if (str == 0)
-        return;
+        return JDWP_ERROR_NONE;
 
     const size_t len = strlen(str);
     if (len == 0)
-        return;
+        return JDWP_ERROR_NONE;
 
     for (i = 0; i < len; i++) {
         if (str[i] == ',') {
@@ -82,14 +85,18 @@
         } else if (str[i] == '"' || str[i] == '\'') {
             char quote = str[i];
             if (i > 0 && str[i-1] != '=') {
-                throw IllegalArgumentException();
+                AgentException ex(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                JDWP_SET_EXCEPTION(ex);
+                return JDWP_ERROR_ILLEGAL_ARGUMENT;
             }
             i++;
             while (i < len && str[i] != quote) {
                 i++;
             }
             if (i+1 < len && str[i+1] != ',') {
-                throw IllegalArgumentException();
+                AgentException ex(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                JDWP_SET_EXCEPTION(ex);
+                return JDWP_ERROR_ILLEGAL_ARGUMENT;
             }
         }
     }
@@ -139,36 +146,43 @@
         } else if (strcmp("timeout", m_options[k].name) == 0) {
             m_timeout = atol(m_options[k].value);
         } else if (strcmp("suspend", m_options[k].name) == 0) {
+            if (!IsValidBool(m_options[k].value)) return JDWP_ERROR_ILLEGAL_ARGUMENT;
             m_suspend = AsciiToBool(m_options[k].value);
         } else if (strcmp("server", m_options[k].name) == 0) {
+            if (!IsValidBool(m_options[k].value)) return JDWP_ERROR_ILLEGAL_ARGUMENT;
             m_server = AsciiToBool(m_options[k].value);
         } else if (strcmp("launch", m_options[k].name) == 0) {
             m_launch = m_options[k].value;
         } else if (strcmp("onuncaught", m_options[k].name) == 0) {
+            if (!IsValidBool(m_options[k].value)) return JDWP_ERROR_ILLEGAL_ARGUMENT;
             m_onuncaught = AsciiToBool(m_options[k].value);
         } else if (strcmp("onthrow", m_options[k].name) == 0) {
             m_onthrow = m_options[k].value;
         } else if (strcmp("help", m_options[k].name) == 0) {
             m_help = true;
-#ifndef NDEBUG
+        } else if (strcmp("version", m_options[k].name) == 0) {
+            m_version = true;
         } else if (strcmp("log", m_options[k].name) == 0) {
             m_log = m_options[k].value;
         } else if (strcmp("trace", m_options[k].name) == 0) {
             m_kindFilter = m_options[k].value;
         } else if (strcmp("src", m_options[k].name) == 0) {
             m_srcFilter = m_options[k].value;
-#endif // NDEBUG
         }
     }
     if ((m_onthrow != 0) || (m_onuncaught != 0)) {
         if (m_launch == 0) {
-            JDWP_ERROR("Specify launch=<command line> when using onthrow or onuncaught option");
-            throw IllegalArgumentException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Specify launch=<command line> when using onthrow or onuncaught option"));
+            AgentException ex(JDWP_ERROR_ILLEGAL_ARGUMENT);
+            JDWP_SET_EXCEPTION(ex);
+            return JDWP_ERROR_ILLEGAL_ARGUMENT;
         }
     }
+
+    return JDWP_ERROR_NONE;
 }
 
-OptionParser::~OptionParser() throw()
+OptionParser::~OptionParser()
 {
     if (m_optionString != 0)
         AgentBase::GetMemoryManager().Free(m_optionString JDWP_FILE_LINE);
@@ -176,7 +190,7 @@
         AgentBase::GetMemoryManager().Free(m_options JDWP_FILE_LINE);
 }
 
-const char *OptionParser::FindOptionValue(const char *name) const throw()
+const char *OptionParser::FindOptionValue(const char *name) const
 {
     for (int i = 0; i < m_optionCount; i++) {
         if (strcmp(name, m_options[i].name) == 0) {

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.h?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.h (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/OptionParser.h Thu Jul 16 15:57:37 2009
@@ -15,12 +15,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Pavel N. Vyssotski
- * @version $Revision: 1.8.2.1 $
- */
-
 /**
  * @file
  * OptionParser.h
@@ -33,6 +27,7 @@
 #define _OPTION_PARSER_H_
 
 #include "AgentBase.h"
+#include "ExceptionManager.h"
 
 namespace jdwp {
 
@@ -47,24 +42,24 @@
         /**
          * A constructor.
          */
-        OptionParser() throw();
+        OptionParser();
 
         /**
          * A destructor.
          */
-        ~OptionParser() throw();
+        ~OptionParser();
 
         /**
          * Parses the input string containing the arguments passed to the agent.
          *
          * @param str - the string containing agent arguments
          */
-        void Parse(const char* str) throw(AgentException);
+        int Parse(const char* str);
 
         /**
          * Returns a number of parsed options.
          */
-        int GetOptionCount() const throw() {
+        int GetOptionCount() const {
             return m_optionCount;
         }
 
@@ -75,38 +70,52 @@
          * @param name  - the option name
          * @param value - the option value
          */
-        void GetOptionByIndex(int i, const char *&name, const char *&value)
-                const throw(InvalidIndexException) {
+#ifndef NDEBUG
+        int GetOptionByIndex(int i, const char *&name, const char *&value)
+                const {
             if (i < m_optionCount) {
                 name = m_options[i].name;
                 value = m_options[i].value;
+                return JDWP_ERROR_NONE;
             } else {
-                throw InvalidIndexException();
+                AgentException ex(JDWP_ERROR_INVALID_INDEX);
+                JDWP_SET_EXCEPTION(ex);
+                return JDWP_ERROR_INVALID_INDEX;
             }
         }
+#endif /* NDEBUG */
 
         /**
          * Looks for an option with the given name.
          *
          * @param name - the option name
          */
-        const char *FindOptionValue(const char *name) const throw();
+        const char *FindOptionValue(const char *name) const;
 
         /**
          * Returns a value for the agent's <code>help</code> option.
          *
          * @return Boolean.
          */
-        bool GetHelp() const throw() {
+        bool GetHelp() const {
             return m_help;
         }
 
         /**
+         * Returns a value for the agent's <code>version</code> option.
+         *
+         * @return Boolean.
+         */
+        bool GetVersion() const {
+            return m_version;
+        }
+
+        /**
          * Returns a value for the agent's <code>suspend</code> option.
          *
          * @return Boolean.
          */
-        bool GetSuspend() const throw() {
+        bool GetSuspend() const {
             return m_suspend;
         }
 
@@ -115,7 +124,7 @@
          *
          * @return Boolean.
          */
-        bool GetServer() const throw() {
+        bool GetServer() const {
             return m_server;
         }
 
@@ -124,7 +133,7 @@
          *
          * @return Boolean.
          */
-        bool GetOnuncaught() const throw() {
+        bool GetOnuncaught() const {
             return m_onuncaught;
         }
 
@@ -133,7 +142,7 @@
          *
          * @return Java long value.
          */
-        jlong GetTimeout() const throw() {
+        jlong GetTimeout() const {
             return m_timeout;
         }
 
@@ -142,7 +151,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetTransport() const throw() {
+        const char *GetTransport() const {
             return m_transport;
         }
 
@@ -151,7 +160,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetAddress() const throw() {
+        const char *GetAddress() const {
             return m_address;
         }
 
@@ -160,7 +169,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetLog() const throw() {
+        const char *GetLog() const {
             return m_log;
         }
 
@@ -169,7 +178,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetTraceKindFilter() const throw() {
+        const char *GetTraceKindFilter() const {
             return m_kindFilter;
         }
 
@@ -178,7 +187,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetTraceSrcFilter() const throw() {
+        const char *GetTraceSrcFilter() const {
             return m_srcFilter;
         }
 
@@ -187,7 +196,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetOnthrow() const throw() {
+        const char *GetOnthrow() const {
             return m_onthrow;
         }
 
@@ -196,7 +205,7 @@
          *
          * @return Zero-terminated string.
          */
-        const char *GetLaunch() const throw() {
+        const char *GetLaunch() const {
             return m_launch;
         }
 
@@ -211,19 +220,27 @@
         };
 
         /**
-         * The helper converting string to boolean.
+         * Checks if the input string is "y" or "n"
          *
          * @param str - the input null-terminated string
          *
          * @exception IllegalArgumentException.
          */
-        bool AsciiToBool(const char *str) throw(IllegalArgumentException);
+        bool IsValidBool(const char *str);
+
+        /**
+         * The helper converting string to boolean.
+         *
+         * @param str - the input null-terminated string
+         */
+        bool AsciiToBool(const char *str);
 
         int m_optionCount;
         char *m_optionString;
         Option *m_options;
 
         bool m_help;
+        bool m_version;
         bool m_suspend;
         bool m_server;
         bool m_onuncaught;

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketDispatcher.cpp Thu Jul 16 15:57:37 2009
@@ -15,11 +15,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Vitaly A. Provodin
- * @version $Revision: 1.22 $
- */
 #include "PacketDispatcher.h"
 #include "TransportManager.h"
 #include "AgentException.h"
@@ -29,12 +24,13 @@
 #include "ClassManager.h"
 #include "RequestManager.h"
 #include "OptionParser.h"
+#include "ExceptionManager.h"
 
 using namespace jdwp;
 
 //-----------------------------------------------------------------------------
 
-PacketDispatcher::PacketDispatcher() throw()
+PacketDispatcher::PacketDispatcher()
     :AgentBase()
 {
     m_isProcessed = false;
@@ -46,34 +42,28 @@
 //-----------------------------------------------------------------------------
 
 void
-PacketDispatcher::Init(JNIEnv *jni) throw(AgentException)
+PacketDispatcher::Init(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("Init(" << jni << ")");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Init(%p)", jni));
 
     m_completionMonitor = new AgentMonitor("_agent_Packet_Dispatcher_completion");
     m_executionMonitor = new AgentMonitor("_agent_Packet_Dispatcher_execution");
 }
 
-void
-PacketDispatcher::Start(JNIEnv *jni) throw(AgentException)
+int
+PacketDispatcher::Start(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("Start(" << jni << ")");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Start(%p)", jni));
 
     JDWP_ASSERT(!m_isProcessed);
 
-    try
-    {
-        m_threadObject = jni->NewGlobalRef(GetThreadManager().RunAgentThread(jni, StartFunction, this,
-            JVMTI_THREAD_MAX_PRIORITY, "_jdwp_PacketDispatcher"));
-    }
-    catch (const AgentException& e)
-    {
-        JDWP_ASSERT(e.ErrCode() != JDWP_ERROR_NULL_POINTER);
-        JDWP_ASSERT(e.ErrCode() != JDWP_ERROR_INVALID_PRIORITY);
-
-        throw e;
+    jthread thread = GetThreadManager().RunAgentThread(jni, StartFunction, this,
+                                         JVMTI_THREAD_MAX_PRIORITY, "_jdwp_PacketDispatcher");
+    if (thread == 0) {
+        return JDWP_ERROR_INTERNAL;
     }
-
+    m_threadObject = jni->NewGlobalRef(thread);
+    return JDWP_ERROR_NONE;
 }
 
 //-----------------------------------------------------------------------------
@@ -81,161 +71,142 @@
 void
 PacketDispatcher::Run(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("Run(" << jni << ")");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Run(%p)", jni));
 
-    try {
-        MonitorAutoLock lock(m_completionMonitor JDWP_FILE_LINE);
-        TransportManager &transport = GetTransportManager();
-        
-        try
-        {
-            // run multiplle sessions in a loop
-            for (; ;)
-            {
-                // connect for new session
-                JDWP_TRACE_PROG("Run: start new session");
-                try
-                {
-                    transport.Connect();
-                }
-                catch (const TransportException& e)
-                {
-                    JDWP_TRACE_PROG("Run: Exception in connection: "
-                                    << e.what() << " [" << e.ErrCode() 
-                                    << "/" << e.TransportErrorCode() << "]");
-                    if (!IsDead()) {
-                        JDWP_DIE(e.what() << " [" << e.ErrCode() << "/"
-                                    << e.TransportErrorCode() << "]: " 
-                                    << GetTransportManager().GetLastTransportError());
-                    }
-                    break;
-                }
-        
-                // start session and execute commands
-                try
-                {
-                    // inform that new session started
-                    GetEventDispatcher().NewSession();
-        
-                    // add internal request for automatic VMDeath event with no modifiers
-                    GetRequestManager().AddInternalRequest(jni,
-                        new AgentEventRequest(JDWP_EVENT_VM_DEATH, JDWP_SUSPEND_NONE));
-        
-                    // release events
-                    GetEventDispatcher().ReleaseEvents();
-        
-                    // read and execute commands
-                    m_isProcessed = true;
-                    while (m_isProcessed)
-                    {
-                        // read command
-                        try {
-                            JDWP_TRACE_PROG("Run: handle next command");
-                            m_cmdParser.ReadCommand();
-                            if (m_cmdParser.command.GetLength() == 0)
-                            break;
-                        }
-                        catch (const TransportException& e)
-                        {
-                            JDWP_TRACE_PROG("Run: Exception in reading command: " 
-                                << e.what() << " [" << e.ErrCode() 
-                                << "/" << e.TransportErrorCode() << "]");
-                            if (m_isProcessed && !IsDead())
-                            {
-                                char* msg = GetTransportManager().GetLastTransportError();
-                                AgentAutoFree af(msg JDWP_FILE_LINE);
-        
-                                if (e.TransportErrorCode() == JDWPTRANSPORT_ERROR_OUT_OF_MEMORY) {
-                                    JDWP_DIE(e.what() << " [" << e.ErrCode() << "/"
-                                                << e.TransportErrorCode() << "]: " << msg);
-                                } else {
-                                    JDWP_ERROR(e.what() << " [" << e.ErrCode() << "/"
-                                                << e.TransportErrorCode() << "]: " << msg);
-                                }
-                            }
-                            break;
-                        }
-        
-                        // execute command and prevent from reset while execution
-                        {
-                            MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE);
-                            m_cmdDispatcher.ExecCommand(jni, &m_cmdParser);
+    int ret;
+    MonitorAutoLock lock(m_completionMonitor JDWP_FILE_LINE);
+    TransportManager &transport = GetTransportManager();
+    
+    // run multiplle sessions in a loop
+    for (; ;)
+    {
+        // connect for new session
+        JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: start new session"));
+        ret = transport.Connect();
+        if (ret != JDWP_ERROR_NONE) {
+            AgentException aex = GetExceptionManager().GetLastException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: Exception in connection: %s", aex.GetExceptionMessage(jni)));
+            if (!IsDead()) {
+                JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Run: Exception in connection: %s", aex.GetExceptionMessage(jni)));
+                /* In server case, attempt to reaccept while the VM is alive */
+                if (AgentBase::GetOptionParser().GetServer()) {
+                    ret = ResetAll(jni);
+                    if (ret != JDWP_ERROR_NONE) {
+                        AgentException aex = GetExceptionManager().GetLastException();
+                        JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Error calling ResetAll(): %s", aex.GetExceptionMessage(jni)));
+                        if (!IsDead()) {                                            
+                            ::exit(1);
                         }
+                        break;
                     }
+                    continue;
                 }
-                catch (const AgentException& e)
-                {
-                    JDWP_TRACE_PROG("Run: Exception in executing command: "
-                                    << e.what() << " [" << e.ErrCode() << "]");
-                    if (!IsDead()) {
-                        JDWP_ERROR(e.what() << " [" << e.ErrCode() << "]");
+                ::exit(1);
+            }
+            break;
+        }
+
+        // inform that new session started
+        GetEventDispatcher().NewSession();
+
+        // add internal request for automatic VMDeath event with no modifiers
+        ret = GetRequestManager().AddInternalRequest(jni,
+            new AgentEventRequest(JDWP_EVENT_VM_DEATH, JDWP_SUSPEND_NONE));
+        if (ret != JDWP_ERROR_NONE) {
+            AgentException aex = GetExceptionManager().GetLastException();
+             if (!IsDead()) {
+                JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Run: Exception in executing command: %s", aex.GetExceptionMessage(jni)));
+            }
+            goto reset;
+        }
+
+        // start session and execute commands
+        // release events
+        GetEventDispatcher().ReleaseEvents();
+
+        // read and execute commands
+        m_isProcessed = true;
+        while (m_isProcessed)
+        {
+            // read command
+            JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: handle next command"));
+            int ret = m_cmdParser.ReadCommand();
+            if (ret != JDWP_ERROR_NONE) {
+                if (m_isProcessed && !IsDead()) {
+                    AgentException aex = GetExceptionManager().GetLastException();
+                    JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Run: Exception in reading command: %s", aex.GetExceptionMessage(jni)));
+                    if (aex.ErrCode() == JDWP_ERROR_OUT_OF_MEMORY
+                         || aex.TransportErrCode() == JDWPTRANSPORT_ERROR_OUT_OF_MEMORY) {  
+                        ::exit(1);
                     }
                 }
-        
-                // reset all modules after session finished
-                JDWP_TRACE_PROG("Run: reset session");
-                ResetAll(jni);
-        
-                // no more sessions if VMDeath event occured
-                if (IsDead()) {
-                    JDWP_TRACE_PROG("Run: VM is dead -> shutdown");
-                    break;
-                }
-        
-                // no more sessions in attach mode
-                if (!GetOptionParser().GetServer()) {
-                    JDWP_TRACE_PROG("Run: attach mode -> shutdown");
+                break;
+            }
+
+            if (m_cmdParser.command.GetLength() == 0)
+                break;
+
+            // execute command and prevent from reset while execution
+            {
+                MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE);
+                ret = m_cmdDispatcher.ExecCommand(jni, &m_cmdParser);
+                if (ret != JDWP_ERROR_NONE) {
+                    AgentException aex = GetExceptionManager().GetLastException();
+                    JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Run: Exception in executing command: %s", aex.GetExceptionMessage(jni)));
                     break;
                 }
             }
         }
-        catch (const AgentException& e)
-        {
-            JDWP_TRACE_PROG("Run: Exception in PacketDispatcher: "
-                            << e.what() << " [" << e.ErrCode() << "]");
-            if (!IsDead()) {
-                JDWP_DIE(e.what() << " [" << e.ErrCode() << "]"); 
+
+reset:
+        // reset all modules after session finished
+        JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: reset session"));
+        ResetAll(jni);
+        if (ret != JDWP_ERROR_NONE) {
+            AgentException aex = GetExceptionManager().GetLastException();
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Error calling ResetAll(): %s", aex.GetExceptionMessage(jni)));
+            if (!IsDead()) {                                            
+                ::exit(1);
             }
+            break;
         }
-        
-        // stop also EventDispatcher thread
-        try 
-        {
-            JDWP_TRACE_PROG("Run: stop EventDispatcher");
-            GetEventDispatcher().Stop(jni);
+
+        // no more sessions if VMDeath event occured
+        if (IsDead()) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: VM is dead -> shutdown"));
+            break;
         }
-        catch (const AgentException& e)
-        {
-            // just report an error, cannot do anything else
-            JDWP_ERROR("Exception in stopping EventDispatcher: "
-                            << e.what() << " [" << e.ErrCode() << "]");
+
+        // no more sessions in attach mode
+        if (!GetOptionParser().GetServer()) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: attach mode -> shutdown"));
+            break;
         }
+    }
+    
+    // stop also EventDispatcher thread
+    JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Run: stop EventDispatcher"));
+    GetEventDispatcher().Stop(jni);
 
         // release completion monitor and wait forever until VM kills this thread
         // TODO: remove this workaround to prevent from resource leak
 	// This is the old completion mechanism fixed in HARMONY-5019
 //        m_completionMonitor->Wait(0);
-    }
-    catch (const AgentException& e)
-    {
-        // just report an error, cannot do anything else
-        JDWP_ERROR("Exception in PacketDispatcher synchronization: "
-                        << e.what() << " [" << e.ErrCode() << "]");
-    }
+
 }
 
 //-----------------------------------------------------------------------------
 
 void 
-PacketDispatcher::Stop(JNIEnv *jni) throw(AgentException)
+PacketDispatcher::Stop(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("Stop()");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Stop()"));
 
     // cause thread loop to break
     m_isProcessed = false;
     
     // close transport first, but not while executing current command
-    JDWP_TRACE_PROG("Stop: close agent connection");
+    JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Stop: close agent connection"));
     if (m_executionMonitor != 0) {
         MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE);
         GetTransportManager().Clean();
@@ -253,11 +224,11 @@
 }
 
 void 
-PacketDispatcher::Clean(JNIEnv *jni) throw(AgentException)
+PacketDispatcher::Clean(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("Clean(" << jni << ')');
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Clean(%p)", jni));
 
-    JDWP_TRACE_PROG("Clean: clean internal data");
+    JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Clean: clean internal data"));
 
     // do not delete m_completionMonitor because thread is waiting on it
     // TODO: remove this workaround to prevent from resource leak
@@ -274,34 +245,43 @@
 }
 
 void 
-PacketDispatcher::Reset(JNIEnv *jni) throw(AgentException)
+PacketDispatcher::Reset(JNIEnv *jni)
 { 
-    JDWP_TRACE_ENTRY("Reset(" << jni << ')');
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "Reset(%p)", jni));
 
     // cause thread loop to break
-    JDWP_TRACE_PROG("Reset: reset session");
+    JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "Reset: reset session"));
     m_isProcessed = false; 
 }
 
-void 
-PacketDispatcher::ResetAll(JNIEnv *jni) throw(AgentException)
+int 
+PacketDispatcher::ResetAll(JNIEnv *jni)
 {
-    JDWP_TRACE_ENTRY("ResetAll(" << jni << ")");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "ResetAll(%p)", jni));
 
     // reset all modules, but not while executing current command 
     if (m_executionMonitor != 0) {
         MonitorAutoLock lock(m_executionMonitor JDWP_FILE_LINE);
 
-        JDWP_TRACE_PROG("ResetAll: reset all modules");
+        JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "ResetAll: reset all modules"));
+
+        int ret;
+        m_cmdParser.Reset(jni);
+        ret = GetThreadManager().Reset(jni);
+        JDWP_CHECK_RETURN(ret);
 
-        GetThreadManager().Reset(jni);
         GetRequestManager().Reset(jni);
         GetEventDispatcher().Reset(jni);
-        GetTransportManager().Reset();
+
+        ret = GetTransportManager().Reset();
+        JDWP_CHECK_RETURN(ret);
+
         GetPacketDispatcher().Reset(jni);
         GetClassManager().Reset(jni);
         GetObjectManager().Reset(jni);
     }
+
+    return JDWP_ERROR_NONE;
 }
 
 //-----------------------------------------------------------------------------
@@ -309,7 +289,7 @@
 void JNICALL
 PacketDispatcher::StartFunction(jvmtiEnv* jvmti_env, JNIEnv* jni, void* arg)
 {
-    JDWP_TRACE_ENTRY("StartFunction(" << jvmti_env << "," << jni << "," << arg << ")");
+    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "StartFunction(%p,%p,%p)", jvmti_env, jni, arg));
 
     (reinterpret_cast<PacketDispatcher *>(arg))->Run(jni);
 }



Mime
View raw message