< prev index next > test/lib/jdk/test/lib/jvmti/jvmti_common.hpp
Print this page
static jmethodID
get_frame_method(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jint depth) {
jmethodID method;
jlocation loc;
jvmtiError err = jvmti->GetFrameLocation(thread, depth, &method, &loc);
! check_jvmti_status(jni, err, "notifyFramePop: Failed in JVMTI GetFrameLocation");
return method;
}
static jvmtiThreadInfo
get_thread_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
static jmethodID
get_frame_method(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jint depth) {
jmethodID method;
jlocation loc;
jvmtiError err = jvmti->GetFrameLocation(thread, depth, &method, &loc);
! check_jvmti_status(jni, err, "get_frame_method: error in JVMTI GetFrameLocation");
return method;
}
static jvmtiThreadInfo
get_thread_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
}
deallocate(jvmti, jni, (void*)methods);
return method;
}
+ static void
+ log_object_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject obj) {
+ jclass cls = jni->GetObjectClass(obj);
+ if (cls == nullptr) {
+ fatal(jni, "log_object_class: class is nullptr\n");
+ return;
+ }
+ char* sig = nullptr;
+ check_jvmti_error(jvmti->GetClassSignature(cls, &sig, nullptr), "GetClassSignature");
+
+ LOG(" - got an object of class: %s\n", sig);
+ jvmti->Deallocate((unsigned char *)sig);
+ }
+
+ static jobject
+ get_local_object(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jint depth, jint slot) {
+ LOG("GetLocalObject: depth: %d slot %d\n", (int)depth, (int)slot);
+ jobject obj = nullptr;
+ check_jvmti_error(jvmti->GetLocalObject(thread, depth, slot, &obj), "GetLocalObject");
+
+ log_object_class(jvmti, jni, obj);
+ return obj;
+ }
+
+ static jobject
+ get_local_instance(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jint depth) {
+ LOG("GetLocalInstance: depth: %d\n", (int)depth);
+ jobject obj = nullptr;
+ check_jvmti_error(jvmti->GetLocalInstance(thread, depth, &obj), "GetLocalInstance");
+
+ log_object_class(jvmti, jni, obj);
+ return obj;
+ }
+
+ static void
+ set_local_object(jvmtiEnv *jvmti, jthread thread, jint depth, jint slot, jobject obj) {
+ LOG("SetLocalObject for slot %d\n", (int)slot);
+ check_jvmti_error(jvmti->SetLocalObject(thread, depth, slot, obj), "SetLocalObject");
+ }
+
// Wait for target thread to reach the required JVMTI thread state.
// The state jint bitmask is returned by the JVMTI GetThreadState.
// Some examples are:
// - JVMTI_THREAD_STATE_WAITING
// - JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
< prev index next >