8170089: nsk/jdi/EventSet/resume/resume008: ERROR: suspendCounts don't match for : Common-Cleaner
authorgadams
Tue, 28 Aug 2018 08:06:59 -0400
changeset 51583 ad2224d4f346
parent 51582 18ca918b4ed9
child 51584 d395677d99f3
8170089: nsk/jdi/EventSet/resume/resume008: ERROR: suspendCounts don't match for : Common-Cleaner Reviewed-by: cjplummer, sspitsyn
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java
test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001.java	Tue Aug 28 08:06:59 2018 -0400
@@ -50,9 +50,9 @@
  * To check up on the method, a debugger,
  * upon getting new set for ClassPrepareEvent,
  * suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
  * invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
  * The debugger then compares values of
  * each thread's suspendCount from first and second Lists.
  *
@@ -63,6 +63,13 @@
  *   making special clases loaded and prepared to create the Events
  * - Upon getting the Events,
  *   the debugger performs the check required.
+ * - The debugger informs the debuggee when it completes
+ *   each test case, so it will wait before hitting
+ *   communication breakpoints.
+ *   This prevents the breakpoint SUSPEND_ALL policy
+ *   disrupting the first test case check for
+ *   SUSPEND_NONE, if the debuggee gets ahead of
+ *   the debugger processing.
  */
 
 public class resume001 extends TestDebuggerType1 {
@@ -233,6 +240,7 @@
 
                      default: throw new Failure("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             display("......--> vm.resume()");
@@ -261,5 +269,22 @@
             throw new Failure("** FAILURE to set up ClassPrepareRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume001a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume001a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -57,6 +57,7 @@
 
     static int exitCode = PASSED;
 
+    static int testCase    = -1;
     static int instruction = 1;
     static int end         = 0;
                                    //    static int quit        = 0;
@@ -100,6 +101,10 @@
 
                 case 0:
                 TestClass2 obj2 = new TestClass2();
+                // Wait for debugger to complete the first test case
+                // before advancing to the first breakpoint
+                waitForTestCase(0);
+
                 break;
 
                 case 1:
@@ -119,6 +124,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class TestClass2 {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume002 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume002 ",
     sHeader2 = "--> debugger: ",
@@ -503,6 +503,7 @@
 
             log2("......--> vm.resume()");
             vm.resume();
+            informDebuggeeTestCase(i);
             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         }
         log1("    TESTING ENDS");
@@ -642,5 +643,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up AccessWatchpointRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume002a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume002a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -41,6 +41,7 @@
 
     static ArgumentHandler argHandler;
     static Log log;
+    static int testCase    = -1;
 
     //--------------------------------------------------   log procedures
 
@@ -98,8 +99,12 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume002aTestClass.method();
-                            break;
+                    case 0:
+                        resume002aTestClass.method();
+                        // Wait for debugger to complete the first test case
+                        // before advancing to the first breakpoint
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume002aTestClass.method();
                             break;
@@ -118,6 +123,17 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
+
 }
 
 class resume002aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume003 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume003 ",
     sHeader2 = "--> debugger: ",
@@ -503,6 +503,8 @@
 
             log2("......--> vm.resume()");
             vm.resume();
+            informDebuggeeTestCase(i);
+
             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         }
         log1("    TESTING ENDS");
@@ -642,5 +644,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up ModificationWatchpointRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume003a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,8 @@
 
 public class resume003a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
+    static int testCase    = -1;
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -98,8 +99,12 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume003aTestClass.method();
-                            break;
+                    case 0:
+                        resume003aTestClass.method();
+                        // Wait for debugger to complete the first test case
+                        // before advancing to the first breakpoint
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume003aTestClass.method();
                             break;
@@ -118,6 +123,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class resume003aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume004 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume004 ",
     sHeader2 = "--> debugger: ",
@@ -493,6 +493,7 @@
 
                   default: throw new JDITestRuntimeException("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             log2("......--> vm.resume()");
@@ -638,5 +639,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up BreakpointRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume004a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,8 @@
 
 public class resume004a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
+    static int testCase    = -1;
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -98,8 +99,10 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume004aTestClass.method();
-                            break;
+                    case 0:
+                        resume004aTestClass.method();
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume004aTestClass.method();
                             break;
@@ -118,6 +121,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class resume004aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume005 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume005 ",
     sHeader2 = "--> debugger: ",
@@ -493,6 +493,7 @@
 
                   default: throw new JDITestRuntimeException("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             log2("......--> vm.resume()");
@@ -634,5 +635,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up ExceptionRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume005a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,8 @@
 
 public class resume005a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
+    static int testCase    = -1;
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -98,8 +99,10 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume005aTestClass.method();
-                            break;
+                    case 0:
+                        resume005aTestClass.method();
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume005aTestClass.method();
                             break;
@@ -122,7 +125,16 @@
     public static void nullMethod() {
         throw new NullPointerException("test");
     }
-
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class resume005aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume006 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume006 ",
     sHeader2 = "--> debugger: ",
@@ -495,6 +495,7 @@
 
             log2("......--> vm.resume()");
             vm.resume();
+            informDebuggeeTestCase(i);
             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         }
         log1("    TESTING ENDS");
@@ -632,5 +633,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up MethodEntryRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume006a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume006a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -41,6 +41,7 @@
 
     static ArgumentHandler argHandler;
     static Log log;
+    static int testCase    = -1;
 
     //--------------------------------------------------   log procedures
 
@@ -98,8 +99,12 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume006aTestClass.method();
-                            break;
+                    case 0:
+                        resume006aTestClass.method();
+                        // Wait for debugger to complete the first test case
+                        // before advancing to the next breakpoint
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume006aTestClass.method();
                             break;
@@ -118,7 +123,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
-
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class resume006aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume007 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = Consts.TEST_PASSED;
     static final int FAILED = Consts.TEST_FAILED;
     static final int PASS_BASE = Consts.JCK_STATUS_BASE;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume007 ",
     sHeader2 = "--> debugger: ",
@@ -490,6 +490,7 @@
 
                   default: throw new JDITestRuntimeException("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             log2("......--> vm.resume()");
@@ -631,5 +632,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up MethodExitRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume007a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,8 @@
 
 public class resume007a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
+    static int testCase    = -1;
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -98,8 +99,10 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume007aTestClass.method();
-                            break;
+                    case 0:
+                        resume007aTestClass.method();
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume007aTestClass.method();
                             break;
@@ -118,7 +121,16 @@
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
-
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 
 class resume007aTestClass {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008.java	Tue Aug 28 08:06:59 2018 -0400
@@ -50,9 +50,9 @@
  * To check up on the method, a debugger,
  * upon getting new set for the EventSet,
  * suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
  * invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
  * The debugger then compares values of
  * each thread's suspendCount from first and second Lists.
  *
@@ -63,6 +63,13 @@
  *   to be resulting in the event.
  * - Upon getting new event, the debugger
  *   performs the check corresponding to the event.
+ * - The debugger informs the debuggee when it completes
+ *   each test case, so it will wait before hitting
+ *   communication breakpoints.
+ *   This prevents the breakpoint SUSPEND_ALL policy
+ *   disrupting the first test case check for
+ *   SUSPEND_NONE, if the debuggee gets ahead of
+ *   the debugger processing.
  */
 
 public class resume008 extends TestDebuggerType1 {
@@ -124,7 +131,9 @@
             }
 
             display("......waiting for new ThreadStartEvent : " + i);
-            EventSet eventSet = eventHandler.waitForRequestedEventSet(new EventRequest[]{eventRequest}, waitTime, true);
+            EventSet eventSet = eventHandler
+                .waitForRequestedEventSet(new EventRequest[]{eventRequest},
+                                          waitTime, true);
 
             EventIterator eventIterator = eventSet.eventIterator();
             Event newEvent = eventIterator.nextEvent();
@@ -134,7 +143,8 @@
             } else {
 
                 String property = (String) newEvent.request().getProperty("number");
-                display("       got new ThreadStartEvent with propety 'number' == " + property);
+                display("       got new ThreadStartEvent with propety 'number' == "
+                        + property);
 
                 display("......checking up on EventSet.resume()");
                 display("......--> vm.suspend();");
@@ -144,7 +154,8 @@
 
                 Map<String, Integer> suspendsCounts1 = new HashMap<String, Integer>();
                 for (ThreadReference threadReference : vm.allThreads()) {
-                    suspendsCounts1.put(threadReference.name(), threadReference.suspendCount());
+                    suspendsCounts1.put(threadReference.name(),
+                                        threadReference.suspendCount());
                 }
                 display(suspendsCounts1.toString());
 
@@ -154,7 +165,8 @@
                 display("        getting : Map<String, Integer> suspendsCounts2");
                 Map<String, Integer> suspendsCounts2 = new HashMap<String, Integer>();
                 for (ThreadReference threadReference : vm.allThreads()) {
-                    suspendsCounts2.put(threadReference.name(), threadReference.suspendCount());
+                    suspendsCounts2.put(threadReference.name(),
+                                        threadReference.suspendCount());
                 }
                 display(suspendsCounts2.toString());
 
@@ -163,85 +175,90 @@
 
                 switch (policy) {
 
-                  case SUSPEND_NONE   :
-                       display("        case SUSPEND_NONE");
-                       for (String threadName : suspendsCounts1.keySet()) {
-                           display("        checking " + threadName);
-                           if (!suspendsCounts2.containsKey(threadName)) {
-                               complain("ERROR: couldn't get ThreadReference for " + threadName);
-                               testExitCode = TEST_FAILED;
-                               break;
-                           }
-                           int count1 = suspendsCounts1.get(threadName);
-                           int count2 = suspendsCounts2.get(threadName);
-                           if (count1 != count2) {
-                               complain("ERROR: suspendCounts don't match for : " + threadName);
-                               complain("before resuming : " + count1);
-                               complain("after  resuming : " + count2);
-                               testExitCode = TEST_FAILED;
-                               break;
-                           }
-                       }
-                       break;
+                case SUSPEND_NONE   :
+                    display("        case SUSPEND_NONE");
+                    for (String threadName : suspendsCounts1.keySet()) {
+                        display("        checking " + threadName);
+                        if (!suspendsCounts2.containsKey(threadName)) {
+                            complain("ERROR: couldn't get ThreadReference for "
+                                     + threadName);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                        int count1 = suspendsCounts1.get(threadName);
+                        int count2 = suspendsCounts2.get(threadName);
+                        if (count1 != count2) {
+                            complain("ERROR: suspendCounts don't match for : "
+                                     + threadName);
+                            complain("before resuming : " + count1);
+                            complain("after  resuming : " + count2);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                    }
+                    break;
 
-                  case SUSPEND_THREAD :
-                       display("        case SUSPEND_THREAD");
-                       for (String threadName : suspendsCounts1.keySet()) {
-                           display("checking " + threadName);
-                           if (!suspendsCounts2.containsKey(threadName)) {
-                               complain("ERROR: couldn't get ThreadReference for " + threadName);
-                               testExitCode = TEST_FAILED;
-                               break;
-                           }
-                           int count1 = suspendsCounts1.get(threadName);
-                           int count2 = suspendsCounts2.get(threadName);
-                           String eventThreadName = ((ThreadStartEvent)newEvent).thread().name();
-                           int expectedValue = count2 + (eventThreadName.equals(threadName) ? 1 : 0);
-                           if (count1 != expectedValue) {
-                               complain("ERROR: suspendCounts don't match for : " + threadName);
-                               complain("before resuming : " + count1);
-                               complain("after  resuming : " + count2);
-                               testExitCode = TEST_FAILED;
-                               break;
-                           }
-                       }
-                       break;
-
-                    case SUSPEND_ALL    :
+                case SUSPEND_THREAD :
+                    display("        case SUSPEND_THREAD");
+                    for (String threadName : suspendsCounts1.keySet()) {
+                        display("checking " + threadName);
+                        if (!suspendsCounts2.containsKey(threadName)) {
+                            complain("ERROR: couldn't get ThreadReference for "
+                                     + threadName);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                        int count1 = suspendsCounts1.get(threadName);
+                        int count2 = suspendsCounts2.get(threadName);
+                        String eventThreadName = ((ThreadStartEvent)newEvent)
+                            .thread().name();
+                        int expectedValue = count2 +
+                            (eventThreadName.equals(threadName) ? 1 : 0);
+                        if (count1 != expectedValue) {
+                            complain("ERROR: suspendCounts don't match for : "
+                                     + threadName);
+                            complain("before resuming : " + count1);
+                            complain("after  resuming : " + count2);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                    }
+                    break;
 
-                        display("        case SUSPEND_ALL");
-                        for (String threadName : suspendsCounts1.keySet()) {
-                            display("checking " + threadName);
+                case SUSPEND_ALL    :
+                    display("        case SUSPEND_ALL");
+                    for (String threadName : suspendsCounts1.keySet()) {
+                        display("checking " + threadName);
+                        if (!newEvent.request().equals(eventRequest))
+                            break;
+                        if (!suspendsCounts2.containsKey(threadName)) {
+                            complain("ERROR: couldn't get ThreadReference for "
+                                     + threadName);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                        int count1 = suspendsCounts1.get(threadName);
+                        int count2 = suspendsCounts2.get(threadName);
+                        if (count1 != count2 + 1) {
+                            complain("ERROR: suspendCounts don't match for : "
+                                     + threadName);
+                            complain("before resuming : " + count1);
+                            complain("after  resuming : " + count2);
+                            testExitCode = TEST_FAILED;
+                            break;
+                        }
+                    }
+                    break;
+                default: throw new Failure("** default case 1 **");
+                }
+                informDebuggeeTestCase(i);
 
-                            if (!newEvent.request().equals(eventRequest))
-                                break;
-                            if (!suspendsCounts2.containsKey(threadName)) {
-                                complain("ERROR: couldn't get ThreadReference for " + threadName);
-                                testExitCode = TEST_FAILED;
-                                break;
-                            }
-                            int count1 = suspendsCounts1.get(threadName);
-                            int count2 = suspendsCounts2.get(threadName);
-                            if (count1 != count2 + 1) {
-                                complain("ERROR: suspendCounts don't match for : " + threadName);
-                                complain("before resuming : " + count1);
-                                complain("after  resuming : " + count2);
-                                testExitCode = TEST_FAILED;
-                                break;
-                            }
-                        }
-                        break;
-
-                     default: throw new Failure("** default case 1 **");
-                }
             }
-
             display("......--> vm.resume()");
             vm.resume();
         }
         return;
     }
-
     private ThreadStartRequest settingThreadStartRequest(int suspendPolicy,
                                                          String property) {
         try {
@@ -254,5 +271,22 @@
             throw new Failure("** FAILURE to set up ThreadStartRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume008a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume008a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -62,6 +62,7 @@
 
     static int exitCode = PASSED;
 
+    static int testCase    = -1;
     static int instruction = 1;
     static int end         = 0;
                                    //    static int quit        = 0;
@@ -70,6 +71,7 @@
 
     static int lineForComm = 2;
 
+    // Debugger sets a breakpoint here to track debuggee
     private static void methodForCommunication() {
         int i1 = instruction;
         int i2 = i1;
@@ -85,47 +87,38 @@
         log1("debuggee started!");
 
         label0:
-            for (int i = 0; ; i++) {
-
-                if (instruction > maxInstr) {
-                    logErr("ERROR: unexpected instruction: " + instruction);
-                    exitCode = FAILED;
-                    break ;
-                }
-
-                switch (i) {
-
+        for (int i = 0; ; i++) {
+            if (instruction > maxInstr) {
+                logErr("ERROR: unexpected instruction: " + instruction);
+                exitCode = FAILED;
+                break ;
+            }
+            switch (i) {
     //------------------------------------------------------  section tested
-
-                    case 0:
-                            thread0 = new Threadresume008a("thread0");
-                            methodForCommunication();
-
-                            threadStart(thread0);
-
-                            thread1 = new Threadresume008a("thread1");
-                            methodForCommunication();
-                            break;
-
-                    case 1:
-                            threadStart(thread1);
-
-                            thread2 = new Threadresume008a("thread2");
-                            methodForCommunication();
-                            break;
-
-                    case 2:
-                            threadStart(thread2);
-
-    //-------------------------------------------------    standard end section
-
-                    default:
-                                instruction = end;
-                                methodForCommunication();
-                                break label0;
-                }
+            case 0:
+                thread0 = new Threadresume008a("thread0");
+                methodForCommunication();
+                threadStart(thread0);
+                thread1 = new Threadresume008a("thread1");
+                // Wait for debugger to complete the first test case
+                // before advancing to the first breakpoint
+                waitForTestCase(0);
+                methodForCommunication();
+                break;
+            case 1:
+                threadStart(thread1);
+                thread2 = new Threadresume008a("thread2");
+                methodForCommunication();
+                break;
+            case 2:
+                threadStart(thread2);
+            //-------------------------------------------------    standard end section
+            default:
+                instruction = end;
+                methodForCommunication();
+                break label0;
             }
-
+        }
         log1("debuggee exits");
         System.exit(exitCode + PASS_BASE);
     }
@@ -145,24 +138,29 @@
         }
         return PASSED;
     }
-
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
     static class Threadresume008a extends Thread {
-
         String tName = null;
-
         public Threadresume008a(String threadName) {
             super(threadName);
             tName = threadName;
         }
-
         public void run() {
             log1("  'run': enter  :: threadName == " + tName);
             synchronized (waitnotifyObj) {
-                    waitnotifyObj.notify();
+                waitnotifyObj.notify();
             }
             log1("  'run': exit   :: threadName == " + tName);
             return;
         }
     }
-
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009.java	Tue Aug 28 08:06:59 2018 -0400
@@ -50,9 +50,9 @@
  * To check up on the method, a debugger,
  * upon getting new set for the EventSet,
  * suspends VM with the method VirtualMachine.suspend(),
- * gets the List of geduggee's threads calling VM.allThreads(),
+ * gets the List of debuggee's threads calling VM.allThreads(),
  * invokes the method EventSet.resume(), and
- * gets another List of geduggee's threads.
+ * gets another List of debuggee's threads.
  * The debugger then compares values of
  * each thread's suspendCount from first and second Lists.
  *
@@ -63,6 +63,13 @@
  *   to be resulting in the event.
  * - Upon getting new event, the debugger
  *   performs the check corresponding to the event.
+ * - The debugger informs the debuggee when it completes
+ *   each test case, so it will wait before hitting
+ *   communication breakpoints.
+ *   This prevents the breakpoint SUSPEND_ALL policy
+ *   disrupting the first test case check for
+ *   SUSPEND_NONE, if the debuggee gets ahead of
+ *   the debugger processing.
  */
 
 public class resume009 extends TestDebuggerType1 {
@@ -233,6 +240,7 @@
 
                      default: throw new Failure("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             display("......--> vm.resume()");
@@ -253,5 +261,22 @@
             throw new Failure("** FAILURE to set up ThreadDeathRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume009a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume009a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -62,6 +62,7 @@
 
     static int exitCode = PASSED;
 
+    static int testCase    = -1;
     static int instruction = 1;
     static int end         = 0;
                                    //    static int quit        = 0;
@@ -104,6 +105,9 @@
                             threadRun(thread0);
 
                             thread1 = new Threadresume009a("thread1");
+                            // Wait for debugger to complete the first test case
+                            // before advancing to the first breakpoint
+                            waitForTestCase(0);
                             methodForCommunication();
                             break;
 
@@ -152,6 +156,16 @@
         }
         return PASSED;
     }
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 
     static class Threadresume009a extends Thread {
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010.java	Tue Aug 28 08:06:59 2018 -0400
@@ -48,9 +48,9 @@
  * To check up on the method, a debugger,                       <BR>
  * upon getting new set for the EventSet,                       <BR>
  * suspends VM with the method VirtualMachine.suspend(),        <BR>
- * gets the List of geduggee's threads calling VM.allThreads(), <BR>
+ * gets the List of debuggee's threads calling VM.allThreads(), <BR>
  * invokes the method EventSet.resume(), and                    <BR>
- * gets another List of geduggee's threads.                     <BR>
+ * gets another List of debuggee's threads.                     <BR>
  * The debugger then compares values of                         <BR>
  * each thread's suspendCount from first and second Lists.      <BR>
  * <BR>
@@ -87,12 +87,12 @@
 
 public class resume010 {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
     static final int PASSED = 0;
     static final int FAILED = 2;
     static final int PASS_BASE = 95;
 
-    //----------------------------------------------------- templete parameters
+    //----------------------------------------------------- template parameters
     static final String
     sHeader1 = "\n==> nsk/jdi/EventSet/resume/resume010 ",
     sHeader2 = "--> debugger: ",
@@ -488,6 +488,7 @@
                     default:
                         throw new JDITestRuntimeException("** default case 1 **");
                 }
+                informDebuggeeTestCase(i);
             }
 
             log2("......--> vm.resume()");
@@ -627,5 +628,22 @@
             throw new JDITestRuntimeException("** FAILURE to set up StepRequest **");
         }
     }
-
+    /**
+     * Inform debuggee which thread test the debugger has completed.
+     * Used for synchronization, so the debuggee does not move too quickly.
+     * @param testCase index of just completed test
+     */
+    void informDebuggeeTestCase(int testCase) {
+        try {
+            ((ClassType)debuggeeClass)
+                .setValue(debuggeeClass.fieldByName("testCase"),
+                          vm.mirrorOf(testCase));
+        } catch (InvalidTypeException ite) {
+            throw new Failure("** FAILURE setting testCase  **");
+        } catch (ClassNotLoadedException cnle) {
+            throw new Failure("** FAILURE notifying debuggee  **");
+        } catch (VMDisconnectedException e) {
+            throw new Failure("** FAILURE debuggee connection **");
+        }
+    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java	Wed Aug 29 19:14:08 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventSet/resume/resume010a.java	Tue Aug 28 08:06:59 2018 -0400
@@ -33,7 +33,7 @@
 
 public class resume010a {
 
-    //----------------------------------------------------- templete section
+    //----------------------------------------------------- template section
 
     static final int PASSED = 0;
     static final int FAILED = 2;
@@ -60,6 +60,7 @@
 
     static int exitCode = PASSED;
 
+    static int testCase    = -1;
     static int instruction = 1;
     static int end         = 0;
                                    //    static int quit        = 0;
@@ -98,8 +99,12 @@
 
     //------------------------------------------------------  section tested
 
-                    case 0: resume010aTestClass.method();
-                            break;
+                    case 0:
+                        resume010aTestClass.method();
+                        // Wait for debugger to complete the first test case
+                        // before advancing to the first breakpoint
+                        waitForTestCase(0);
+                        break;
 
                     case 1: resume010aTestClass.method();
                             break;
@@ -117,7 +122,16 @@
 
         System.exit(exitCode + PASS_BASE);
     }
-
+    // Synchronize with debugger progression.
+    static void waitForTestCase(int t) {
+        while (testCase < t) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // ignored
+            }
+        }
+    }
 }
 class resume010aTestClass {