< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp

Print this page
rev 52185 : [mq]: refactor

*** 60,80 **** jthread* threads = NULL; jvmtiError* results = NULL; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)), (unsigned char**)&threads))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads); NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jvmtiError)), (unsigned char**)&results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads); --- 60,78 ---- jthread* threads = NULL; jvmtiError* results = NULL; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); ! if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jthread)), (unsigned char**)&threads))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads); NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount); ! if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jvmtiError)), (unsigned char**)&results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... allocated array: %p\n", (void*)threads);
*** 82,93 **** NSK_DISPLAY1("Find threads: %d threads\n", threadsCount); if (!NSK_VERIFY(fillThreadsByName(jvmti, jni, THREAD_NAME, threadsCount, threads))) return; NSK_DISPLAY0("Suspend threads list\n"); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount, threads, results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Check threads results:\n"); --- 80,90 ---- NSK_DISPLAY1("Find threads: %d threads\n", threadsCount); if (!NSK_VERIFY(fillThreadsByName(jvmti, jni, THREAD_NAME, threadsCount, threads))) return; NSK_DISPLAY0("Suspend threads list\n"); ! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threads, results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Check threads results:\n");
*** 105,116 **** NSK_DISPLAY0("Get state vector for each thread\n"); for (i = 0; i < threadsCount; i++) { jint state = 0; NSK_DISPLAY2(" thread #%d (%p):\n", i, (void*)threads[i]); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetThreadState, jvmti, threads[i], &state))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY2(" ... got state vector: %s (%d)\n", TranslateState(state), (int)state); --- 102,112 ---- NSK_DISPLAY0("Get state vector for each thread\n"); for (i = 0; i < threadsCount; i++) { jint state = 0; NSK_DISPLAY2(" thread #%d (%p):\n", i, (void*)threads[i]); ! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threads[i], &state))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY2(" ... got state vector: %s (%d)\n", TranslateState(state), (int)state);
*** 121,132 **** nsk_jvmti_setFailStatus(); } } NSK_DISPLAY0("Resume threads list\n"); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount, threads, results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Wait for thread to finish\n"); --- 117,127 ---- nsk_jvmti_setFailStatus(); } } NSK_DISPLAY0("Resume threads list\n"); ! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threads, results))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Wait for thread to finish\n");
*** 134,155 **** return; NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { if (threads[i] != NULL) ! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threads[i])); } NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY0("Let debugee to finish\n"); --- 129,148 ---- return; NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { if (threads[i] != NULL) ! NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads); ! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results); ! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY0("Let debugee to finish\n");
*** 171,192 **** for (i = 0; i < foundCount; i++) { foundThreads[i] = NULL; } ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetAllThreads, jvmti, &count, &threads))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } found = 0; for (i = 0; i < count; i++) { jvmtiThreadInfo info; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) { nsk_jvmti_setFailStatus(); break; } if (info.name != NULL && strncmp(name, info.name, len) == 0) { --- 164,183 ---- for (i = 0; i < foundCount; i++) { foundThreads[i] = NULL; } ! if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } found = 0; for (i = 0; i < count; i++) { jvmtiThreadInfo info; ! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) { nsk_jvmti_setFailStatus(); break; } if (info.name != NULL && strncmp(name, info.name, len) == 0) {
*** 197,208 **** found++; } } ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } if (found != foundCount) { --- 188,198 ---- found++; } } ! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } if (found != foundCount) {
*** 216,226 **** } NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) ! NSK_CPP_STUB2(NewGlobalRef, jni, foundThreads[i])) != NULL)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY2(" ... thread #%d: %p\n", i, foundThreads[i]); } --- 206,216 ---- } NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) ! jni->NewGlobalRef(foundThreads[i])) != NULL)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY2(" ... thread #%d: %p\n", i, foundThreads[i]); }
*** 264,275 **** /* add specific capabilities for suspending thread */ { jvmtiCapabilities suspendCaps; memset(&suspendCaps, 0, sizeof(suspendCaps)); suspendCaps.can_suspend = 1; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps))) return JNI_ERR; } /* register agent proc and arg */ if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) --- 254,264 ---- /* add specific capabilities for suspending thread */ { jvmtiCapabilities suspendCaps; memset(&suspendCaps, 0, sizeof(suspendCaps)); suspendCaps.can_suspend = 1; ! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps))) return JNI_ERR; } /* register agent proc and arg */ if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
< prev index next >