test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp
changeset 53074 1e213c37befa
parent 52495 52be2c714a2f
equal deleted inserted replaced
53073:11033c4ada54 53074:1e213c37befa
   100                TranslateError(err), err);
   100                TranslateError(err), err);
   101         tot_result = STATUS_FAILED;
   101         tot_result = STATUS_FAILED;
   102     }
   102     }
   103 
   103 
   104     switch (t_case) {
   104     switch (t_case) {
   105 /* NULL pointer to the thread in debug mode */
   105     /* NULL pointer to the thread*/
   106     case 1:
   106     case 1:
   107         printf("\nInvoke PopFrame() with NULL pointer to a thread...\n");
   107         printf("\nInvoke PopFrame() with NULL pointer to a thread...\n");
   108         fflush(stdout);
   108         fflush(stdout);
   109         // fallthrough
       
   110 /* NULL pointer to the thread */
       
   111     case 0:
       
   112         set_watch_ev(1); /* watch JVMTI events */
   109         set_watch_ev(1); /* watch JVMTI events */
   113         err = (jvmti->PopFrame(NULL)); /* explode the bomb */
   110         err = (jvmti->PopFrame(NULL)); /* explode the bomb */
   114         if (err != JVMTI_ERROR_INVALID_THREAD) {
   111         if (err != JVMTI_ERROR_INVALID_THREAD) {
   115             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   112             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   116                 err, TranslateError(err));
   113                 err, TranslateError(err));
   117             printf("\tBut it should return the error JVMTI_ERROR_INVALID_THREAD.\n");
   114             printf("\tBut it should return the error JVMTI_ERROR_INVALID_THREAD.\n");
   118             tot_result = STATUS_FAILED;
   115             tot_result = STATUS_FAILED;
   119         }
   116         }
   120         break;
   117         break;
   121 /* invalid thread in debug mode */
   118     /* invalid thread */
   122     case 3:
   119     case 2:
   123         printf("\nInvoke PopFrame() for an invalid thread...\n");
   120         printf("\nInvoke PopFrame() for an invalid thread...\n");
   124         fflush(stdout);
   121         fflush(stdout);
   125         // fallthrough
       
   126 /* invalid thread */
       
   127     case 2:
       
   128         set_watch_ev(1); /* watch JVMTI events */
   122         set_watch_ev(1); /* watch JVMTI events */
   129         err = (jvmti->PopFrame(cls)); /* explode the bomb */
   123         err = (jvmti->PopFrame(cls)); /* explode the bomb */
   130         set_watch_ev(0); /* ignore again JVMTI events */
   124         set_watch_ev(0); /* ignore again JVMTI events */
   131         if (err != JVMTI_ERROR_INVALID_THREAD) {
   125         if (err != JVMTI_ERROR_INVALID_THREAD) {
   132             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   126             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   133                 err, TranslateError(err));
   127                 err, TranslateError(err));
   134             printf("\tBut it should return the error JVMTI_ERROR_INVALID_THREAD.\n");
   128             printf("\tBut it should return the error JVMTI_ERROR_INVALID_THREAD.\n");
   135             tot_result = STATUS_FAILED;
   129             tot_result = STATUS_FAILED;
   136         }
   130         }
   137         break;
   131         break;
   138 /* non suspended thread in debug mode */
   132     /* non suspended thread */
   139     case 5:
   133     case 3:
   140         printf("\nInvoke PopFrame() for a non suspended thread...\n");
   134         printf("\nInvoke PopFrame() for a non suspended thread...\n");
   141         fflush(stdout);
   135         fflush(stdout);
   142         // fallthrough
       
   143 /* non suspended thread */
       
   144     case 4:
       
   145         set_watch_ev(1); /* watch JVMTI events */
   136         set_watch_ev(1); /* watch JVMTI events */
   146         err = (jvmti->PopFrame(frameThr)); /* explode the bomb */
   137         err = (jvmti->PopFrame(frameThr)); /* explode the bomb */
   147         set_watch_ev(0); /* ignore again JVMTI events */
   138         set_watch_ev(0); /* ignore again JVMTI events */
   148         if (err != JVMTI_ERROR_THREAD_NOT_SUSPENDED) {
   139         if (err != JVMTI_ERROR_THREAD_NOT_SUSPENDED) {
   149             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   140             printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n",
   150                 err, TranslateError(err));
   141                 err, TranslateError(err));
   151             printf("\tBut it should return the error JVMTI_ERROR_THREAD_NOT_SUSPENDED.\n");
   142             printf("\tBut it should return the error JVMTI_ERROR_THREAD_NOT_SUSPENDED.\n");
   152             tot_result = STATUS_FAILED;
   143             tot_result = STATUS_FAILED;
   153         }
   144         }
   154         break;
   145         break;
       
   146     default:
       
   147         printf("\nTEST ERROR: unexpected case: %lld\n", (long long)t_case);
       
   148 
   155     }
   149     }
   156 
   150 
   157     if (gen_ev) {
   151     if (gen_ev) {
   158         printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
   152         printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
   159             gen_ev);
   153             gen_ev);