< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp

Print this page

 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 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 frame_info expected_platform_frames[] = {
 34     {"Ljava/lang/Object;", "wait", "()V"},
 35     {"Lgetstacktr03;", "dummy", "()V"},
 36     {"Lgetstacktr03;", "chain", "()V"},
 37     {"Lgetstacktr03$Task;", "run", "()V"},
 38     {"Ljava/lang/Thread;", "run", "()V"}

 39 };
 40 
 41 static frame_info expected_virtual_frames[] = {
 42     {"Ljava/lang/Object;", "wait", "()V"},
 43     {"Lgetstacktr03;", "dummy", "()V"},
 44     {"Lgetstacktr03;", "chain", "()V"},
 45     {"Lgetstacktr03$Task;", "run", "()V"},

 46     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 47     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 48     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda$31.0x0000000800098810;", "run", "()V"},
 49     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 50     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"}
 51 };
 52 
 53 JNIEXPORT jint JNICALL
 54 Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
 55   jvmtiError err;
 56   jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
 57   if (res != JNI_OK || jvmti == NULL) {
 58     LOG("Wrong result of a valid call to GetEnv!\n");
 59     return JNI_ERR;
 60   }
 61 
 62   jvmtiCapabilities caps;
 63   memset(&caps, 0, sizeof(caps));
 64   caps.can_suspend = 1;
 65 

 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 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 frame_info expected_platform_frames[] = {
 34     {"Ljava/lang/Object;", "wait", "()V"},
 35     {"Lgetstacktr03;", "dummy", "()V"},
 36     {"Lgetstacktr03;", "chain", "()V"},
 37     {"Lgetstacktr03$Task;", "run", "()V"},
 38     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 39     {"Ljava/lang/Thread;", "run", "()V"},
 40 };
 41 
 42 static frame_info expected_virtual_frames[] = {
 43     {"Ljava/lang/Object;", "wait", "()V"},
 44     {"Lgetstacktr03;", "dummy", "()V"},
 45     {"Lgetstacktr03;", "chain", "()V"},
 46     {"Lgetstacktr03$Task;", "run", "()V"},
 47     {"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
 48     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
 49     {"Ljava/lang/VirtualThread$VThreadContinuation;", "lambda$new$0", "(Ljava/lang/VirtualThread;Ljava/lang/Runnable;)V"},
 50     {"Ljava/lang/VirtualThread$VThreadContinuation$$Lambda$31.0x0000000800098810;", "run", "()V"},
 51     {"Ljdk/internal/vm/Continuation;", "enter0", "()V"},
 52     {"Ljdk/internal/vm/Continuation;", "enter", "(Ljdk/internal/vm/Continuation;Z)V"}
 53 };
 54 
 55 JNIEXPORT jint JNICALL
 56 Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
 57   jvmtiError err;
 58   jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
 59   if (res != JNI_OK || jvmti == NULL) {
 60     LOG("Wrong result of a valid call to GetEnv!\n");
 61     return JNI_ERR;
 62   }
 63 
 64   jvmtiCapabilities caps;
 65   memset(&caps, 0, sizeof(caps));
 66   caps.can_suspend = 1;
 67 
< prev index next >