harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r794726 [2/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/commands/EventRequest.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.cpp?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.cpp (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.cpp Thu Jul 16 15:57:37 2009
@@ -15,15 +15,12 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Vitaly A. Provodin, Pavel N. Vyssotski
- * @version $Revision: 1.12 $
- */
 #include "EventRequest.h"
 #include "PacketParser.h"
 #include "RequestManager.h"
 #include "Log.h"
+#include "ExceptionManager.h"
+
 
 using namespace jdwp;
 using namespace EventRequest;
@@ -31,340 +28,380 @@
 //-----------------------------------------------------------------------------
 //Set--------------------------------------------------------------------------
 
-void
-EventRequest::SetHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+EventRequest::SetHandler::Execute(JNIEnv *jni) 
 {
     jdwpEventKind eventKind = (jdwpEventKind) m_cmdParser->command.ReadByte();
     jdwpSuspendPolicy suspendPolicy =
         (jdwpSuspendPolicy) m_cmdParser->command.ReadByte();
     jint modCount = m_cmdParser->command.ReadInt();
 
-    JDWP_TRACE_DATA("Set: event="
-        << GetRequestManager().GetEventKindName(eventKind) 
-        << ", eventKind=" << eventKind 
-        << ", suspendPolicy=" << suspendPolicy
-        << ", modCount=" << modCount);
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: event=%s, eventKind=%d, suspendPolicy=%d, modCount=%d",
+                    GetRequestManager().GetEventKindName(eventKind), eventKind, suspendPolicy, modCount));
 
     AgentEventRequest* request = (eventKind == JDWP_EVENT_SINGLE_STEP) ?
         new StepRequest(suspendPolicy, modCount) :
         new AgentEventRequest(eventKind, suspendPolicy, modCount);
 
-    try {
-        for (jint i = 0; i < modCount; i++) {
-            RequestModifier* modifier;
-            jbyte modifierByte = m_cmdParser->command.ReadByte();
-            switch (modifierByte) {
-            case JDWP_MODIFIER_COUNT:
-                {
-                    jint n = m_cmdParser->command.ReadInt();
-                    if (n <= 0) {
-                        throw AgentException(JDWP_ERROR_INVALID_COUNT);
-                    }
-                    modifier = new CountModifier(n);
-                    JDWP_TRACE_DATA("Set: modifier=COUNT, count=" << n);
-                    break;
-                }
+    for (jint i = 0; i < modCount; i++) {
+        RequestModifier* modifier;
+        jbyte modifierByte = m_cmdParser->command.ReadByte();
+        switch (modifierByte) {
+        case JDWP_MODIFIER_COUNT:
+            {
+                jint n = m_cmdParser->command.ReadInt();
+                if (n <= 0) {
+                    AgentException e(JDWP_ERROR_INVALID_COUNT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_INVALID_COUNT;
+                }
+                modifier = new CountModifier(n);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=COUNT, count=%d", n));
+                break;
+            }
 
-            case JDWP_MODIFIER_CONDITIONAL:
-                {
-                    jint id = m_cmdParser->command.ReadInt();
-                    modifier = new ConditionalModifier(id);
-                    JDWP_TRACE_DATA("Set: modifier=CONDITIONAL, exprID=" << id);
-                    break;
-                }
+        case JDWP_MODIFIER_CONDITIONAL:
+            {
+                jint id = m_cmdParser->command.ReadInt();
+                modifier = new ConditionalModifier(id);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=CONDITIONAL, exprID=%d", id));
+                break;
+            }
 
-            case JDWP_MODIFIER_THREAD_ONLY:
-                {
-                    if (eventKind == JDWP_EVENT_CLASS_UNLOAD ||
-                        eventKind == JDWP_EVENT_VM_DEATH)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    jthread thread = m_cmdParser->command.ReadThreadID(jni);
+        case JDWP_MODIFIER_THREAD_ONLY:
+            {
+                if (eventKind == JDWP_EVENT_CLASS_UNLOAD ||
+                    eventKind == JDWP_EVENT_VM_DEATH)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                jthread thread = m_cmdParser->command.ReadThreadID(jni);
 #ifndef NDEBUG                    
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        jvmtiThreadInfo threadInfo;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetThreadInfo(thread, &threadInfo));
-                        JDWP_TRACE_DATA("Set: modifier=THREAD_ONLY, thread=" << thread 
-                            << ", name=" << threadInfo.name);
-                    }
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    jvmtiThreadInfo threadInfo;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetThreadInfo(thread, &threadInfo));
+                    JvmtiAutoFree jafInfoName(threadInfo.name);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=THREAD_ONLY, thread=%p, name=%s", thread, threadInfo.name));
+                }
 #endif
-                    if (thread == 0) {
-                        throw AgentException(JDWP_ERROR_INVALID_THREAD);
-                    }
-                    modifier = new ThreadOnlyModifier(jni, thread);
-                    break;
+                if (thread == 0) {
+                    AgentException e(JDWP_ERROR_INVALID_THREAD);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_INVALID_THREAD;
                 }
+                modifier = new ThreadOnlyModifier(jni, thread);
+                break;
+            }
 
-            case JDWP_MODIFIER_CLASS_ONLY:
-                {
-                    if (eventKind == JDWP_EVENT_CLASS_UNLOAD ||
-                        eventKind == JDWP_EVENT_THREAD_START ||
-                        eventKind == JDWP_EVENT_THREAD_END ||
-                        eventKind == JDWP_EVENT_VM_DEATH)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
+        case JDWP_MODIFIER_CLASS_ONLY:
+            {
+                if (eventKind == JDWP_EVENT_CLASS_UNLOAD ||
+                    eventKind == JDWP_EVENT_THREAD_START ||
+                    eventKind == JDWP_EVENT_THREAD_END ||
+                    eventKind == JDWP_EVENT_VM_DEATH)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
 #ifndef NDEBUG  
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        char* signature = 0;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
-                        JvmtiAutoFree afs(signature);
-                        JDWP_TRACE_DATA("Set: modifier=CLASS_ONLY, refTypeID=" << cls
-                            << ", signature=" << JDWP_CHECK_NULL(signature));
-                    }
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    char* signature = 0;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
+                    JvmtiAutoFree afs(signature);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=CLASS_ONLY, refTypeID=%p, signature=%s", cls, JDWP_CHECK_NULL(signature)));
+                }
 #endif
 
-                    if (cls == 0) {
-                        throw AgentException(JDWP_ERROR_INVALID_CLASS);
-                    }
-                    modifier = new ClassOnlyModifier(jni, cls);
-                    break;
+                if (cls == 0) {
+                    AgentException e(JDWP_ERROR_INVALID_CLASS);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_INVALID_CLASS;
                 }
+                modifier = new ClassOnlyModifier(jni, cls);
+                break;
+            }
 
-            case JDWP_MODIFIER_CLASS_MATCH:
-                {
-                    if (eventKind == JDWP_EVENT_THREAD_START ||
-                        eventKind == JDWP_EVENT_THREAD_END ||
-                        eventKind == JDWP_EVENT_VM_DEATH)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    char* pattern = m_cmdParser->command.ReadStringNoFree();
-                    JDWP_ASSERT(pattern != 0);
-                    // replace '.' with '/' to be matched with signature
-                    for (char* p = pattern; *p != '\0'; p++) {
-                        if (*p == '.') {
-                            *p = '/';
-                        }
-                    }
-                    modifier = new ClassMatchModifier(pattern);
-                    JDWP_TRACE_DATA("Set: modifier=CLASS_MATCH, classPattern=" 
-                        << JDWP_CHECK_NULL(pattern));
-                    break;
-                }
+        case JDWP_MODIFIER_CLASS_MATCH:
+            {
+                if (eventKind == JDWP_EVENT_THREAD_START ||
+                    eventKind == JDWP_EVENT_THREAD_END ||
+                    eventKind == JDWP_EVENT_VM_DEATH)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                char* pattern = m_cmdParser->command.ReadStringNoFree();
+                JDWP_ASSERT(pattern != 0);
+                // replace '.' with '/' to be matched with signature
+                for (char* p = pattern; *p != '\0'; p++) {
+                    if (*p == '.') {
+                        *p = '/';
+                    }
+                }
+                modifier = new ClassMatchModifier(pattern);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=CLASS_MATCH, classPattern=%s", JDWP_CHECK_NULL(pattern)));
+                break;
+            }
 
-            case JDWP_MODIFIER_CLASS_EXCLUDE:
-                {
-                    if (eventKind == JDWP_EVENT_THREAD_START ||
-                        eventKind == JDWP_EVENT_THREAD_END ||
-                        eventKind == JDWP_EVENT_VM_DEATH)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    char* pattern = m_cmdParser->command.ReadStringNoFree();
-                    JDWP_ASSERT(pattern != 0);
-                    // replace '.' with '/' to be matched with signature
-                    for (char* p = pattern; *p != '\0'; p++) {
-                        if (*p == '.') {
-                            *p = '/';
-                        }
-                    }
-                    modifier = new ClassExcludeModifier(pattern);
-                    JDWP_TRACE_DATA("Set: modifier=CLASS_EXCLUDE, classPattern=" 
-                        << JDWP_CHECK_NULL(pattern));
-                    break;
-                }
+        case JDWP_MODIFIER_CLASS_EXCLUDE:
+            {
+                if (eventKind == JDWP_EVENT_THREAD_START ||
+                    eventKind == JDWP_EVENT_THREAD_END ||
+                    eventKind == JDWP_EVENT_VM_DEATH)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                char* pattern = m_cmdParser->command.ReadStringNoFree();
+                JDWP_ASSERT(pattern != 0);
+                // replace '.' with '/' to be matched with signature
+                for (char* p = pattern; *p != '\0'; p++) {
+                    if (*p == '.') {
+                        *p = '/';
+                    }
+                }
+                modifier = new ClassExcludeModifier(pattern);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=CLASS_EXCLUDE, classPattern=%s", JDWP_CHECK_NULL(pattern)));
+                break;
+            }
 
-            case JDWP_MODIFIER_LOCATION_ONLY:
-                {
-                    if (eventKind != JDWP_EVENT_BREAKPOINT &&
-                        eventKind != JDWP_EVENT_FIELD_ACCESS &&
-                        eventKind != JDWP_EVENT_FIELD_MODIFICATION &&
-                        eventKind != JDWP_EVENT_SINGLE_STEP &&
-                        eventKind != JDWP_EVENT_EXCEPTION)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    m_cmdParser->command.ReadByte(); // typeTag
-                    jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
-                    jmethodID method = m_cmdParser->command.ReadMethodID(jni);
-                    jlocation loc = m_cmdParser->command.ReadLong();
+        case JDWP_MODIFIER_LOCATION_ONLY:
+            {
+                if (eventKind != JDWP_EVENT_BREAKPOINT &&
+                    eventKind != JDWP_EVENT_FIELD_ACCESS &&
+                    eventKind != JDWP_EVENT_FIELD_MODIFICATION &&
+                    eventKind != JDWP_EVENT_SINGLE_STEP &&
+                    eventKind != JDWP_EVENT_EXCEPTION)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                m_cmdParser->command.ReadByte(); // typeTag
+                jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
+                jmethodID method = m_cmdParser->command.ReadMethodID(jni);
+                jlocation loc = m_cmdParser->command.ReadLong();
 
 #ifndef NDEBUG                    
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        char* methodName = 0;
-                        char* methodSignature = 0;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(method, &methodName, &methodSignature, 0));
-                        JvmtiAutoFree afs(methodSignature);
-                        JvmtiAutoFree afn(methodName);
-                        JDWP_TRACE_DATA("Set: modifier=LOCATION_ONLY, loc=" << loc
-                            << ", method=" << method
-                            << ", name=" << JDWP_CHECK_NULL(methodName)
-                            << ", signature=" << JDWP_CHECK_NULL(methodSignature));
-                    }
-#endif                      
-                    modifier = new LocationOnlyModifier(jni, cls, method, loc);
-                    break;
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    char* methodName = 0;
+                    char* methodSignature = 0;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(method, &methodName, &methodSignature, 0));
+                    JvmtiAutoFree afs(methodSignature);
+                    JvmtiAutoFree afn(methodName);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=LOCATION_ONLY, loc=%lld, method=%p, name=%s, signature=%s", 
+                                    loc, method, JDWP_CHECK_NULL(methodName), JDWP_CHECK_NULL(methodSignature)));
                 }
