harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r828736 - in /harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core: ClassManager.cpp MemoryManager.cpp RequestManager.cpp
Date Thu, 22 Oct 2009 15:00:09 GMT
Author: odeakin
Date: Thu Oct 22 15:00:09 2009
New Revision: 828736

URL: http://svn.apache.org/viewvc?rev=828736&view=rev
Log:
Apply patch for HARMONY-6361 ([JDWP][Java6] Fix a problem that will result in crash if OOM
happens)

Modified:
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ClassManager.cpp
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/MemoryManager.cpp
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/RequestManager.cpp

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ClassManager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ClassManager.cpp?rev=828736&r1=828735&r2=828736&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ClassManager.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/ClassManager.cpp
Thu Oct 22 15:00:09 2009
@@ -182,6 +182,10 @@
     char *returnValue = reinterpret_cast<char*>
         (AgentBase::GetMemoryManager().Allocate(len + 1 JDWP_FILE_LINE));
 
+    if (0 == returnValue) {
+        return 0;
+    }
+
     bool arrayFlag = (signature[0] == '[');
     size_t j = 0;
     for (size_t i = 0; i < len; i++) {

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/MemoryManager.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/MemoryManager.cpp?rev=828736&r1=828735&r2=828736&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/MemoryManager.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/MemoryManager.cpp
Thu Oct 22 15:00:09 2009
@@ -98,6 +98,9 @@
     JDWP_TRACE(LOG_RELEASE, (LOG_KIND_MEMORY, file, line, "VM malloc: %lld, %p", static_cast<long
long>(size), p));
     if (err != JVMTI_ERROR_NONE) {
         JDWP_TRACE(LOG_RELEASE, (LOG_KIND_ERROR, file, line, "VM malloc failed: %lld, %p",
static_cast<long long>(size), p));
+        AgentException ex(err);
+        JDWP_SET_EXCEPTION(ex);
+        return 0;
     }
     return p;
 }
@@ -114,6 +117,9 @@
     if (err != JVMTI_ERROR_NONE) {
         JDWP_TRACE(LOG_RELEASE, (LOG_KIND_ERROR, file, line, "VM realloc failed: %p %lld/%lld
%p", ptr, static_cast<long long>(oldSize),
                                  static_cast<long long>(newSize), p));
+        AgentException ex(err);
+        JDWP_SET_EXCEPTION(ex);
+        return 0;
     } else {
         memcpy(p, ptr, (newSize < oldSize) ? newSize : oldSize);
         JVMTI_TRACE(LOG_DEBUG, err, AgentBase::GetJvmtiEnv()->Deallocate(

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=828736&r1=828735&r2=828736&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
Thu Oct 22 15:00:09 2009
@@ -1604,6 +1604,12 @@
                 JvmtiAutoFree jafSignature(exceptionSignature);
 
                 char* exceptionName = GetClassManager().GetClassName(exceptionSignature);
+                if (0 == exceptionName) {
+                    AgentException aex = GetExceptionManager().GetLastException();
+                    err = (jvmtiError)aex.ErrCode();        
+                    JDWP_TRACE(LOG_RELEASE, (LOG_INFO_FL, "HandleException: jvmti method
Allocate() failed, error code is %d", err));
+                    return;
+                }
                 JvmtiAutoFree jafName(exceptionName);
 
                 JDWP_TRACE(LOG_RELEASE, (LOG_PROG_FL, "HandleException: exception: class=%s,
signature=%s", exceptionName, exceptionSignature));



Mime
View raw message