< prev index next >

src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c

Print this page




 520 
 521     return JNI_TRUE;
 522 }
 523 
 524 static jboolean
 525 getAllThreads(PacketInputStream *in, PacketOutputStream *out)
 526 {
 527     JNIEnv *env;
 528 
 529     if (gdata->vmDead) {
 530         outStream_setError(out, JDWP_ERROR(VM_DEAD));
 531         return JNI_TRUE;
 532     }
 533 
 534     env = getEnv();
 535 
 536     WITH_LOCAL_REFS(env, 1) {
 537 
 538         int i;
 539         jint threadCount;

 540         jthread *theThreads;

 541 
 542         theThreads = allThreads(&threadCount);
 543         if (theThreads == NULL) {


 544             outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
 545         } else {
 546             /* Squish out all of the debugger-spawned threads */
 547             threadCount = filterDebugThreads(theThreads, threadCount);
 548 
 549             (void)outStream_writeInt(out, threadCount);
 550             for (i = 0; i <threadCount; i++) {



 551                 (void)outStream_writeObjectRef(env, out, theThreads[i]);
 552             }
 553 
 554             jvmtiDeallocate(theThreads);

 555         }
 556 
 557     } END_WITH_LOCAL_REFS(env);
 558 
 559     return JNI_TRUE;
 560 }
 561 
 562 static jboolean
 563 topLevelThreadGroups(PacketInputStream *in, PacketOutputStream *out)
 564 {
 565     JNIEnv *env;
 566 
 567     if (gdata->vmDead) {
 568         outStream_setError(out, JDWP_ERROR(VM_DEAD));
 569         return JNI_TRUE;
 570     }
 571 
 572     env = getEnv();
 573 
 574     WITH_LOCAL_REFS(env, 1) {




 520 
 521     return JNI_TRUE;
 522 }
 523 
 524 static jboolean
 525 getAllThreads(PacketInputStream *in, PacketOutputStream *out)
 526 {
 527     JNIEnv *env;
 528 
 529     if (gdata->vmDead) {
 530         outStream_setError(out, JDWP_ERROR(VM_DEAD));
 531         return JNI_TRUE;
 532     }
 533 
 534     env = getEnv();
 535 
 536     WITH_LOCAL_REFS(env, 1) {
 537 
 538         int i;
 539         jint threadCount;
 540         jint fiberCount;
 541         jthread *theThreads;
 542         jthread *theFibers;
 543 
 544         theThreads = allThreads(&threadCount);
 545         theFibers = threadControl_allFibers(&fiberCount);
 546 
 547         if (theThreads == NULL || (theFibers == NULL && fiberCount != 0)) {
 548             outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
 549         } else {
 550             /* Squish out all of the debugger-spawned threads */
 551             threadCount = filterDebugThreads(theThreads, threadCount);
 552 
 553             (void)outStream_writeInt(out, threadCount + fiberCount);
 554             for (i = 0; i < fiberCount; i++) {
 555                 (void)outStream_writeObjectRef(env, out, theFibers[i]);
 556             }
 557             for (i = 0; i < threadCount; i++) {
 558                 (void)outStream_writeObjectRef(env, out, theThreads[i]);
 559             }
 560 
 561             jvmtiDeallocate(theThreads);
 562             jvmtiDeallocate(theFibers);
 563         }
 564 
 565     } END_WITH_LOCAL_REFS(env);
 566 
 567     return JNI_TRUE;
 568 }
 569 
 570 static jboolean
 571 topLevelThreadGroups(PacketInputStream *in, PacketOutputStream *out)
 572 {
 573     JNIEnv *env;
 574 
 575     if (gdata->vmDead) {
 576         outStream_setError(out, JDWP_ERROR(VM_DEAD));
 577         return JNI_TRUE;
 578     }
 579 
 580     env = getEnv();
 581 
 582     WITH_LOCAL_REFS(env, 1) {


< prev index next >