+#endif                      
+                modifier = new LocationOnlyModifier(jni, cls, method, loc);
+                break;
+            }
 
-            case JDWP_MODIFIER_EXCEPTION_ONLY:
-                {
-                    if (eventKind != JDWP_EVENT_EXCEPTION) {
-                        throw IllegalArgumentException();
-                    }
-                    jclass cls = m_cmdParser->command.ReadReferenceTypeIDOrNull(jni);
-                    jboolean caught = m_cmdParser->command.ReadBoolean();
-                    jboolean uncaught = m_cmdParser->command.ReadBoolean();
+        case JDWP_MODIFIER_EXCEPTION_ONLY:
+            {
+                if (eventKind != JDWP_EVENT_EXCEPTION) {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                jclass cls = m_cmdParser->command.ReadReferenceTypeIDOrNull(jni);
+                jboolean caught = m_cmdParser->command.ReadBoolean();
+                jboolean uncaught = m_cmdParser->command.ReadBoolean();
 
 #ifndef NDEBUG                    
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        char* signature = 0;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
-                        JvmtiAutoFree afs(signature);
-                        JDWP_TRACE_DATA("Set: modifier=EXCEPTION_ONLY, refTypeID=" << cls
-                            << ", signature=" << JDWP_CHECK_NULL(signature)
-                            << ", caught=" << (int)caught
-                            << ", uncaught=" << (int)uncaught);
-                    }
-#endif
-                    modifier = new ExceptionOnlyModifier(jni, cls,
-                        (caught == JNI_TRUE), (uncaught == JNI_TRUE));
-                    break;
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    char* signature = 0;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
+                    JvmtiAutoFree afs(signature);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=EXCEPTION_ONLY, refTypeID=%p, signature=%s, caught=%s, uncaught=%s", 
+                                    cls, JDWP_CHECK_NULL(signature), (caught?"TRUE":"FALSE"), (uncaught?"TRUE":"FALSE")));
                 }
