< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp

Print this page

 21  * questions.
 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 jmethodID mid;
 34 static frame_info expected_platform_frames[] = {
 35     {"Lgetstacktr04$TestThread;", "checkPoint", "()V"},
 36     {"Lgetstacktr04$TestThread;", "chain4", "()V"},
 37     {"Lgetstacktr04$TestThread;", "chain3", "()V"},
 38     {"Lgetstacktr04$TestThread;", "chain2", "()V"},
 39     {"Lgetstacktr04$TestThread;", "chain1", "()V"},
 40     {"Lgetstacktr04$TestThread;", "run", "()V"},

 41     {"Ljava/lang/Thread;", "run", "()V"},
 42 };
 43 
 44 static frame_info expected_virtual_frames[] = {
 45     {"Lgetstacktr04$TestThread;", "checkPoint", "()V"},
 46     {"Lgetstacktr04$TestThread;", "chain4", "()V"},
 47     {"Lgetstacktr04$TestThread;", "chain3", "()V"},
 48     {"Lgetstacktr04$TestThread;", "chain2", "()V"},
 49     {"Lgetstacktr04$TestThread;", "chain1", "()V"},
 50     {"Lgetstacktr04$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 
 60 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni,
 61                         jthread thread, jmethodID method, jlocation location) {
 62   frame_info *expected_frames = jni->IsVirtualThread(thread)
 63       ? expected_virtual_frames
 64       : expected_platform_frames;
 65   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)
 66       ? ((int) (sizeof(expected_virtual_frames) / sizeof(frame_info)))
 67       : ((int) (sizeof(expected_platform_frames) / sizeof(frame_info)));
 68 
 69   if (mid != method) {
 70     jni->FatalError("ERROR: didn't know where we got called from");

 21  * questions.
 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 jmethodID mid;
 34 static frame_info expected_platform_frames[] = {
 35     {"Lgetstacktr04$TestThread;", "checkPoint", "()V"},
 36     {"Lgetstacktr04$TestThread;", "chain4", "()V"},
 37     {"Lgetstacktr04$TestThread;", "chain3", "()V"},
 38     {"Lgetstacktr04$TestThread;", "chain2", "()V"},
 39     {"Lgetstacktr04$TestThread;", "chain1", "()V"},
 40     {"Lgetstacktr04$TestThread;", "run", "()V"},
 41     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 42     {"Ljava/lang/Thread;", "run", "()V"},
 43 };
 44 
 45 static frame_info expected_virtual_frames[] = {
 46     {"Lgetstacktr04$TestThread;", "checkPoint", "()V"},
 47     {"Lgetstacktr04$TestThread;", "chain4", "()V"},
 48     {"Lgetstacktr04$TestThread;", "chain3", "()V"},
 49     {"Lgetstacktr04$TestThread;", "chain2", "()V"},
 50     {"Lgetstacktr04$TestThread;", "chain1", "()V"},
 51     {"Lgetstacktr04$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 
 62 void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni,
 63                         jthread thread, jmethodID method, jlocation location) {
 64   frame_info *expected_frames = jni->IsVirtualThread(thread)
 65       ? expected_virtual_frames
 66       : expected_platform_frames;
 67   int expected_number_of_stack_frames = jni->IsVirtualThread(thread)
 68       ? ((int) (sizeof(expected_virtual_frames) / sizeof(frame_info)))
 69       : ((int) (sizeof(expected_platform_frames) / sizeof(frame_info)));
 70 
 71   if (mid != method) {
 72     jni->FatalError("ERROR: didn't know where we got called from");
< prev index next >