harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r480141 [4/38] - in /harmony/enhanced/jdktools/trunk/modules/jpda: ./ doc/ doc/images/ make/ src/ src/common/ src/common/other/ src/common/other/jpda/ src/common/other/jpda/jdwp/ src/common/other/jpda/jdwp/agent/ src/common/other/jpda/jdwp/...
Date Tue, 28 Nov 2006 17:49:31 GMT
Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassLoaderReference.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassLoaderReference.h?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassLoaderReference.h (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassLoaderReference.h Tue Nov 28 09:49:08 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, 
+ * as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov
+ * @version $Revision: 1.4.2.1 $
+ */
+
+/**
+ * @file
+ * ClassLoaderReference.h
+ *
+ */
+
+#ifndef _CLASSLOADERREFERENCE_H_
+#define _CLASSLOADERREFERENCE_H_
+
+#include "AgentException.h"
+#include "CommandHandler.h"
+
+namespace jdwp {
+
+    /**
+     * The namespace includes declaration of the classes implementing commands
+     * from the <code>ClassLoaderReference</code> command set.
+     */
+    namespace ClassLoaderReference {
+
+        /**
+         * The class implements the <code>VisibleClasses</code> command from the
+         * <code>ClassLoaderReference</code> command set.
+         */
+        class VisibleClassesHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>VisibleClasses</code> JDWP command for the
+             * <code>ClassLoaderReference</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//VisibleClassesHandler
+
+    } // ClassLoaderReference
+
+} //jdwp
+
+#endif //_CLASSLOADERREFERENCE_H_

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassLoaderReference.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.cpp?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.cpp (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.cpp Tue Nov 28 09:49:08 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov
+ * @version $Revision: 1.9 $
+ */
+#include "ClassObjectReference.h"
+#include "PacketParser.h"
+#include "ClassManager.h"
+
+using namespace jdwp;
+using namespace ClassObjectReference;
+
+void
+ClassObjectReference::ReflectedTypeHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jclass classObject = static_cast<jclass>(m_cmdParser->command.ReadObjectID(jni));
+    JDWP_TRACE_DATA("ReflectedType: received: classObject=" << classObject);
+
+    jdwpTypeTag typeTag = AgentBase::GetClassManager().GetJdwpTypeTag(classObject); 
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(classObject, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_TRACE_DATA("ReflectedType: send: typeTag=" << typeTag
+            << ", typeID=" << classObject
+            << ", signature=" << JDWP_CHECK_NULL(signature));
+    }
+#endif
+
+    m_cmdParser->reply.WriteByte(typeTag);
+    m_cmdParser->reply.WriteReferenceTypeID(jni, classObject);
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.h?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.h (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.h Tue Nov 28 09:49:08 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, 
+ * as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov
+ * @version $Revision: 1.4.2.1 $
+ */
+
+/**
+ * @file
+ * ClassObjectReference.h
+ *
+ */
+
+#ifndef _CLASSOBJECTREFERENCE_H_
+#define _CLASSOBJECTREFERENCE_H_
+
+#include "AgentException.h"
+#include "CommandHandler.h"
+
+namespace jdwp {
+
+    /**
+     * The namespace includes declaration of the classes implementing commands
+     * from the <code>ClassObjectReference</code> command set.
+     */
+    namespace ClassObjectReference {
+
+        /**
+         * The class implements the <code>ReflectedType</code> command from the
+         * <code>ClassObjectReference</code> command set.
+         */
+        class ReflectedTypeHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>ReflectedType</code> JDWP command for the
+             * <code>ClassObjectReference</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//ReflectedTypeHandler
+
+    } // ClassObjectReference
+
+} //jdwp
+
+#endif //_CLASSOBJECTREFERENCE_H_

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassObjectReference.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.cpp?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.cpp (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.cpp Tue Nov 28 09:49:08 2006
@@ -0,0 +1,561 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov, Anton V. Karnachuk
+ * @version $Revision: 1.25 $
+ */
+#include "ClassType.h"
+
+#include "PacketParser.h"
+#include "ClassManager.h"
+#include "ThreadManager.h"
+
+using namespace jdwp;
+using namespace ClassType;
+
+//-----------------------------------------------------------------------------
+// SuperClass -----------------------------------------------------------------
+
+void 
+ClassType::SuperClassHandler::Execute(JNIEnv *jni) throw(AgentException) 
+{
+    //INVALID_OBJECT can be thrown below
+    jclass clazz = m_cmdParser->command.ReadReferenceTypeID(jni);
+    JDWP_TRACE_DATA("SuperClass: received: classID=" << clazz);
+
+    // get superclass
+    jclass superClazz = jni->GetSuperclass(clazz);
+    
+    // superClazz is null for java.lang.Object or for an interface. That is ok
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(superClazz, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_TRACE_DATA("SuperClass: send: superClassID=" << superClazz
+            << ", classSignature=" << JDWP_CHECK_NULL(signature));
+    }
+#endif
+
+    // write super class to the reply
+    m_cmdParser->reply.WriteReferenceTypeID(jni, superClazz);
+}
+
+//-----------------------------------------------------------------------------
+// SetValues -----------------------------------------------------------------
+
+void 
+ClassType::SetValuesHandler::Execute(JNIEnv *jni) throw(AgentException) 
+{
+    //INVALID_CLASS or INVALID_OBJECT can be thrown below
+    jclass clazz = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jint values = m_cmdParser->command.ReadInt();
+    JDWP_TRACE_DATA("SetValues: received: classID=" << clazz 
+        << ", values=" << values);
+
+    jvmtiEnv* jvmti = AgentBase::GetJvmtiEnv();
+
+    // check for CLASS_NOT_PREPARED
+    jint status;
+    jvmtiError err;
+    JVMTI_TRACE(err, jvmti->GetClassStatus(clazz, &status));
+
+    if (err != JVMTI_ERROR_NONE) {
+        // Can be: JVMTI_ERROR_INVALID_CLASS, JVMTI_ERROR_NULL_POINTER
+        throw AgentException(err);
+    }
+    jint const JVMTI_CLASS_STATUS_PREPARED = 0x2;
+    if ( (status & JVMTI_CLASS_STATUS_PREPARED) == 0 ) {
+        throw AgentException(JDWP_ERROR_CLASS_NOT_PREPARED);
+    }
+
+    //Repeats values times:
+    for (int i=0; i<values; i++) {
+        jfieldID fieldID = m_cmdParser->command.ReadFieldID(jni);
+
+        // check that given field belongs to passed jvmClass
+        // taking into account inheritance
+        jvmtiError err;
+        jclass declaringClass;
+        JVMTI_TRACE(err, jvmti->GetFieldDeclaringClass(clazz, fieldID,
+            &declaringClass));
+
+        if (err != JVMTI_ERROR_NONE) {
+            throw AgentException(err);
+        }
+
+        if ( jni->IsAssignableFrom(clazz, declaringClass) == JNI_FALSE ) {
+            // given field does not belong to passed jvmClass
+            throw AgentException(JDWP_ERROR_INVALID_FIELDID);
+        }
+
+        // Check non-static field
+        jint fieldModifiers;
+        JVMTI_TRACE(err, jvmti->GetFieldModifiers(clazz, fieldID,
+            &fieldModifiers));
+
+        if (err != JVMTI_ERROR_NONE) {
+            // Can be: JVMTI_ERROR_INVALID_CLASS, JVMTI_ERROR_INVALID_FIELDID,
+            // JVMTI_ERROR_NULL_POINTER
+            throw AgentException(err);
+        }
+
+        if ( (fieldModifiers & 0x0008) == 0 ) { // ACC_STATIC_FLAG = 0x0008;
+            // given field is not static
+            throw AgentException(JDWP_ERROR_INVALID_FIELDID);
+        }
+
+        //Do not check field for final - for compatibility with jdwp
+        // SetStatic<Type>Field() JNI functions do not change final field value
+
+        // pointers for jwmti returned parameters
+        char* p_name = 0;
+        char* p_signature = 0;
+
+        // try to obtain the field's name and signature
+        JVMTI_TRACE(err, jvmti->GetFieldName(clazz, fieldID,
+            &p_name, &p_signature, 0));
+
+        // create auto-free pointers for the following objects
+        JvmtiAutoFree af1(p_name);
+        JvmtiAutoFree af2(p_signature);
+
+        if (err != JVMTI_ERROR_NONE) {
+            // can be one of jvmti universal errors or
+            // JVMTI_ERROR_INVALID_CLASS or JVMTI_ERROR_INVALID_FIELDID
+            throw AgentException(err);
+        }
+
+        jdwpTag tag = GetClassManager().GetJdwpTagFromSignature(p_signature);
+        if (tag == JDWP_TAG_NONE) {
+            JDWP_TRACE_DATA("SetValues: unknown field signature: " 
+                << JDWP_CHECK_NULL(p_signature));
+            throw InternalErrorException();
+        }
+
+        jvalue value = m_cmdParser->command.ReadUntaggedValue(jni, tag);
+        // Can be: InternalErrorException, OutOfMemoryException,
+        // JDWP_ERROR_INVALID_OBJECT
+        JDWP_TRACE_DATA("SetValues: set: value#="<< i 
+            << ", fieldID=" << fieldID 
+            << ", fieldModifiers=" << fieldModifiers 
+            << ", fieldName=" << JDWP_CHECK_NULL(p_name) 
+            << ", fieldSignature=" << JDWP_CHECK_NULL(p_signature) 
+            << ", tag=" << tag);
+        
+        switch (tag) {
+        case JDWP_TAG_BOOLEAN:
+            jni->SetStaticBooleanField(clazz, fieldID, value.z);
+            break;
+        case JDWP_TAG_BYTE:
+            jni->SetStaticByteField(clazz, fieldID, value.b);
+            break;
+        case JDWP_TAG_CHAR:
+            jni->SetStaticCharField(clazz, fieldID, value.c);
+            break;
+        case JDWP_TAG_SHORT:
+            jni->SetStaticShortField(clazz, fieldID, value.s);
+            break;
+        case JDWP_TAG_INT:
+            jni->SetStaticIntField(clazz, fieldID, value.i);
+            break;
+        case JDWP_TAG_LONG:
+            jni->SetStaticLongField(clazz, fieldID, value.j);
+            break;
+        case JDWP_TAG_FLOAT:
+            jni->SetStaticFloatField(clazz, fieldID, value.f);
+            break;
+        case JDWP_TAG_DOUBLE:
+            jni->SetStaticDoubleField(clazz, fieldID, value.d);
+            break;
+        case JDWP_TAG_OBJECT:
+        case JDWP_TAG_ARRAY:
+            if (!GetClassManager().IsObjectValueFitsFieldType(
+                    jni, value.l, p_signature) ) {
+                throw AgentException(JDWP_ERROR_INVALID_OBJECT);
+            }
+            jni->SetStaticObjectField(clazz, fieldID, value.l);
+            break;
+        default:
+            // should not reach here
+            break;
+        }
+
+    }
+
+}
+
+//-----------------------------------------------------------------------------
+// InvokeMethod ---------------------------------------------------------------
+
+const char* ClassType::InvokeMethodHandler::GetThreadName() {
+    return "_jdwp_ClassType_InvokeMethod";
+}
+
+void 
+ClassType::InvokeMethodHandler::Execute(JNIEnv *jni) throw(AgentException) 
+{
+    m_clazz = m_cmdParser->command.ReadReferenceTypeID(jni);
+    m_thread = m_cmdParser->command.ReadThreadID(jni);
+    m_methodID = m_cmdParser->command.ReadMethodID(jni);
+    jint arguments = m_cmdParser->command.ReadInt();
+
+    JDWP_TRACE_DATA("InvokeMethod: received: refTypeID=" << m_clazz 
+        << ", threadID=" << m_thread 
+        << ", methodID=" << m_methodID
+        << ", arguments=" << arguments);
+
+    if (AgentBase::GetClassManager().IsClass(jni, m_clazz) != JNI_TRUE) {
+        throw AgentException(JDWP_ERROR_INVALID_CLASS);
+    }
+
+    jvmtiEnv* jvmti = AgentBase::GetJvmtiEnv();
+    jvmtiError err;
+
+    // check that given method belongs to passed class
+    // taking into account inheritance
+    jclass declaringClass;
+    JVMTI_TRACE(err, jvmti->GetMethodDeclaringClass(m_methodID, &declaringClass));
+
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    if ( jni->IsAssignableFrom(m_clazz, declaringClass) == JNI_FALSE ) {
+        // given method does not belong to passed class
+        JDWP_TRACE_DATA("InvokeMethod: given method does not belong to passed class");
+        throw AgentException(JDWP_ERROR_INVALID_METHODID);
+    }
+
+    // check that given method is stsic method
+    jint methodModifiers;
+    JVMTI_TRACE(err, jvmti->GetMethodModifiers(m_methodID, &methodModifiers));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    if ( (methodModifiers & 0x0008) == 0 ) { // ACC_STATIC_FLAG = 0x0008;
+        // given method is not static
+        JDWP_TRACE_DATA("InvokeMethod: given method is not static");
+        throw AgentException(JDWP_ERROR_INVALID_METHODID);
+    }
+
+    char* signature = 0;
+    char* name = 0;
+    JVMTI_TRACE(err, jvmti->GetMethodName(m_methodID,
+        &name, &signature, 0 /*&generic signature*/));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    
+    JvmtiAutoFree afv2(signature);
+    JvmtiAutoFree afv3(name);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_LOG)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(m_clazz, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_TRACE_DATA("InvokeMethod: call: method=" << JDWP_CHECK_NULL(name) 
+            << ", classSignature=" << JDWP_CHECK_NULL(signature)
+            << ", thread=" << m_thread);
+    }
+#endif
+
+    JDWP_ASSERT(signature[0] == '(');
+    JDWP_ASSERT(strlen(signature) >= 3);
+    JDWP_ASSERT(signature + strlen(signature) >= strchr(signature, ')'));
+
+    int methodArguments = getArgsNumber(signature);
+
+    if (arguments != methodArguments) {
+        JDWP_TRACE_DATA("InvokeMethod: arguments != methodArguments");
+        throw AgentException(JDWP_ERROR_ILLEGAL_ARGUMENT);
+    }
+    if (arguments != 0) {
+        m_methodValues = 
+            reinterpret_cast<jvalue*>(AgentBase::GetMemoryManager().Allocate(sizeof(jvalue) * arguments JDWP_FILE_LINE));
+    } else {
+        m_methodValues = 0;
+    }
+    AgentAutoFree afv1(m_methodValues JDWP_FILE_LINE);
+
+    m_returnValue.tag = static_cast<jdwpTag>(*(strchr(signature, ')') + 1));
+    for (jint i = 0; i < arguments; i++) {
+        jdwpTaggedValue tValue = m_cmdParser->command.ReadValue(jni);
+        if (IsArgValid(jni, i, tValue, signature) != JNI_TRUE) {
+            JDWP_TRACE_DATA("InvokeMethod: bad argument " << i << ": sig=" << signature);
+            throw AgentException(JDWP_ERROR_TYPE_MISMATCH);
+        }
+        m_methodValues[i] = tValue.value;
+    }
+    m_invokeOptions = m_cmdParser->command.ReadInt();
+
+    m_returnError = JDWP_ERROR_NONE;
+    m_returnException = 0;
+
+    WaitDeferredInvocation(jni);
+
+    if (m_returnError == JDWP_ERROR_NONE) {
+        m_cmdParser->reply.WriteValue(jni, m_returnValue.tag, m_returnValue.value);
+        m_cmdParser->reply.WriteTaggedObjectID(jni, m_returnException);
+    }
+    
+    switch (m_returnValue.tag) {
+    case JDWP_TAG_OBJECT:
+    case JDWP_TAG_ARRAY:
+    case JDWP_TAG_STRING:
+    case JDWP_TAG_THREAD:
+    case JDWP_TAG_THREAD_GROUP:
+    case JDWP_TAG_CLASS_LOADER:
+    case JDWP_TAG_CLASS_OBJECT:
+        if (m_returnValue.value.l != 0) {
+            jni->DeleteGlobalRef(m_returnValue.value.l);
+        }
+        break;
+    default:
+        break;
+    }
+    if (m_returnException != 0) {
+        jni->DeleteGlobalRef(m_returnException);
+    }
+
+    if (m_returnError != JDWP_ERROR_NONE) {
+        throw AgentException(m_returnError);
+    }
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_LOG)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(m_clazz, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_LOG("InvokeMethod: return: method=" << JDWP_CHECK_NULL(name)
+            << ", classSignature=" << JDWP_CHECK_NULL(signature)
+            << ", thread=" << m_thread
+            << ", returnValueTag=" << m_returnValue.tag
+            << ", returnException=" << m_returnException);
+    }
+#endif
+
+}
+
+void 
+ClassType::InvokeMethodHandler::ExecuteDeferredFunc(JNIEnv *jni)
+{
+    JDWP_ASSERT(m_returnValue.tag != 0);
+    JDWP_ASSERT(m_clazz != 0);
+    JDWP_ASSERT(m_methodID != 0);
+    JDWP_ASSERT(jni != 0);
+    switch (m_returnValue.tag) {
+    case JDWP_TAG_BOOLEAN:
+        m_returnValue.value.z = jni->CallStaticBooleanMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_BYTE:
+        m_returnValue.value.b = jni->CallStaticByteMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_CHAR:
+        m_returnValue.value.c = jni->CallStaticCharMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_SHORT:
+        m_returnValue.value.s = jni->CallStaticShortMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_INT:
+        m_returnValue.value.i = jni->CallStaticIntMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_LONG:
+        m_returnValue.value.j = jni->CallStaticLongMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_FLOAT:
+        m_returnValue.value.f = jni->CallStaticFloatMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_DOUBLE:
+        m_returnValue.value.d = jni->CallStaticDoubleMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_VOID:
+        jni->CallStaticVoidMethodA(m_clazz, m_methodID, m_methodValues);
+        break;
+    case JDWP_TAG_OBJECT: {
+        m_returnValue.value.l =
+            jni->CallStaticObjectMethodA(m_clazz, m_methodID, m_methodValues);
+        if (m_returnValue.value.l != 0) {
+            m_returnValue.value.l = jni->NewGlobalRef(m_returnValue.value.l);
+            if (m_returnValue.value.l == 0) {
+                m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
+            }
+        }
+        m_returnValue.tag = GetClassManager().GetJdwpTag(jni, m_returnValue.value.l);
+        break;
+    }
+    default:
+        m_returnError = JDWP_ERROR_INVALID_TAG;
+        return;
+    }
+    m_returnException = jni->ExceptionOccurred();
+    if (m_returnException != 0) {
+        m_returnException =
+            static_cast<jthrowable>(jni->NewGlobalRef(m_returnException));
+        if (m_returnException == 0) {
+            m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
+        }
+    }
+    jni->ExceptionClear();
+}
+
+//-----------------------------------------------------------------------------
+// NewInstance ----------------------------------------------------------------
+
+const char* ClassType::NewInstanceHandler::GetThreadName() {
+    return "_jdwp_ClassType_NewInstanceHandler";
+}
+
+void 
+ClassType::NewInstanceHandler::Execute(JNIEnv *jni) throw(AgentException) 
+{
+    m_clazz = m_cmdParser->command.ReadReferenceTypeID(jni);
+    if (AgentBase::GetClassManager().IsClass(jni, m_clazz) != JNI_TRUE) {
+        JDWP_TRACE_DATA("NewInstance: not a class: refTypeID=" << m_clazz);
+        throw AgentException(JDWP_ERROR_INVALID_CLASS);
+    }
+
+    m_thread = m_cmdParser->command.ReadThreadID(jni);
+    m_methodID = m_cmdParser->command.ReadMethodID(jni);
+    int passedArguments = m_cmdParser->command.ReadInt();
+
+    JDWP_TRACE_DATA("NewInstance: received: refTypeID=" << m_clazz 
+        << ", threadID=" << m_thread 
+        << ", methodID=" << m_methodID
+        << ", arguments=" << passedArguments);
+
+    char* signature = 0;
+    char* name = 0;
+    jvmtiError err;
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodName(m_methodID,
+        &name, &signature, 0 /*&generic signature*/));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    
+    JvmtiAutoFree afv2(signature);
+    JvmtiAutoFree afv3(name);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_LOG)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(m_clazz, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_TRACE_DATA("NewInstance: call method=" << JDWP_CHECK_NULL(name) 
+            << ", signature=" << JDWP_CHECK_NULL(signature)
+            << ", thread=" << m_thread);
+    }
+#endif
+
+    JDWP_ASSERT(signature[0] == '(');
+    JDWP_ASSERT(strlen(signature) >= 3);
+    JDWP_ASSERT(signature + strlen(signature) >= strchr(signature, ')'));
+
+    int methodArguments = getArgsNumber(signature);
+
+    if (passedArguments != methodArguments) {
+        JDWP_TRACE_DATA("NewInstance: passedArguments != methodArguments");
+        throw AgentException(JDWP_ERROR_ILLEGAL_ARGUMENT);
+    }
+    if (passedArguments != 0) {
+        m_methodValues = 
+            reinterpret_cast<jvalue*>(AgentBase::GetMemoryManager().Allocate(sizeof(jvalue) * passedArguments JDWP_FILE_LINE));
+    } else {
+        m_methodValues = 0;
+    }
+    AgentAutoFree afv1(m_methodValues JDWP_FILE_LINE);
+
+    for (int i = 0; i < passedArguments; i++) {
+        jdwpTaggedValue tValue = m_cmdParser->command.ReadValue(jni);
+        if (IsArgValid(jni, i, tValue, signature) != JNI_TRUE) {
+            JDWP_TRACE_DATA("NewInstance: bad argument " << i << ": sig=" << signature);
+            throw AgentException(JDWP_ERROR_TYPE_MISMATCH);
+        }
+        m_methodValues[i] = tValue.value;
+    }
+    m_invokeOptions = m_cmdParser->command.ReadInt();
+
+    m_returnError = JDWP_ERROR_NONE;
+    m_returnException = 0;
+    m_returnValue = 0;
+
+    WaitDeferredInvocation(jni);
+
+    if (m_returnError == JDWP_ERROR_NONE) {
+        m_cmdParser->reply.WriteTaggedObjectID(jni, m_returnValue);
+        m_cmdParser->reply.WriteTaggedObjectID(jni, m_returnException);
+    }
+    
+    if (m_returnValue != 0) {
+        jni->DeleteGlobalRef(m_returnValue);
+    }
+    if (m_returnException != 0) {
+        jni->DeleteGlobalRef(m_returnException);
+    }
+
+    if (m_returnError != JDWP_ERROR_NONE) {
+        throw AgentException(m_returnError);
+    }
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_LOG)) {
+        jvmtiError err;
+        char* signature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(m_clazz, &signature, 0));
+        JvmtiAutoFree afs(signature);
+        JDWP_LOG("NewInstance: return: methodName=" << JDWP_CHECK_NULL(name)
+            << ", signature=" << JDWP_CHECK_NULL(signature)
+            << ", thread=" << m_thread
+            << ", returnObject=" << m_returnValue
+            << ", returnException=" << m_returnException);
+    }
+#endif
+
+}
+
+void 
+ClassType::NewInstanceHandler::ExecuteDeferredFunc(JNIEnv *jni)
+{
+    JDWP_ASSERT(m_clazz != 0);
+    JDWP_ASSERT(m_methodID != 0);
+    JDWP_ASSERT(jni != 0);
+
+    m_returnValue = jni->NewObjectA(m_clazz, m_methodID, m_methodValues);
+    if (m_returnValue != 0) {
+        m_returnValue = jni->NewGlobalRef(m_returnValue);
+        if (m_returnValue == 0) {
+            m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
+        }
+    }
+    m_returnException = jni->ExceptionOccurred();
+    if (m_returnException != 0) {
+        m_returnException =
+            static_cast<jthrowable>(jni->NewGlobalRef(m_returnException));
+        if (m_returnException == 0) {
+            m_returnError = JDWP_ERROR_OUT_OF_MEMORY;
+        }
+    }
+    jni->ExceptionClear();
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.h?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.h (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.h Tue Nov 28 09:49:08 2006
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, 
+ * as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov, Anton V. Karnachuk
+ * @version $Revision: 1.7.2.1 $
+ */
+
+/**
+ * @file
+ * ClassType.h
+ *
+ */
+
+#ifndef _CLASS_TYPE_H_
+#define _CLASS_TYPE_H_
+
+#include "AgentException.h"
+#include "CommandHandler.h"
+
+namespace jdwp {
+
+    /**
+     * The namespace includes declaration of the classes implementing commands
+     * from the <code>ClassType</code> command set.
+     */
+    namespace ClassType {
+
+        /**
+         * The class implements the <code>Superclass</code> command from the
+         * <code>ClassType</code> command set.
+         */
+        class SuperClassHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>SuperClass</code> JDWP command for the
+             * <code>ClassType</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             *
+             * @exception <code>InternalErrorException</code> is thrown, if
+             *            the packet data integrity gets broken.
+             * @exception <code>OutOfMemoryException</code> is thrown, if
+             *            the system runs out of memory.
+             *
+             * following @exception The following implementations of the given 
+             *                      interface may throw <code>AgentException</code>:
+             *                      INVALID_CLASS, INVALID_OBJECT, VM_DEAD
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        }; //SuperClassHandler
+
+        /**
+         * The class implements the <code>SetValues</code> command from the
+         * <code>ClassType</code> command set.
+         */
+        class SetValuesHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>SetValues</code> JDWP command for the
+             * <code>ClassType</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             *
+             * @exception  If the packet data integrity gets broken,
+             *             <code>InternalErrorException</code> is thrown.
+             * @exception  If the system runs out of memory,
+             *             <code>OutOfMemoryException</code> is thrown.
+             *
+             * following @exception The following implementations of the given interface 
+             *                      may throw <code>AgentException</code>: INVALID_CLASS, 
+             *                      CLASS_NOT_PREPARED,INVALID_OBJECT, INVALID_FIELDID, 
+             *                      VM_DEAD.
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        }; //SetValuesHandler
+
+        /**
+         * The class implements the <code>InvokeMethod</code> command from the
+         * <code>ClassType</code> command set.
+         */
+        class InvokeMethodHandler : public SpecialAsyncCommandHandler {
+        public:
+
+            /**
+             * The given method makes deferred checks and executes 
+             * <code>InvokeMethod</code>.
+             * It should be called from the appropriate thread.
+             */
+            virtual void ExecuteDeferredFunc(JNIEnv *jni);
+
+            /**
+             * Gets the thread name for asynchronous execution of the current command handler.
+             *
+             * @return Thread name string.
+             */
+            virtual const char* GetThreadName();
+
+        protected:
+
+            /**
+             * Executes the <code>InvokeMethod</code> JDWP command for the
+             * <code>ClassType</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        private:
+            jclass m_clazz;
+            jmethodID m_methodID;
+            jvalue* m_methodValues;
+
+            jdwpTaggedValue m_returnValue;
+            jthrowable m_returnException;
+
+        };//InvokeMethodHandler
+
+        /**
+         * The class implements the <code>NewInstance</code> command from the
+         * <code>ClassType</code> command set.
+         */
+        class NewInstanceHandler : public SpecialAsyncCommandHandler {
+        public:
+
+            /**
+             * The given method makes deferred checks. It executes 
+             * <code>NewInstance</code>.
+             * It should be called from the appropriate thread.
+             */
+            virtual void ExecuteDeferredFunc(JNIEnv *jni);
+
+            /**
+             * Gets the thread name for asynchronous execution of the current command handler.
+             *
+             * @return Thread name string.
+             */
+            virtual const char* GetThreadName();
+
+        protected:
+
+            /**
+             * Executes the <code>NewInstance</code> JDWP command for the
+             * <code>ClassType</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        private:
+            jclass m_clazz;
+            jmethodID m_methodID;
+            jvalue* m_methodValues;
+
+            jobject m_returnValue;
+            jthrowable m_returnException;
+
+        };//NewInstanceHandler
+
+    }; // ClassType
+
+} //jdwp
+
+#endif //_CLASS_TYPE_H_

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/ClassType.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.cpp?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.cpp (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.cpp Tue Nov 28 09:49:08 2006
@@ -0,0 +1,353 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  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"
+
+using namespace jdwp;
+using namespace EventRequest;
+
+//-----------------------------------------------------------------------------
+//Set--------------------------------------------------------------------------
+
+void
+EventRequest::SetHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    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);
+
+    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;
+                }
+
+            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_THREAD_ONLY:
+                {
+                    if (eventKind == JDWP_EVENT_CLASS_UNLOAD ||
+                        eventKind == JDWP_EVENT_VM_DEATH)
+                    {
+                        throw IllegalArgumentException();
+                    }
+                    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);
+                    }
+#endif
+                    if (thread == 0) {
+                        throw AgentException(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);
+#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));
+                    }
+#endif
+
+                    if (cls == 0) {
+                        throw AgentException(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_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_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();
+
+#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;
+                }
+
+            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();
+
+#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;
+                }
+
+            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);
+#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;
+                }
+
+            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();
+
+#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);
+                    }
+#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;
+                }
+
+            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;
+                }
+
+            default:
+                JDWP_TRACE_DATA("Set: bad modifier: " << modifierByte);
+                throw IllegalArgumentException();
+
+            }
+            request->AddModifier(modifier, i);
+        }
+    } catch (AgentException& e) {
+        delete request;
+        throw e;
+    }
+
+    RequestID id = GetRequestManager().AddRequest(jni, request);
+    JDWP_TRACE_DATA("Set: send: requestId=" << id);
+    m_cmdParser->reply.WriteInt(id);
+}
+
+//-----------------------------------------------------------------------------
+//Clear------------------------------------------------------------------------
+
+void
+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);
+}
+
+//-----------------------------------------------------------------------------
+//ClearAllBreakpoints----------------------------------------------------------
+
+void
+EventRequest::ClearAllBreakpointsHandler::Execute(JNIEnv *jni)
+    throw(AgentException)
+{
+    JDWP_TRACE_DATA("ClearAllBreakpoints");
+    GetRequestManager().DeleteAllBreakpoints(jni);
+}
+
+//-----------------------------------------------------------------------------

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.h?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.h (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.h Tue Nov 28 09:49:08 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, 
+ * as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Vitaly A. Provodin, Pavel N. Vyssotski
+ * @version $Revision: 1.4.2.1 $
+ */
+
+/**
+ * @file
+ * EventRequest.h
+ *
+ */
+
+#ifndef _EVENT_REQUEST_H_
+#define _EVENT_REQUEST_H_
+
+#include "AgentException.h"
+#include "CommandHandler.h"
+
+namespace jdwp {
+
+    /**
+     * The namespace includes declaration of the classes implementing commands
+     * from the <code>EventRequest</code> command set.
+     */
+    namespace EventRequest {
+
+        /**
+         * The class implements the <code>Set</code> command from the
+         * <code>EventRequest</code> command set.
+         */
+        class SetHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>Set</code> JDWP command for the
+             * <code>EventRequest</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             *
+             * @exception If the packet data integrity gets broken,
+             *            <code>InternalErrorException</code> is thrown. 
+             * @exception <code>NotImplementedException</code> is thrown if
+             *            <code>modKind = 2</code>, that is for the future.
+             * @exception If the system runs out of memory,
+             *            <code>OutOfMemoryException</code> is thrown.
+             * @exception The implementations of the given interface
+             *            may throw <code>AgentException</code>.
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//SetHandler
+
+        /**
+         * The class implements the <code>Clear</code> command from the
+         * <code>EventRequest</code> command set.
+         */
+        class ClearHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>Clear</code> JDWP command for the
+             * <code>EventRequest</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//ClearHandler
+
+        /**
+         * The class implements the <code>ClearAllBreakpoints</code> command
+         * from the <code>EventRequest</code> command set.
+         */
+        class ClearAllBreakpointsHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>Clear</code> JDWP command for the
+             * <code>EventRequest</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//ClearHandler
+
+    } // EventRequest
+
+} //jdwp
+
+#endif //_EVENT_REQUEST_H_

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/EventRequest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.cpp?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.cpp (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.cpp Tue Nov 28 09:49:08 2006
@@ -0,0 +1,357 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  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"
+
+using namespace jdwp;
+using namespace Method;
+
+void
+Method::LineTableHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jvmtiError err;
+    jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* classSignature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JvmtiAutoFree afs(classSignature);
+        char* methodName = 0;
+        char* methodSignature = 0;
+        JVMTI_TRACE(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));
+    }
+#endif
+
+    jboolean isNative;
+    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    if (isNative == JNI_TRUE) {
+        JDWP_TRACE_DATA("LineTable: native method");
+        throw AgentException(JDWP_ERROR_NATIVE_METHOD);
+    }
+    
+    jlocation start_location;
+    jlocation end_location;
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetMethodLocation(methodID,
+        &start_location, &end_location));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }    
+    jint entry_count = 0;
+    jvmtiLineNumberEntry* table = 0;
+    JVMTI_TRACE(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)"); 
+
+        m_cmdParser->reply.WriteLong(start_location);
+        m_cmdParser->reply.WriteLong(end_location);
+        m_cmdParser->reply.WriteInt(0);
+        
+    } else if (err == JVMTI_ERROR_NONE) {
+
+        JDWP_TRACE_DATA("LineTable: send: tableStart=" << start_location
+            << ", tableEnd=" << end_location 
+            << ", entry_count=" << 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);
+            m_cmdParser->reply.WriteLong(table[i].start_location);
+            m_cmdParser->reply.WriteInt(table[i].line_number);
+              
+        }
+    } else {
+        throw AgentException(err);
+    }
+}
+
+void
+Method::VariableTableHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* classSignature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JvmtiAutoFree afcs(classSignature);
+        char* methodName = 0;
+        char* methodSignature = 0;
+        JVMTI_TRACE(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));
+    }
+#endif
+
+    jboolean isNative;
+    jvmtiError err;
+    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodNative(methodID, &isNative));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    if (isNative == JNI_TRUE) {
+        JDWP_TRACE_DATA("VariableTable: native method");
+        throw AgentException(JDWP_ERROR_NATIVE_METHOD);
+    }
+
+    jint size;
+
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    m_cmdParser->reply.WriteInt(size);
+
+    jint entry_count;
+    jvmtiLocalVariableEntry* table = 0;
+
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
+        &entry_count, &table));
+    JvmtiAutoFree afv(table);
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    
+#ifndef NDEBUG    
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jlocation start_location;
+        jlocation end_location;
+        GetJvmtiEnv()->GetMethodLocation(methodID,
+            &start_location, &end_location);
+        JDWP_TRACE_DATA("VariableTable: methodStart=" << start_location
+            << ", methodEnd=" << end_location << ", entry_count=" << entry_count);
+    }
+#endif
+    
+    JDWP_TRACE_DATA("VariableTable: send: argSize=" << size 
+        << ", entry_count=" << 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);
+
+        m_cmdParser->reply.WriteLong(table[i].start_location);
+        m_cmdParser->reply.WriteString(table[i].name);
+        m_cmdParser->reply.WriteString(table[i].signature);
+        m_cmdParser->reply.WriteInt(table[i].length);
+        m_cmdParser->reply.WriteInt(table[i].slot);
+
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].name)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].signature)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].generic_signature)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+    }
+}
+
+void
+Method::BytecodesHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* classSignature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JvmtiAutoFree afcs(classSignature);
+        char* methodName = 0;
+        char* methodSignature = 0;
+        JVMTI_TRACE(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));
+    }
+#endif
+    jint bytecode_count;
+    unsigned char* bytecodes = 0;
+
+    jvmtiError err;
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetBytecodes(methodID,
+        &bytecode_count, &bytecodes));
+    JvmtiAutoFree afv(bytecodes);
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    JDWP_TRACE_DATA("Bytecodes: send: bytecode_count=" << bytecode_count);
+    m_cmdParser->reply.WriteByteArray(reinterpret_cast<jbyte*>(bytecodes), bytecode_count);
+}
+
+void
+Method::IsObsoleteHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
+
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* classSignature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JvmtiAutoFree afcs(classSignature);
+        char* methodName = 0;
+        char* methodSignature = 0;
+        JVMTI_TRACE(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));
+    }
+#endif
+    jboolean is_obsolete;
+
+    jvmtiError err;
+    JVMTI_TRACE(err, GetJvmtiEnv()->IsMethodObsolete(methodID, &is_obsolete));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+
+    JDWP_TRACE_DATA("IsObsolete: send: is_obsolete=" << is_obsolete);
+    m_cmdParser->reply.WriteBoolean(is_obsolete);
+}
+
+void
+Method::VariableTableWithGenericHandler::Execute(JNIEnv *jni) throw(AgentException)
+{
+    jclass refType = m_cmdParser->command.ReadReferenceTypeID(jni);
+    jmethodID methodID = m_cmdParser->command.ReadMethodID(jni);
+#ifndef NDEBUG    
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jvmtiError err;
+        char* classSignature = 0;
+        JVMTI_TRACE(err, GetJvmtiEnv()->GetClassSignature(refType, &classSignature, 0));
+        JvmtiAutoFree afcs(classSignature);      
+        char* methodName = 0;
+        char* methodSignature = 0;
+        JVMTI_TRACE(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));
+    }
+#endif
+    jint size;
+
+    jvmtiError err;
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetArgumentsSize(methodID, &size));
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    m_cmdParser->reply.WriteInt(size);
+
+    jint entry_count;
+    jvmtiLocalVariableEntry* table = 0;
+
+    JVMTI_TRACE(err, GetJvmtiEnv()->GetLocalVariableTable(methodID,
+        &entry_count, &table));
+    JvmtiAutoFree afv(table);
+    if (err != JVMTI_ERROR_NONE) {
+        throw AgentException(err);
+    }
+    
+#ifndef NDEBUG
+    if (JDWP_TRACE_ENABLED(LOG_KIND_DATA)) {
+        jlocation start_location;
+        jlocation end_location;
+        GetJvmtiEnv()->GetMethodLocation(methodID,
+            &start_location, &end_location);
+        JDWP_TRACE_DATA("VariableTableWithGeneric: methodStart="
+            << start_location << ", methodEnd=" 
+            << end_location << ", entry_count=" << entry_count);
+    } 
+#endif
+    
+    JDWP_TRACE_DATA("VariableTableWithGeneric: send: argSize=" << size 
+        << ", entry_count=" << 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);        
+        
+        m_cmdParser->reply.WriteLong(table[i].start_location);
+        m_cmdParser->reply.WriteString(table[i].name);
+        m_cmdParser->reply.WriteString(table[i].signature);
+        m_cmdParser->reply.WriteString(table[i].generic_signature);
+        m_cmdParser->reply.WriteInt(table[i].length);
+        m_cmdParser->reply.WriteInt(table[i].slot);
+
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].name)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].signature)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+        JVMTI_TRACE(err, GetJvmtiEnv()->Deallocate(
+            reinterpret_cast<unsigned char*>(table[i].generic_signature)));
+        JDWP_ASSERT(err==JVMTI_ERROR_NONE);
+    }
+}

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.h?view=auto&rev=480141
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.h (added)
+++ harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.h Tue Nov 28 09:49:08 2006
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation or its licensors, 
+ * as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/**
+ * @author Viacheslav G. Rybalov
+ * @version $Revision: 1.4.2.1 $
+ */
+
+/**
+ * @file
+ * Method.h
+ *
+ */
+
+#ifndef _METHOD_H_
+#define _METHOD_H_
+
+#include "AgentException.h"
+#include "CommandHandler.h"
+
+namespace jdwp {
+
+    /**
+     * The namespace includes declaration of the classes implementing commands
+     * from the <code>Method</code> command set.
+     */
+    namespace Method {
+
+        /**
+         * The class implements the <code>LineTable</code> command from the
+         * <code>Method</code> command set.
+         */
+        class LineTableHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>LineTable</code> JDWP command for the
+             * <code>Method</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//LineTableHandler
+
+        /**
+         * The class implements the <code>VariableTable</code> command from the
+         * <code>Method</code> command set.
+         */
+        class VariableTableHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>VariableTable</code> JDWP command for the
+             * <code>Method</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//VariableTableHandler
+
+        /**
+         * The class implements the <code>Bytecodes</code> command from the
+         * <code>Method</code> command set.
+         */
+        class BytecodesHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>Bytecodes</code> JDWP command for the
+             * <code>Method</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//BytecodesHandler
+
+        /**
+         * The class implements the <code>LineTable</code> command from the
+         * <code>Method</code> command set.
+         */
+        class IsObsoleteHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>IsObsolete</code> JDWP command for the
+             * <code>Method</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//IsObsoleteHandler
+
+        /**
+         * The class implements the <code>VariableTableWithGeneric</code> command from the
+         * <code>Method</code> command set.
+         */
+        class VariableTableWithGenericHandler : public SyncCommandHandler {
+        protected:
+
+            /**
+             * Executes the <code>VariableTableWithGeneric</code> JDWP command for the
+             * <code>Method</code> command set.
+             *
+             * @param jni - the JNI interface pointer
+             */
+            virtual void Execute(JNIEnv *jni) throw(AgentException);
+
+        };//VariableTableWithGenericHandler
+
+    } // Method
+
+} //jdwp
+
+#endif //_METHOD_H_

Propchange: harmony/enhanced/jdktools/trunk/modules/jpda/src/common/other/jpda/jdwp/agent/commands/Method.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message