+#endif
+                modifier = new ExceptionOnlyModifier(jni, cls,
+                    (caught == JNI_TRUE), (uncaught == JNI_TRUE));
+                break;
+            }
 
-            case JDWP_MODIFIER_FIELD_ONLY:
-                {
-                    if (eventKind != JDWP_EVENT_FIELD_ACCESS &&
-                        eventKind != JDWP_EVENT_FIELD_MODIFICATION)
-                    {
-                        throw IllegalArgumentException();
-                    }
-                    jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
-                                        if (cls == 0) {
-                        throw AgentException(JDWP_ERROR_INVALID_CLASS);
-                    }
-                    jfieldID field = 
-                    m_cmdParser->command.ReadFieldID(jni);
+        case JDWP_MODIFIER_FIELD_ONLY:
+            {
+                if (eventKind != JDWP_EVENT_FIELD_ACCESS &&
+                    eventKind != JDWP_EVENT_FIELD_MODIFICATION)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                jclass cls = m_cmdParser->command.ReadReferenceTypeID(jni);
+                                    if (cls == 0) {
+                    AgentException e(JDWP_ERROR_INVALID_CLASS);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_INVALID_CLASS;
+                }
+                jfieldID field = 
+                m_cmdParser->command.ReadFieldID(jni);
 #ifndef NDEBUG                    
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        char* signature = 0;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
-                        JvmtiAutoFree afs(signature);
-                        char* fieldName = 0;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetFieldName(cls, field, &fieldName, 0, 0));
-                        JvmtiAutoFree afn(fieldName);
-                        JDWP_TRACE_DATA("Set: modifier=FIELD_ONLY, refTypeId=" << cls
-                            << ", signature=" << JDWP_CHECK_NULL(signature)
-                            << ", fieldName=" << JDWP_CHECK_NULL(fieldName));
-                    }
-#endif
-                    modifier = new FieldOnlyModifier(jni, cls, field);
-                    break;
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    char* signature = 0;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(cls, &signature, 0));
+                    JvmtiAutoFree afs(signature);
+                    char* fieldName = 0;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetFieldName(cls, field, &fieldName, 0, 0));
+                    JvmtiAutoFree afn(fieldName);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=FIELD_ONLY, refTypeId=%p, signature=%s, fieldName=%s",
+                                    cls, JDWP_CHECK_NULL(signature), JDWP_CHECK_NULL(fieldName)));
                 }
