From 429d5f88b94ff28416cbfc6420b6389fa284df97 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 10 Dec 2024 22:30:12 +0100 Subject: Import RTFL 0.1.1 --- java/class.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 java/class.c (limited to 'java/class.c') diff --git a/java/class.c b/java/class.c new file mode 100644 index 0000000..d4e78ae --- /dev/null +++ b/java/class.c @@ -0,0 +1,39 @@ +#include "class.h" +#include "config.h" +#include "misc.h" + +void JNICALL class_prepare(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, + jclass klass) +{ + jvmtiError error; + char *class_sig = NULL, *class_name = NULL; + + if ((error = (*jvmti)->GetClassSignature (jvmti, klass, &class_sig, NULL)) + != JVMTI_ERROR_NONE) + jvmti_error (jvmti, error, "GetClassSignature"); + else { + if ((class_name = get_class_name_from_sig (class_sig, TRUE)) && + include_class (class_name)) { + jint field_count; + jfieldID* fields; + if ((error = (*jvmti)->GetClassFields (jvmti, klass, &field_count, + &fields)) + != JVMTI_ERROR_NONE) + jvmti_error (jvmti, error, "GetClassFields"); + else { + int i; + for (i = 0; i < field_count; i++) { + if ((error = + (*jvmti)->SetFieldModificationWatch (jvmti, klass, + fields[i])) + != JVMTI_ERROR_NONE) + jvmti_error (jvmti, error, "SetFieldModificationWatch"); + } + } + } + } + + jvmti_dealloc (jvmti, class_sig); + simple_free (class_name); + +} -- cgit v1.2.3