void outStream_writeValue(JNIEnv *env, PacketOutputStream *out, jbyte typeKey, jvalue value) { if (typeKey == JDWP_Tag_OBJECT) { outStream_writeByte(out, specificTypeKey(value.l)); } else { outStream_writeByte(out, typeKey); } if (isObjectTag(typeKey)) { WRITE_GLOBAL_REF(env, out, value.l); } else { switch (typeKey) { case JDWP_Tag_BYTE: outStream_writeByte(out, value.b); break; case JDWP_Tag_CHAR: outStream_writeChar(out, value.c); break; case JDWP_Tag_FLOAT: outStream_writeFloat(out, value.f); break; case JDWP_Tag_DOUBLE: outStream_writeDouble(out, value.d); break; case JDWP_Tag_INT: outStream_writeInt(out, value.i); break; case JDWP_Tag_LONG: outStream_writeLong(out, value.j); break; case JDWP_Tag_SHORT: outStream_writeShort(out, value.s); break; case JDWP_Tag_BOOLEAN: outStream_writeBoolean(out, value.z); break; case JDWP_Tag_VOID: /* happens with function return values */ /* write nothing */ break; default: ERROR_MESSAGE_EXIT("Invalid type key"); } } }
jdwpError outStream_writeValue(JNIEnv *env, PacketOutputStream *out, jbyte typeKey, jvalue value) { if (typeKey == JDWP_TAG(OBJECT)) { (void)outStream_writeByte(out, specificTypeKey(env, value.l)); } else { (void)outStream_writeByte(out, typeKey); } if (isObjectTag(typeKey)) { (void)outStream_writeObjectRef(env, out, value.l); } else { switch (typeKey) { case JDWP_TAG(BYTE): return outStream_writeByte(out, value.b); case JDWP_TAG(CHAR): return outStream_writeChar(out, value.c); case JDWP_TAG(FLOAT): return outStream_writeFloat(out, value.f); case JDWP_TAG(DOUBLE): return outStream_writeDouble(out, value.d); case JDWP_TAG(INT): return outStream_writeInt(out, value.i); case JDWP_TAG(LONG): return outStream_writeLong(out, value.j); case JDWP_TAG(SHORT): return outStream_writeShort(out, value.s); case JDWP_TAG(BOOLEAN): return outStream_writeBoolean(out, value.z); case JDWP_TAG(VOID): /* happens with function return values */ /* write nothing */ return JDWP_ERROR(NONE); default: EXIT_ERROR(AGENT_ERROR_INVALID_OBJECT,"Invalid type key"); break; } } return JDWP_ERROR(NONE); }
static void writeCharComponents(JNIEnv *env, PacketOutputStream *out, jarray array, jint index, jint length) { jchar *components; components = newComponents(out, length, sizeof(jchar)); if (components != NULL) { jint i; JNI_FUNC_PTR(env,GetCharArrayRegion)(env, array, index, length, components); for (i = 0; i < length; i++) { (void)outStream_writeChar(out, components[i]); } deleteComponents(components); } }