+#endif
+                modifier = new FieldOnlyModifier(jni, cls, field);
+                break;
+            }
 
-            case JDWP_MODIFIER_STEP:
-                {
-                    if (eventKind != JDWP_EVENT_SINGLE_STEP) {
-                        throw IllegalArgumentException();
-                    }
-                    jthread thread = m_cmdParser->command.ReadThreadID(jni);
-                    jint size = m_cmdParser->command.ReadInt();
-                    jint depth = m_cmdParser->command.ReadInt();
+        case JDWP_MODIFIER_STEP:
+            {
+                if (eventKind != JDWP_EVENT_SINGLE_STEP) {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+                jthread thread = m_cmdParser->command.ReadThreadID(jni);
+                jint size = m_cmdParser->command.ReadInt();
+                jint depth = m_cmdParser->command.ReadInt();
 
 #ifndef NDEBUG                    
-                    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
-                        jvmtiError err;
-                        jvmtiThreadInfo threadInfo;
-                        JVMTI_TRACE(err, GetJvmtiEnv()->GetThreadInfo(thread, &threadInfo));
-                        JvmtiAutoFree aftn(threadInfo.name);
-                        JDWP_TRACE_DATA("Set: modifier=STEP, thread=" << thread
-                            << ", name=" << JDWP_CHECK_NULL(threadInfo.name)
-                            << ", size=" << size
-                            << ", depth=" << depth);
-                    }
+                if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+                    jvmtiError err;
+                    jvmtiThreadInfo threadInfo;
+                    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetThreadInfo(thread, &threadInfo));
+                    JvmtiAutoFree aftn(threadInfo.name);
+                    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=STEP, thread=%p, name=%s, size=%d, depth=%d", 
+                                    thread, JDWP_CHECK_NULL(threadInfo.name), size, depth));
+                }
 #endif
 
-                    if (thread == 0) {
-                        throw AgentException(JDWP_ERROR_INVALID_THREAD);
-                    }
-                    reinterpret_cast<StepRequest*>
-                        (request)->Init(jni, thread, size, depth);
-                    modifier = new StepModifier(jni, thread, size, depth);
-                    break;
+                if (thread == 0) {
+                    AgentException e(JDWP_ERROR_INVALID_THREAD);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_INVALID_THREAD;
+                }
+                int ret  = (reinterpret_cast<StepRequest*>
+                    (request))->Init(jni, thread, size, depth);
+                if (ret != JDWP_ERROR_NONE) {
+                    delete request;
+                    return ret;
                 }
+                modifier = new StepModifier(jni, thread, size, depth);
+                break;
+            }
 
