test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java
changeset 51583 ad2224d4f346
parent 50018 3ba0d8631f24
equal deleted inserted replaced
51582:18ca918b4ed9 51583:ad2224d4f346
    46  * EVENT_THREAD, and ALL, for MethodExitEvent sets.             <BR>
    46  * EVENT_THREAD, and ALL, for MethodExitEvent sets.             <BR>
    47  * <BR>
    47  * <BR>
    48  * To check up on the method, a debugger,                       <BR>
    48  * To check up on the method, a debugger,                       <BR>
    49  * upon getting new set for the EventSet,                       <BR>
    49  * upon getting new set for the EventSet,                       <BR>
    50  * suspends VM with the method VirtualMachine.suspend(),        <BR>
    50  * suspends VM with the method VirtualMachine.suspend(),        <BR>
    51  * gets the List of geduggee's threads calling VM.allThreads(), <BR>
    51  * gets the List of debuggee's threads calling VM.allThreads(), <BR>
    52  * invokes the method EventSet.resume(), and                    <BR>
    52  * invokes the method EventSet.resume(), and                    <BR>
    53  * gets another List of geduggee's threads.                     <BR>
    53  * gets another List of debuggee's threads.                     <BR>
    54  * The debugger then compares values of                         <BR>
    54  * The debugger then compares values of                         <BR>
    55  * each thread's suspendCount from first and second Lists.      <BR>
    55  * each thread's suspendCount from first and second Lists.      <BR>
    56  * <BR>
    56  * <BR>
    57  * The test has three phases and works as follows.              <BR>
    57  * The test has three phases and works as follows.              <BR>
    58  * <BR>
    58  * <BR>
    85  * <BR>
    85  * <BR>
    86  */
    86  */
    87 
    87 
    88 public class resume007 {
    88 public class resume007 {
    89 
    89 
    90     //----------------------------------------------------- templete section
    90     //----------------------------------------------------- template section
    91     static final int PASSED = Consts.TEST_PASSED;
    91     static final int PASSED = Consts.TEST_PASSED;
    92     static final int FAILED = Consts.TEST_FAILED;
    92     static final int FAILED = Consts.TEST_FAILED;
    93     static final int PASS_BASE = Consts.JCK_STATUS_BASE;
    93     static final int PASS_BASE = Consts.JCK_STATUS_BASE;
    94 
    94 
    95     //----------------------------------------------------- templete parameters
    95     //----------------------------------------------------- template parameters
    96     static final String
    96     static final String
    97     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ",
    97     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ",
    98     sHeader2 = "--> debugger: ",
    98     sHeader2 = "--> debugger: ",
    99     sHeader3 = "##> debugger: ";
    99     sHeader3 = "##> debugger: ";
   100 
   100 
   488                         eventRequest3.disable();
   488                         eventRequest3.disable();
   489                         break;
   489                         break;
   490 
   490 
   491                   default: throw new JDITestRuntimeException("** default case 1 **");
   491                   default: throw new JDITestRuntimeException("** default case 1 **");
   492                 }
   492                 }
       
   493                 informDebuggeeTestCase(i);
   493             }
   494             }
   494 
   495 
   495             log2("......--> vm.resume()");
   496             log2("......--> vm.resume()");
   496             vm.resume();
   497             vm.resume();
   497             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   498             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   629             log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e);
   630             log3("ERROR: ATTENTION: Exception within settingMethodExitRequest() : " + e);
   630             log3("       MethodExitRequest HAS NOT BEEN SET UP");
   631             log3("       MethodExitRequest HAS NOT BEEN SET UP");
   631             throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **");
   632             throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **");
   632         }
   633         }
   633     }
   634     }
   634 
   635     /**
       
   636      * Inform debuggee which thread test the debugger has completed.
       
   637      * Used for synchronization, so the debuggee does not move too quickly.
       
   638      * @param testCase index of just completed test
       
   639      */
       
   640     void informDebuggeeTestCase(int testCase) {
       
   641         try {
       
   642             ((ClassType)debuggeeClass)
       
   643                 .setValue(debuggeeClass.fieldByName("testCase"),
       
   644                           vm.mirrorOf(testCase));
       
   645         } catch (InvalidTypeException ite) {
       
   646             throw new Failure("** FAILURE setting testCase  **");
       
   647         } catch (ClassNotLoadedException cnle) {
       
   648             throw new Failure("** FAILURE notifying debuggee  **");
       
   649         } catch (VMDisconnectedException e) {
       
   650             throw new Failure("** FAILURE debuggee connection **");
       
   651         }
       
   652     }
   635 }
   653 }