< prev index next >

test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp

Print this page

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 
31 extern "C" {
32 
33 static jvmtiEnv *jvmti = NULL;
34 static frame_info expected_virtual_frames[] = {
35     {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"},
36     {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"},
37     {"LGetStackTraceCurrentThreadTest;", "chain", "()V"},
38     {"LTask;", "run", "()V"},
39     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"}

40 };
41 
42 static frame_info expected_platform_frames[] = {
43     {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"},
44     {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"},
45     {"LGetStackTraceCurrentThreadTest;", "chain", "()V"},
46     {"LTask;", "run", "()V"},
47     {"Ljava/lang/Thread;", "run", "()V"}

48 };
49 
50 JNIEXPORT jint JNICALL
51 Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
52   jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
53   if (res != JNI_OK || jvmti == NULL) {
54     printf("Wrong result of a valid call to GetEnv!\n");
55     return JNI_ERR;
56   }
57   return JNI_OK;
58 }
59 
60 JNIEXPORT void JNICALL
61 Java_GetStackTraceCurrentThreadTest_chain(JNIEnv *env, jclass cls) {
62   jmethodID mid = env->GetStaticMethodID(cls, "dummy", "()V");
63   env->CallStaticVoidMethod(cls, mid);
64 }
65 
66 JNIEXPORT void JNICALL
67 Java_GetStackTraceCurrentThreadTest_check(JNIEnv *jni, jclass cls, jthread thread) {

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 
31 extern "C" {
32 
33 static jvmtiEnv *jvmti = NULL;
34 static frame_info expected_virtual_frames[] = {
35     {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"},
36     {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"},
37     {"LGetStackTraceCurrentThreadTest;", "chain", "()V"},
38     {"LTask;", "run", "()V"},
39     {"Ljava/lang/VirtualThread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
40     {"Ljava/lang/VirtualThread;", "run", "(Ljava/lang/Runnable;)V"},
41 };
42 
43 static frame_info expected_platform_frames[] = {
44     {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"},
45     {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"},
46     {"LGetStackTraceCurrentThreadTest;", "chain", "()V"},
47     {"LTask;", "run", "()V"},
48     {"Ljava/lang/Thread;", "runWith", "(Ljava/lang/Object;Ljava/lang/Runnable;)V"},
49     {"Ljava/lang/Thread;", "run", "()V"},
50 };
51 
52 JNIEXPORT jint JNICALL
53 Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
54   jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
55   if (res != JNI_OK || jvmti == NULL) {
56     printf("Wrong result of a valid call to GetEnv!\n");
57     return JNI_ERR;
58   }
59   return JNI_OK;
60 }
61 
62 JNIEXPORT void JNICALL
63 Java_GetStackTraceCurrentThreadTest_chain(JNIEnv *env, jclass cls) {
64   jmethodID mid = env->GetStaticMethodID(cls, "dummy", "()V");
65   env->CallStaticVoidMethod(cls, mid);
66 }
67 
68 JNIEXPORT void JNICALL
69 Java_GetStackTraceCurrentThreadTest_check(JNIEnv *jni, jclass cls, jthread thread) {
< prev index next >