-            case JDWP_MODIFIER_INSTANCE_ONLY:
-                {
-                    if (eventKind == JDWP_EVENT_CLASS_PREPARE ||
-                        eventKind == JDWP_EVENT_CLASS_UNLOAD ||
-                        eventKind == JDWP_EVENT_THREAD_START ||
-                        eventKind == JDWP_EVENT_THREAD_END ||
-                        eventKind == JDWP_EVENT_VM_DEATH)
-                    {
-                        throw IllegalArgumentException();
-                    }
-
-                    jobject instance = m_cmdParser->command.ReadObjectID(jni);
-                    JDWP_TRACE_DATA("Set: modifier=INSTANCE_ONLY, instance=" << instance);
-
-                    modifier = new InstanceOnlyModifier(jni, instance);
-                    break;
+        case JDWP_MODIFIER_INSTANCE_ONLY:
+            {
+                if (eventKind == JDWP_EVENT_CLASS_PREPARE ||
+                    eventKind == JDWP_EVENT_CLASS_UNLOAD ||
+                    eventKind == JDWP_EVENT_THREAD_START ||
+                    eventKind == JDWP_EVENT_THREAD_END ||
+                    eventKind == JDWP_EVENT_VM_DEATH)
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
                 }
 
-            // New modifier kind  for Java 6
-            case JDWP_MODIFIER_SOURCE_NAME_MATCH:
-                {
-                    if (eventKind != JDWP_EVENT_CLASS_PREPARE )
-                    {
-                        throw IllegalArgumentException();
-                    }
-
-                    char* pattern = m_cmdParser->command.ReadStringNoFree();
-                    JDWP_ASSERT(pattern != 0);
+                jobject instance = m_cmdParser->command.ReadObjectID(jni);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=INSTANCE_ONLY, instance=%p", instance));
 
-                    modifier = new SourceNameMatchModifier(pattern);
-                    JDWP_TRACE_DATA("Set: modifier=SOURCE_NAME_MATCH, classPattern=" 
-                        << JDWP_CHECK_NULL(pattern));
-                    break;
-                }
-            default:
-                JDWP_TRACE_DATA("Set: bad modifier: " << modifierByte);
-                throw IllegalArgumentException();
+                modifier = new InstanceOnlyModifier(jni, instance);
+                break;
+            }
 
+        // New modifier kind  for Java 6
+        case JDWP_MODIFIER_SOURCE_NAME_MATCH:
+            {
+                if (eventKind != JDWP_EVENT_CLASS_PREPARE )
+                {
+                    AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+                    JDWP_SET_EXCEPTION(e);
+                    delete request;
+                    return JDWP_ERROR_ILLEGAL_ARGUMENT;
+                }
+
+                char* pattern = m_cmdParser->command.ReadStringNoFree();
+                JDWP_ASSERT(pattern != 0);
+
+                modifier = new SourceNameMatchModifier(pattern);
+                JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: modifier=SOURCE_NAME_MATCH, classPattern=%s", JDWP_CHECK_NULL(pattern)));
+                break;
             }
-            request->AddModifier(modifier, i);
+        default:
+            JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: bad modifier: %d", modifierByte));
+            AgentException e(JDWP_ERROR_ILLEGAL_ARGUMENT);
+            JDWP_SET_EXCEPTION(e);
+            delete request;
+            return JDWP_ERROR_ILLEGAL_ARGUMENT;
+
         }
-    } catch (AgentException& e) {
-        delete request;
-        throw e;
+        request->AddModifier(modifier, i);
     }
 
     RequestID id = GetRequestManager().AddRequest(jni, request);
-    JDWP_TRACE_DATA("Set: send: requestId=" << id);
+    if (id == 0) {
+        return JDWP_ERROR_INTERNAL;
+    }
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Set: send: requestId=%d", id));
     m_cmdParser->reply.WriteInt(id);
+
+    return JDWP_ERROR_NONE;
 }
 
 //-----------------------------------------------------------------------------
 //Clear------------------------------------------------------------------------
 
-void
+int
 EventRequest::ClearHandler::Execute(JNIEnv *jni)
-    throw(AgentException)
 {
     jdwpEventKind eventKind = (jdwpEventKind) m_cmdParser->command.ReadByte();
     RequestID id = m_cmdParser->command.ReadInt();
-    JDWP_TRACE_DATA("Clear: event="
-        << GetRequestManager().GetEventKindName(eventKind) 
-        << ", eventKind=" << eventKind << ", requestId=" << id);
-    GetRequestManager().DeleteRequest(jni, eventKind, id);
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Clear: event=%s, eventKind=%d, requestId=%d",
+                    GetRequestManager().GetEventKindName(eventKind), eventKind, id));
+    int ret = GetRequestManager().DeleteRequest(jni, eventKind, id);
+    JDWP_CHECK_RETURN(ret);
+
+    return JDWP_ERROR_NONE;
 }
 
 //-----------------------------------------------------------------------------
 //ClearAllBreakpoints----------------------------------------------------------
 
-void
+int
 EventRequest::ClearAllBreakpointsHandler::Execute(JNIEnv *jni)
-    throw(AgentException)
 {
-    JDWP_TRACE_DATA("ClearAllBreakpoints");
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "ClearAllBreakpoints"));
     GetRequestManager().DeleteAllBreakpoints(jni);
