Skip to content
Permalink
Browse files
jvmti test function print_thread_info() updated with correct argument…
…s order
  • Loading branch information
lmesnik committed Mar 4, 2021
1 parent 22e48c0 commit c1f4a69ebdc95bcfde59a34bd03102f99be5617c
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
@@ -122,7 +122,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) {
i = findSig(sig, 1);
if (i != -1) {
jboolean is_virtual_thread = jni->IsVirtualThread(thread);
print_thread_info(jni, jvmti, thread);
print_thread_info(jvmti, jni, thread);
if (is_virtual_thread != expThreadIsVirtual[i]) {
printf("TEST FAILED: IsVirtualThread(thread) is not expected: %d\n", is_virtual_thread);
result = STATUS_FAILED;
@@ -148,7 +148,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls)
printf(">>> [class prepare event #%" PRIuPTR "]", eventsCount);
printf(" \"%s\"\n", inf.sig);
printf(">>> Got ClassPrep event in thread.\n");
print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);
printf(">>> status: ");
printStatus(inf.status);
printf(">>> %d methods:", inf.mcount);
@@ -322,7 +322,7 @@ Java_classprep01_getReady(JNIEnv *jni, jclass cls) {
eventsExpected = sizeof(kernel_classes)/sizeof(class_info);
}
printf("Requesting enabling JVMTI_EVENT_CLASS_PREPARE in thread.\n");
print_thread_info(jni, jvmti, prep_thread);
print_thread_info(jvmti, jni, prep_thread);

err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_CLASS_PREPARE, prep_thread);
@@ -350,7 +350,7 @@ Java_classprep01_check(JNIEnv *jni, jclass cls) {
}

printf("Requesting disabling JVMTI_EVENT_CLASS_PREPARE in thread.\n");
print_thread_info(jni, jvmti, prep_thread);
print_thread_info(jvmti, jni, prep_thread);

err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,
JVMTI_EVENT_CLASS_PREPARE, prep_thread);
@@ -107,7 +107,7 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodI
printf(">>> class: \"%s\"\n", cls_sig);
printf(">>> method: \"%s%s\"\n", name, sig);
printf(">>> location: 0x%x%08x\n", (jint)(loc >> 32), (jint)loc);
print_thread_info(jni, jvmti, thread_obj);
print_thread_info(jvmti, jni, thread_obj);
printf(">>> ... done\n");

if (eventsCount < sizeof(pops)/sizeof(pop_info)) {
@@ -51,7 +51,7 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) {

printf("MonitorContendedEnter event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object);

print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);

if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
@@ -50,7 +50,7 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj)

printf("MonitorContendedEntered event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object);

print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);

if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
@@ -72,7 +72,7 @@ void JNICALL
MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) {

printf("MonitorContendedEnter event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object);
print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);

if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
@@ -49,7 +49,7 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout)

printf("MonitorWait event:\n\tthread: %p, object: %p, timeout: %d\n", thr, obj, (int) tout);

print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);

if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
@@ -51,7 +51,7 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni,
NSK_DISPLAY3("MonitorWaited event:\n\tthread: %p, object: %p, timed_out: %s\n",
thr, obj, (timed_out == JNI_TRUE) ? "true" : "false");

print_thread_info(jni, jvmti, thr);
print_thread_info(jvmti, jni, thr);

if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
@@ -147,7 +147,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,

NSK_DISPLAY0(">>>> SingleStep event received\n");

print_thread_info(jni, jvmti, thread);
print_thread_info(jvmti, jni, thread);

err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
if (err != JVMTI_ERROR_NONE) {
@@ -52,7 +52,7 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
result = STATUS_FAILED;
}

print_thread_info(jni, jvmti, thread);
print_thread_info(jvmti, jni, thread);

if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) {
eventsCount++;
@@ -41,7 +41,7 @@ static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
check_jvmti_status(jni, err, "GetStackTrace returns error.");
if (count < 0) {
printf("Stacktrace in virtual thread is incorrect.\n");
print_thread_info(jni, jvmti, vthread);
print_thread_info(jvmti, jni, vthread);
print_stack_trace_frames(jvmti, jni, count, frames);
fatal(jni, "Incorrect frame count.");
}
@@ -41,7 +41,7 @@ static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
check_jvmti_status(jni, err, "GetStackTrace returns error.");
if (count <= 0) {
printf("Stacktrace in virtual thread is incorrect.\n");
print_thread_info(jni, jvmti, vthread);
print_thread_info(jvmti, jni, vthread);
print_stack_trace_frames(jvmti, jni, count, frames);
fatal(jni, "Incorrect frame count.");
}
@@ -82,8 +82,8 @@ void check_link_consistency(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {

if ( !(vstate & JVMTI_THREAD_STATE_SUSPENDED) || (cstate & JVMTI_THREAD_STATE_SUSPENDED)) {
printf("Incorrect state of threads: \n");
print_thread_info(jni, jvmti, vthread);
print_thread_info(jni, jvmti, cthread);
print_thread_info(jvmti, jni, vthread);
print_thread_info(jvmti, jni, cthread);
// TODO uncomment fatal(jni, "");
}

@@ -92,18 +92,18 @@ void check_link_consistency(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
err = jvmti->GetVirtualThread(cthread, &cthread_to_vthread);
if (err != JVMTI_ERROR_NONE) {
printf("Error %s in GetVirtualThread :\n", TranslateError(err));
print_thread_info(jni, jvmti, vthread);
print_thread_info(jni, jvmti, cthread);
print_thread_info(jvmti, jni, vthread);
print_thread_info(jvmti, jni, cthread);
fatal(jni, "");
}
if (!jni->IsSameObject(vthread, cthread_to_vthread)) {
printf("GetVirtualThread(GetCarrierThread(vthread)) not equals to vthread.\n");
printf("Result: ");
print_thread_info(jni, jvmti, cthread_to_vthread);
print_thread_info(jvmti, jni, cthread_to_vthread);
printf("Expected: ");
print_thread_info(jni, jvmti, vthread);
print_thread_info(jvmti, jni, vthread);
printf("Carrier: ");
print_thread_info(jni, jvmti, cthread);
print_thread_info(jvmti, jni, cthread);
// fatal(jni, "GetVirtualThread(GetCarrierThread(vthread)) not equals to vthread.");
}
}
@@ -62,7 +62,7 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons
if (storage->self_pointer != storage || (strcmp(thread_info.name, storage->data) != 0)) {
printf("Unexpected value in storage storage=%p, the self_pointer=%p, data (owner thread name): %s\n",
storage, storage->self_pointer, storage->data);
print_thread_info(jni, jvmti, thread);
print_thread_info(jvmti, jni, thread);
jni->FatalError("Incorrect value in storage.");
}
return storage;
@@ -180,7 +180,7 @@ print_method(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method, jint depth) {
fflush(0);
}

void print_thread_info(JNIEnv* jni, jvmtiEnv *jvmti, jthread thread_obj) {
void print_thread_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread_obj) {
jvmtiThreadInfo thread_info;
jint thread_state;
check_jvmti_status(jni, jvmti->GetThreadInfo(thread_obj, &thread_info), "Error in GetThreadInfo");

0 comments on commit c1f4a69

Please sign in to comment.