Commit 09bbfc56 authored by Lubomir Bulej's avatar Lubomir Bulej

dislreagent, REDispatch: added support for sending the current thread using JNI.

parent 8fb9bd74
......@@ -1293,6 +1293,23 @@ JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendObjectSize
pack_long(tld_get()->analysis_buff, size);
}
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendCurrentThread
(JNIEnv * jni_env, jclass this_class) {
//
// GetCurrentThread may return null if called in the wrong phase,
// and even if it fails for other reason, we at least send null.
//
// Consider sending some dummy data for an "init" thread while
// GetCurrentThread is not yet ready to return the current
// thread, to differentiate it from failure.
//
jthread thread = NULL;
(*jvmti_env)->GetCurrentThread(jvmti_env, &thread);
struct tldata * tld = tld_get ();
pack_object(jni_env, tld->analysis_buff, tld->command_buff, thread,
OT_DATA_OBJECT);
}
static JNINativeMethod redispatchMethods[] = {
{"registerMethod", "(Ljava/lang/String;)S", (void *)&Java_ch_usi_dag_dislre_REDispatch_registerMethod},
......@@ -1310,6 +1327,7 @@ static JNINativeMethod redispatchMethods[] = {
{"sendObject", "(Ljava/lang/Object;)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendObject},
{"sendObjectPlusData", "(Ljava/lang/Object;)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendObjectPlusData},
{"sendObjectSize", "(Ljava/lang/Object;)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendObjectSize},
{"sendCurrentThread", "()V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendCurrentThread},
};
// ******************* CLASS LOAD callback *******************
......
......@@ -43,6 +43,7 @@ public class REDispatch {
public static native void sendObject(Object objToSend);
public static native void sendObjectPlusData(Object objToSend);
public static native void sendObjectSize(Object objToSend);
public static native void sendCurrentThread();
// Methods use similar logic as Float.floatToIntBits() and
// Double.doubleToLongBits() but implemented in the native code
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment