< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp

Print this page

 22  */
 23 
 24 #include <stdio.h>
 25 #include <string.h>
 26 #include "jvmti.h"
 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 extern "C" {
 31 
 32 static jvmtiEnv *jvmti = NULL;
 33 static jvmtiCapabilities caps;
 34 static jvmtiEventCallbacks callbacks;
 35 static jmethodID mid;
 36 static frame_info expected_platform_frames[] = {
 37     {"Lgetstacktr05$TestThread;", "chain4", "()V"},
 38     {"Lgetstacktr05$TestThread;", "chain3", "()V"},
 39     {"Lgetstacktr05$TestThread;", "chain2", "()V"},
 40     {"Lgetstacktr05$TestThread;", "chain1", "()V"},
 41     {"Lgetstacktr05$TestThread;", "run", "()V"},

 42     {"Ljava/lang/Thread;", "run", "()V"},
 43 };
 44 
 45 static frame_info expected_virtual_frames[] = {
 46     {"Lgetstacktr05$TestThread;", "chain4", "()V"},
 47     {"Lgetstacktr05$TestThread;", "chain3", "()V"},
 48     {"Lgetstacktr05$TestThread;", "chain2", "()V"},
 49     {"Lgetstacktr05$TestThread;", "chain1", "()V"},
 50     {"Lgetstacktr05$TestThread;", "run", "()V"},

 51     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 52     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 53     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 54     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 55     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 56 };
 57 
 58 
 59 void JNICALL
 60 Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmethodID method, jlocation location) {
 61   jint frame_count = 0;
 62 
 63   if (mid != method) {
 64     jni->FatalError("ERROR: didn't know where we got called from");
 65   }
 66 
 67   LOG(">>> (bp) checking frame count ...\n");
 68 
 69   check_jvmti_status(jni, jvmti_env->GetFrameCount(thread, &frame_count), "GetFrameCount failed.");
 70   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)

 22  */
 23 
 24 #include <stdio.h>
 25 #include <string.h>
 26 #include "jvmti.h"
 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 extern "C" {
 31 
 32 static jvmtiEnv *jvmti = NULL;
 33 static jvmtiCapabilities caps;
 34 static jvmtiEventCallbacks callbacks;
 35 static jmethodID mid;
 36 static frame_info expected_platform_frames[] = {
 37     {"Lgetstacktr05$TestThread;", "chain4", "()V"},
 38     {"Lgetstacktr05$TestThread;", "chain3", "()V"},
 39     {"Lgetstacktr05$TestThread;", "chain2", "()V"},
 40     {"Lgetstacktr05$TestThread;", "chain1", "()V"},
 41     {"Lgetstacktr05$TestThread;", "run", "()V"},
 42     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 43     {"Ljava/lang/Thread;", "run", "()V"},
 44 };
 45 
 46 static frame_info expected_virtual_frames[] = {
 47     {"Lgetstacktr05$TestThread;", "chain4", "()V"},
 48     {"Lgetstacktr05$TestThread;", "chain3", "()V"},
 49     {"Lgetstacktr05$TestThread;", "chain2", "()V"},
 50     {"Lgetstacktr05$TestThread;", "chain1", "()V"},
 51     {"Lgetstacktr05$TestThread;", "run", "()V"},
 52     {"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 53     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 54     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 55     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 56     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 57     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 58 };
 59 
 60 
 61 void JNICALL
 62 Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmethodID method, jlocation location) {
 63   jint frame_count = 0;
 64 
 65   if (mid != method) {
 66     jni->FatalError("ERROR: didn't know where we got called from");
 67   }
 68 
 69   LOG(">>> (bp) checking frame count ...\n");
 70 
 71   check_jvmti_status(jni, jvmti_env->GetFrameCount(thread, &frame_count), "GetFrameCount failed.");
 72   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)
< prev index next >