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 writeBooleanComponents(JNIEnv *env, PacketOutputStream *out, jarray array, jint index, jint length) { jboolean *components; components = newComponents(out, length, sizeof(jboolean)); if (components != NULL) { jint i; JNI_FUNC_PTR(env,GetBooleanArrayRegion)(env, array, index, length, components); for (i = 0; i < length; i++) { (void)outStream_writeBoolean(out, components[i]); } deleteComponents(components); } }
static void writeMonitorEvent(JNIEnv *env, PacketOutputStream *out, EventInfo *evinfo) { (void)outStream_writeObjectRef(env, out, evinfo->thread); (void)outStream_writeObjectTag(env, out, evinfo->object); (void)outStream_writeObjectRef(env, out, evinfo->object); if (evinfo->ei == EI_MONITOR_WAIT || evinfo->ei == EI_MONITOR_WAITED) { /* clazz was set to class of monitor object for monitor wait event class filtering. * See cbMonitorWait() and cbMonitorWaited() function in eventHandler.c. */ evinfo->clazz=getMethodClass(gdata->jvmti, evinfo->method); } writeCodeLocation(out, evinfo->clazz, evinfo->method, evinfo->location); if (evinfo->ei == EI_MONITOR_WAIT) { (void)outStream_writeLong(out, evinfo->u.monitor.timeout); } else if (evinfo->ei == EI_MONITOR_WAITED) { (void)outStream_writeBoolean(out, evinfo->u.monitor.timed_out); } }