< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp

Print this page

 26 #include "jvmti.h"
 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 
 31 extern "C" {
 32 
 33 #define PASSED 0
 34 #define STATUS_FAILED 2
 35 
 36 static jvmtiEnv *jvmti = NULL;
 37 static jvmtiCapabilities caps;
 38 static jvmtiEventCallbacks callbacks;
 39 static jmethodID mid;
 40 static frame_info expected_platform_frames[] = {
 41     {"Lgetstacktr06$TestThread;", "chain4", "()V"},
 42     {"Lgetstacktr06$TestThread;", "chain3", "()V"},
 43     {"Lgetstacktr06$TestThread;", "chain2", "()V"},
 44     {"Lgetstacktr06$TestThread;", "chain1", "()V"},
 45     {"Lgetstacktr06$TestThread;", "run", "()V"},

 46     {"Ljava/lang/Thread;", "run", "()V"},
 47 };
 48 
 49 static frame_info expected_virtual_frames[] = {
 50     {"Lgetstacktr06$TestThread;", "chain4", "()V"},
 51     {"Lgetstacktr06$TestThread;", "chain3", "()V"},
 52     {"Lgetstacktr06$TestThread;", "chain2", "()V"},
 53     {"Lgetstacktr06$TestThread;", "chain1", "()V"},
 54     {"Lgetstacktr06$TestThread;", "run", "()V"},

 55     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 56     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 57     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 58     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 59     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 60 };
 61 
 62 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID method, jlocation location) {
 63   if (mid != method) {
 64     jni->FatalError("ERROR: didn't know where we got called from");
 65   }
 66 
 67   check_jvmti_status(jni, jvmti->ClearBreakpoint(mid, 0), "ClearBreakpoint failed.");
 68   set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, NULL);
 69 
 70   set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr);
 71   LOG(">>> popping frame ...\n");
 72   check_jvmti_status(jni, jvmti->PopFrame(thr), "PopFrame failed");
 73 }
 74 

 26 #include "jvmti.h"
 27 #include "jvmti_common.h"
 28 #include "../get_stack_trace.h"
 29 
 30 
 31 extern "C" {
 32 
 33 #define PASSED 0
 34 #define STATUS_FAILED 2
 35 
 36 static jvmtiEnv *jvmti = NULL;
 37 static jvmtiCapabilities caps;
 38 static jvmtiEventCallbacks callbacks;
 39 static jmethodID mid;
 40 static frame_info expected_platform_frames[] = {
 41     {"Lgetstacktr06$TestThread;", "chain4", "()V"},
 42     {"Lgetstacktr06$TestThread;", "chain3", "()V"},
 43     {"Lgetstacktr06$TestThread;", "chain2", "()V"},
 44     {"Lgetstacktr06$TestThread;", "chain1", "()V"},
 45     {"Lgetstacktr06$TestThread;", "run", "()V"},
 46     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 47     {"Ljava/lang/Thread;", "run", "()V"},
 48 };
 49 
 50 static frame_info expected_virtual_frames[] = {
 51     {"Lgetstacktr06$TestThread;", "chain4", "()V"},
 52     {"Lgetstacktr06$TestThread;", "chain3", "()V"},
 53     {"Lgetstacktr06$TestThread;", "chain2", "()V"},
 54     {"Lgetstacktr06$TestThread;", "chain1", "()V"},
 55     {"Lgetstacktr06$TestThread;", "run", "()V"},
 56     {"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 57     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 58     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 59     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda;", "run", "()V"},
 60     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 61     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"},
 62 };
 63 
 64 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID method, jlocation location) {
 65   if (mid != method) {
 66     jni->FatalError("ERROR: didn't know where we got called from");
 67   }
 68 
 69   check_jvmti_status(jni, jvmti->ClearBreakpoint(mid, 0), "ClearBreakpoint failed.");
 70   set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, NULL);
 71 
 72   set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr);
 73   LOG(">>> popping frame ...\n");
 74   check_jvmti_status(jni, jvmti->PopFrame(thr), "PopFrame failed");
 75 }
 76 
< prev index next >