+
+    return JDWP_ERROR_NONE;
 }
 
 //-----------------------------------------------------------------------------

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.h?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.h (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/EventRequest.h Thu Jul 16 15:57:37 2009
@@ -17,11 +17,6 @@
  */
 
 /**
- * @author Vitaly A. Provodin, Pavel N. Vyssotski
- * @version $Revision: 1.4.2.1 $
- */
-
-/**
  * @file
  * EventRequest.h
  *
@@ -63,7 +58,7 @@
              * @exception The implementations of the given interface
              *            may throw <code>AgentException</code>.
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni) ;
 
         };//SetHandler
 
@@ -80,7 +75,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni) ;
 
         };//ClearHandler
 
@@ -97,7 +92,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni) ;
 
         };//ClearHandler
 

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.cpp?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.cpp (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.cpp Thu Jul 16 15:57:37 2009
@@ -15,19 +15,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
-/**
- * @author Viacheslav G. Rybalov
- * @version $Revision: 1.11 $
- */
 #include "Method.h"
 #include "PacketParser.h"
+#include "ExceptionManager.h"
+
 
 using namespace jdwp;
 using namespace Method;
 
-void
-Method::LineTableHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+Method::LineTableHandler::Execute(JNIEnv *jni) 
 {
     jvmtiError err;
     jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
@@ -37,48 +34,51 @@
     if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
         jvmtiError err;
         char* classSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
         JvmtiAutoFree afs(classSignature);
         char* methodName = 0;
         char* methodSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
         JvmtiAutoFree afmn(methodName);
         JvmtiAutoFree afms(methodSignature);
-        JDWP_TRACE_DATA("LineTable: received: methodName=" << methodName
-            << ", methodSignature=" << JDWP_CHECK_NULL(methodSignature)
-            << ", classSignature=" << JDWP_CHECK_NULL(classSignature));
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "LineTable: received: methodName=%s, methodSignature=%s, classSignature=%s", 
+                        methodName, JDWP_CHECK_NULL(methodSignature), JDWP_CHECK_NULL(classSignature)));
     }
 #endif
 
     jboolean isNative;
-    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
 
     if (isNative == JNI_TRUE) {
-        JDWP_TRACE_DATA("LineTable: native method");
-        throw AgentException(JDWP_ERROR_NATIVE_METHOD);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "LineTable: native method"));
+        AgentException e(JDWP_ERROR_NATIVE_METHOD);
+        JDWP_SET_EXCEPTION(e);
+        return JDWP_ERROR_NATIVE_METHOD;
     }
     
     jlocation start_location;
     jlocation end_location;
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodLocation(methodID,
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodLocation(methodID,
         &start_location, &end_location));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }    
     jint entry_count = 0;
     jvmtiLineNumberEntry* table = 0;
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetLineNumberTable(methodID,
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetLineNumberTable(methodID,
         &entry_count, &table));
     JvmtiAutoFree afv(table);
     if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY ||
         err == JVMTI_ERROR_ABSENT_INFORMATION)
     {
-        JDWP_TRACE_DATA("LineTable: send: tableStart=" << start_location
-            << ", tableEnd=" << end_location 
-            << ", entry_count=0 (no info)"); 
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "LineTable: send: tableStart=%lld, tableEnd=%lld, entry_count=0 (no info)", start_location, end_location));
 
         m_cmdParser->reply.WriteLong(start_location);
         m_cmdParser->reply.WriteLong(end_location);
@@ -86,29 +86,30 @@
         
     } else if (err == JVMTI_ERROR_NONE) {
 
-        JDWP_TRACE_DATA("LineTable: send: tableStart=" << start_location
-            << ", tableEnd=" << end_location 
-            << ", entry_count=" << entry_count);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "LineTable: send: tableStart=%lld, tableEnd=%lld, entry_count=%d", start_location, end_location, entry_count));
 
         m_cmdParser->reply.WriteLong(start_location);
         m_cmdParser->reply.WriteLong(end_location);
         m_cmdParser->reply.WriteInt(entry_count);
 
         for (int i = 0; i < entry_count; i++) {
-            JDWP_TRACE_DATA("LineTable: send: entry#=" << i 
-                << ", lineCodeIndex=" << table[i].start_location 
-                << ", lineCodeNumber=" << table[i].line_number);
+            JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "LineTable: send: entry#=%d, lineCodeIndex=%lld, lineCodeNumber=%d", 
+                            i, table[i].start_location, table[i].line_number));
             m_cmdParser->reply.WriteLong(table[i].start_location);
             m_cmdParser->reply.WriteInt(table[i].line_number);
               
         }
     } else {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
+
+    return JDWP_ERROR_NONE;
 }
 
-void
-Method::VariableTableHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+Method::VariableTableHandler::Execute(JNIEnv *jni) 
 {
     jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
     jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
@@ -117,47 +118,54 @@
     if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
         jvmtiError err;
         char* classSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
         JvmtiAutoFree afcs(classSignature);
         char* methodName = 0;
         char* methodSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
         JvmtiAutoFree afmn(methodName);
         JvmtiAutoFree afms(methodSignature);
-        JDWP_TRACE_DATA("VariableTable: received: methodName=" << methodName
-            << ", methodSignature=" << JDWP_CHECK_NULL(methodSignature)
-            << ", classSignature=" << JDWP_CHECK_NULL(classSignature));
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTable: received: methodName=%s, methodSignature=%s, classSignature=%s", 
+                        methodName, JDWP_CHECK_NULL(methodSignature), JDWP_CHECK_NULL(classSignature)));
     }
 #endif
 
     jboolean isNative;
     jvmtiError err;
-    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
 
     if (isNative == JNI_TRUE) {
-        JDWP_TRACE_DATA("VariableTable: native method");
-        throw AgentException(JDWP_ERROR_NATIVE_METHOD);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTable: native method"));
+        AgentException e(JDWP_ERROR_NATIVE_METHOD);
+		JDWP_SET_EXCEPTION(e);
+        return JDWP_ERROR_NATIVE_METHOD;
     }
 
     jint size;
 
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
     m_cmdParser->reply.WriteInt(size);
 
     jint entry_count;
     jvmtiLocalVariableEntry* table = 0;
 
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
         &entry_count, &table));
     JvmtiAutoFree afv(table);
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
     
 #ifndef NDEBUG    
@@ -166,23 +174,17 @@
         jlocation end_location;
         GetJvmtiEnv()->GetMethodLocation(methodID,
             &start_location, &end_location);
-        JDWP_TRACE_DATA("VariableTable: methodStart=" << start_location
-            << ", methodEnd=" << end_location << ", entry_count=" << entry_count);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTable: methodStart=%lld, methodEnd=%lld, entry_count=%d", start_location, end_location, entry_count));
     }
 #endif
     
-    JDWP_TRACE_DATA("VariableTable: send: argSize=" << size 
-        << ", entry_count=" << entry_count); 
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTable: send: argSize=%d, entry_count=%d", size, entry_count));
     m_cmdParser->reply.WriteInt(entry_count);
 
     for (int i = 0; i < entry_count; i++) {
 
-        JDWP_TRACE_DATA("VariableTable: send: entry#=" << i 
-            << ", codeIndex=" << table[i].start_location 
-            << ", name=" << table[i].name 
-            << ", signature=" << table[i].signature 
-            << ", length=" << table[i].length 
-            << ", slot=" << table[i].slot);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTable: send: entry#=%d, codeIndex=%lld, name=%s, signature=%s, length=%d, slot=%d",
+                        i, table[i].start_location, table[i].name, table[i].signature, table[i].length, table[i].slot));
 
         m_cmdParser->reply.WriteLong(table[i].start_location);
         m_cmdParser->reply.WriteString(table[i].name);
@@ -190,20 +192,22 @@
         m_cmdParser->reply.WriteInt(table[i].length);
         m_cmdParser->reply.WriteInt(table[i].slot);
 
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].name)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].signature)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].generic_signature)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
     }
+
+    return JDWP_ERROR_NONE;
 }
 
-void
-Method::BytecodesHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+Method::BytecodesHandler::Execute(JNIEnv *jni) 
 {
     jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
     jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
@@ -212,69 +216,82 @@
     if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
         jvmtiError err;
         char* classSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
         JvmtiAutoFree afcs(classSignature);
         char* methodName = 0;
         char* methodSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
         JvmtiAutoFree afmn(methodName);
         JvmtiAutoFree afms(methodSignature);
-        JDWP_TRACE_DATA("Bytecodes: received: methodName=" << methodName
-            << ", methodSignature=" << JDWP_CHECK_NULL(methodSignature)
-            << ", classSignature=" << JDWP_CHECK_NULL(classSignature));
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Bytecodes: received: methodName=%s, methodSignature=%s, classSignature=%s", 
+                        methodName, JDWP_CHECK_NULL(methodSignature), JDWP_CHECK_NULL(classSignature)));
     }
 #endif
     jint bytecode_count;
     unsigned char* bytecodes = 0;
 
     jvmtiError err;
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetBytecodes(methodID,
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetBytecodes(methodID,
         &bytecode_count, &bytecodes));
     JvmtiAutoFree afv(bytecodes);
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
 
-    JDWP_TRACE_DATA("Bytecodes: send: bytecode_count=" << bytecode_count);
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Bytecodes: send: bytecode_count=%d", bytecode_count));
     m_cmdParser->reply.WriteByteArray(reinterpret_cast<jbyte*>(bytecodes), bytecode_count);
+
+    return JDWP_ERROR_NONE;
 }
 
-void
-Method::IsObsoleteHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+Method::IsObsoleteHandler::Execute(JNIEnv *jni) 
 {
     jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
     jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
 
+    // when the methodID is 0, it means the method is obsolete.
+    if (0 == methodID) {
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "IsObsolete: send: is_obsolete=TRUE"));
+        m_cmdParser->reply.WriteBoolean(JNI_TRUE);
+        return JDWP_ERROR_NONE;
+	}
+
 #ifndef NDEBUG
     if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
         jvmtiError err;
         char* classSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
         JvmtiAutoFree afcs(classSignature);
         char* methodName = 0;
         char* methodSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
         JvmtiAutoFree afmn(methodName);
         JvmtiAutoFree afms(methodSignature);
-        JDWP_TRACE_DATA("IsObsolete: received: methodName=" << methodName
-            << ", methodSignature=" << JDWP_CHECK_NULL(methodSignature)
-            << ", classSignature=" << JDWP_CHECK_NULL(classSignature));
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "IsObsolete: received: methodName=%s, methodSignature=%s, classSignature=%s", 
+                        methodName, JDWP_CHECK_NULL(methodSignature), JDWP_CHECK_NULL(classSignature)));
     }
 #endif
     jboolean is_obsolete = JNI_FALSE;
 
     jvmtiError err;
-    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodObsolete(methodID, &is_obsolete));
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->IsMethodObsolete(methodID, &is_obsolete));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
 
-    JDWP_TRACE_DATA("IsObsolete: send: is_obsolete=" << is_obsolete);
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "IsObsolete: send: is_obsolete=%s", (is_obsolete ? "TRUE" : "FALSE")));
     m_cmdParser->reply.WriteBoolean(is_obsolete);
+
+    return JDWP_ERROR_NONE;
 }
 
-void
-Method::VariableTableWithGenericHandler::Execute(JNIEnv *jni) throw(AgentException)
+int
+Method::VariableTableWithGenericHandler::Execute(JNIEnv *jni)
 {
     jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
     jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
@@ -282,35 +299,38 @@
     if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
         jvmtiError err;
         char* classSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
         JvmtiAutoFree afcs(classSignature);      
         char* methodName = 0;
         char* methodSignature = 0;
-        JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetMethodName(methodID, &methodName, &methodSignature, 0));
         JvmtiAutoFree afmn(methodName);
         JvmtiAutoFree afms(methodSignature);
-        JDWP_TRACE_DATA("VariableTableWithGeneric: received: methodName=" << methodName
-            << ", methodSignature=" << JDWP_CHECK_NULL(methodSignature)
-            << ", classSignature=" << JDWP_CHECK_NULL(classSignature));
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTableWithGeneric: received: methodName=%s, methodSignature=%s, classSignature=%s", 
+                        methodName, JDWP_CHECK_NULL(methodSignature), JDWP_CHECK_NULL(classSignature)));
     }
 #endif
     jint size;
 
     jvmtiError err;
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
     m_cmdParser->reply.WriteInt(size);
 
     jint entry_count;
     jvmtiLocalVariableEntry* table = 0;
 
-    JVMTI_TRACE(err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
+    JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
         &entry_count, &table));
     JvmtiAutoFree afv(table);
     if (err != JVMTI_ERROR_NONE) {
-        throw AgentException(err);
+        AgentException e(err);
+		JDWP_SET_EXCEPTION(e);
+        return err;
     }
     
 #ifndef NDEBUG
@@ -319,24 +339,18 @@
         jlocation end_location;
         GetJvmtiEnv()->GetMethodLocation(methodID,
             &start_location, &end_location);
-        JDWP_TRACE_DATA("VariableTableWithGeneric: methodStart="
-            << start_location << ", methodEnd=" 
-            << end_location << ", entry_count=" << entry_count);
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTableWithGeneric: methodStart=%lld, methodEnd=%lld, entry_count=%d",
+                        start_location, end_location, entry_count));
     } 
 #endif
     
-    JDWP_TRACE_DATA("VariableTableWithGeneric: send: argSize=" << size 
-        << ", entry_count=" << entry_count); 
+    JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTableWithGeneric: send: argSize=%d, entry_count=%d", size, entry_count));
     m_cmdParser->reply.WriteInt(entry_count);
 
     for (int i = 0; i < entry_count; i++) {
 
-        JDWP_TRACE_DATA("VariableTableWithGeneric: send: entry#=" << i 
-            << ", codeIndex=" << table[i].start_location 
-            << ", name=" << table[i].name 
-            << ", signature=" << table[i].signature 
-            << ", length=" << table[i].length 
-            << ", slot=" << table[i].slot);        
+        JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "VariableTableWithGeneric: send: entry#=%d, codeIndex=%lld, name=%s, signature=%s, length=%d, slot=%d",
+                        i, table[i].start_location, table[i].name, table[i].signature, table[i].length, table[i].slot));
         
         m_cmdParser->reply.WriteLong(table[i].start_location);
         m_cmdParser->reply.WriteString(table[i].name);
@@ -345,14 +359,16 @@
         m_cmdParser->reply.WriteInt(table[i].length);
         m_cmdParser->reply.WriteInt(table[i].slot);
 
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].name)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].signature)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
-        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+        JVMTI_TRACE(LOG_DEBUG, err, GetJvmtiEnv()->Deallocate(
             reinterpret_cast<unsigned char*>(table[i].generic_signature)));
         JDWP_ASSERT(err==JVMTI_ERROR_NONE);
     }
+
+    return JDWP_ERROR_NONE;
 }

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.h?rev=794726&r1=794725&r2=794726&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.h (original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/Method.h Thu Jul 16 15:57:37 2009
@@ -17,11 +17,6 @@
  */
 
 /**
- * @author Viacheslav G. Rybalov
- * @version $Revision: 1.4.2.1 $
- */
-
-/**
  * @file
  * Method.h
  *
@@ -54,7 +49,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni);
 
         };//LineTableHandler
 
@@ -71,7 +66,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni);
 
         };//VariableTableHandler
 
@@ -88,7 +83,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni);
 
         };//BytecodesHandler
 
@@ -105,7 +100,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni);
 
         };//IsObsoleteHandler
 
@@ -122,7 +117,7 @@
              *
              * @param jni - the JNI interface pointer
              */
-            virtual void Execute(JNIEnv *jni) throw(AgentException);
+            virtual int Execute(JNIEnv *jni);
 
         };//VariableTableWithGenericHandler
 



Mime
View raw message