8199379: [TESTBUG] Open source vm testbase JDB tests
authoriignatyev
Tue, 22 May 2018 10:08:04 -0700
changeset 50220 31361382634b
parent 50219 4ab066d71956
child 50221 28f2e09a0ae0
8199379: [TESTBUG] Open source vm testbase JDB tests Reviewed-by: mseledtsov, sspitsyn
test/hotspot/jtreg/ProblemList-graal.txt
test/hotspot/jtreg/ProblemList.txt
test/hotspot/jtreg/TEST.groups
test/hotspot/jtreg/vmTestbase/nsk/jdb/caught_exception/caught_exception002/caught_exception002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/caught_exception/caught_exception002/caught_exception002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/classes/classes001/classes001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/classes/classes001/classes001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/classpath/classpath001/classpath001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/classpath/classpath001/classpath001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear002/clear002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear002/clear002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear003/clear003.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear003/clear003a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear004/clear004.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear004/clear004a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/down/down002/down002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/down/down002/down002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/dump/dump002/dump002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/dump/dump002/dump002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/eval/eval001/eval001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/eval/eval001/eval001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/fields/fields001/fields001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/fields/fields001/fields001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/ignore/ignore001/ignore001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/ignore/ignore001/ignore001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill002/kill002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill002/kill002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/klass/class001/class001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/klass/class001/class001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/list/list002/list002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/list/list002/list002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/methods/methods002/methods002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/methods/methods002/methods002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/monitor/monitor001/monitor001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/monitor/monitor001/monitor001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/next/next001/next001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/next/next001/next001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect001/connect001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect001/connect001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect002/connect002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect002/connect002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect003/connect003.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect003/connect003a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect004/connect004.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect004/connect004a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect005/connect005.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect005/connect005a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/options/listconnectors/listconnectors001/listconnectors001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/pop/pop001/pop001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/pop/pop001/pop001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/pop_exception/pop_exception001/pop_exception001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/pop_exception/pop_exception001/pop_exception001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/print/print002/print002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/print/print002/print002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/jdb.scenario
test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/read001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/read001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/RedefinedClass.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/newclass_g/RedefinedClass.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/redefine001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/redefine001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/reenter/reenter001/reenter001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/reenter/reenter001/reenter001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/b4689395.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/b4689395a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/newclass/b4689395a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/resume/resume002/resume002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/resume/resume002/resume002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/run/run002/run002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/run/run002/run002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set001/set001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set001/set001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set002/set002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set002/set002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/step/step002/step002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/step/step002/step002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/step_up/step_up001/step_up001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/step_up/step_up001/step_up001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at003/stop_at003.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at003/stop_at003a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_in/stop_in002/stop_in002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_in/stop_in002/stop_in002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/suspend/suspend001/suspend001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/suspend/suspend001/suspend001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/thread/thread002/thread002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/thread/thread002/thread002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroups/threadgroups002/threadgroups002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroups/threadgroups002/threadgroups002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threads/threads002/threads002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/threads/threads002/threads002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/uncaught_exception/uncaught_exception002/uncaught_exception002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/uncaught_exception/uncaught_exception002/uncaught_exception002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/untrace/untrace001/untrace001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/untrace/untrace001/untrace001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch001/unwatch001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch001/unwatch001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch002/unwatch002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch002/unwatch002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/up/up002/up002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/up/up002/up002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/use/use001/use001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/use/use001/use001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch001/watch001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch001/watch001a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch002/watch002.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch002/watch002a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where004/where004.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where004/where004a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where005/where005.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where005/where005a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where006/where006.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where006/where006a.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/wherei/wherei001/wherei001.java
test/hotspot/jtreg/vmTestbase/nsk/jdb/wherei/wherei001/wherei001a.java
test/hotspot/jtreg/vmTestbase/nsk/share/classload/ClassLoadUtils.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/DebuggeeUncaughtException.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbArgumentHandler.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbCommand.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java
test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Tue May 22 13:10:56 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Tue May 22 10:08:04 2018 -0700
@@ -134,6 +134,7 @@
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses026/TestDescription.java   8195627   generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses028/TestDescription.java   8195627   generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses030/TestDescription.java   8195627   generic-all
+vmTestbase/nsk/jdb/wherei/wherei001/wherei001.java                                          8195627   generic-all
 
 vmTestbase/vm/mlvm/anonloader/stress/oome/heap/Test.java         8186299   generic-all
 vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java    8186299   generic-all
--- a/test/hotspot/jtreg/ProblemList.txt	Tue May 22 13:10:56 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Tue May 22 10:08:04 2018 -0700
@@ -144,6 +144,8 @@
 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
 vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
 
+vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java 8197938 windows-all
+
 vmTestbase/heapdump/JMapHeapCore/TestDescription.java 8023376,8001227,8051445 generic-all
 vmTestbase/heapdump/JMapMetaspaceCore/TestDescription.java 8023376,8001227,8051445 generic-all
 
--- a/test/hotspot/jtreg/TEST.groups	Tue May 22 13:10:56 2018 -0400
+++ b/test/hotspot/jtreg/TEST.groups	Tue May 22 10:08:04 2018 -0700
@@ -1257,9 +1257,10 @@
 # JSR292 tests (invokedynamic AKA Multi-Language VM AKA Da Vinci Machine)
 vmTestbase_vm_mlvm = \
   vmTestbase/vm/mlvm
+
 # Heap dump tests
 vmTestbase_vm_heapdump = \
-  vmTestbase/heapdump/
+  vmTestbase/heapdump
 
 vmTestbase_vm_heapdump_quick = \
   vmTestbase/heapdump/OnOOMToFile/TestDescription.java \
@@ -1267,3 +1268,8 @@
   vmTestbase/heapdump/OnOOMToPath/TestDescription.java \
   vmTestbase/heapdump/JMapHeapCore/TestDescription.java \
   vmTestbase/heapdump/JMapMetaspace/TestDescription.java
+
+# JDB tests
+vmTestbase_nsk_jdb = \
+  vmTestbase/nsk/jdb
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/caught_exception/caught_exception002/caught_exception002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/caught_exception/caught_exception002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A positive test case for the 'catch caught <exception>' command.
+ *  When the debugee throws an exception that is caught somewhere
+ *  up in the program stack, jdb does not halt execution at the point
+ *  the exception was thrown but continues to execute the code in the catch
+ *  clause and proceed on with the rest of the program.
+ *  To halt execution at the throw point for exceptions
+ *  that are being caught - the 'catch' command has to be used.
+ *  The test throws ten exceptions that are on jdb's catch list
+ *  and verifies that jdb halts execution at the throw point each
+ *  time an exception is thrown.
+ * COMMENTS
+ *  This test functionally equals to
+ *  nsk/jdb/caught_exception/caught_exception001 test and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.caught_exception.caught_exception002.caught_exception002
+ *        nsk.jdb.caught_exception.caught_exception002.caught_exception002a
+ * @run main/othervm PropertyResolvingWrapper
+ *      nsk.jdb.caught_exception.caught_exception002.caught_exception002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.caught_exception.caught_exception002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class caught_exception002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new caught_exception002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.caught_exception.caught_exception002";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".caught_exception002";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final int MAX = 10;
+
+    /* ------------------------------------- */
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        for (int i = 0; i < MAX; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand._catch + " caught " + PACKAGE_NAME + ".MyException" + i);
+        }
+
+        for (int i = 0; i < MAX; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            checkCatch(reply, i);
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private void checkCatch (String[] reply, int i) {
+        Paragrep grep;
+        int count;
+        String found;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.add("Exception occurred");
+        v.add(PACKAGE_NAME + ".MyException" + i);
+        count = grep.find(v);
+        if (count != 1) {
+            log.complain("Failed to report catch of MyException" + i + " : " + count);
+            success = false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/caught_exception/caught_exception002/caught_exception002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.caught_exception.caught_exception002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class caught_exception002a {
+
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.caught_exception.caught_exception002";
+
+    public static void main(String args[]) {
+       caught_exception002a _caught_exception002a = new caught_exception002a();
+       System.exit(caught_exception002.JCK_STATUS_BASE + _caught_exception002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        lastBreak();
+
+        int  result = -1;
+        for (int i = 0; i <= 10; i++) {
+            result = a(i);
+        }
+
+        log.display("Debuggee PASSED");
+        return caught_exception002.PASSED;
+    }
+
+    public static int a(int i) {
+        int result = -1;
+        try {
+            result = b(i);
+        } catch (MyException0 e) {
+            System.out.println("debugee's main(): caught MyException0");
+        } catch (MyException1 e) {
+            System.out.println("debugee's main(): caught MyException1");
+        } catch (MyException2 e) {
+            System.out.println("debugee's main(): caught MyException2");
+        } catch (MyException3 e) {
+            System.out.println("debugee's main(): caught MyException3");
+        } catch (MyException4 e) {
+            System.out.println("debugee's main(): caught MyException4");
+        } catch (MyException5 e) {
+            System.out.println("debugee's main(): caught MyException5");
+        } catch (MyException6 e) {
+            System.out.println("debugee's main(): caught MyException6");
+        } catch (MyException7 e) {
+            System.out.println("debugee's main(): caught MyException7");
+        } catch (MyException8 e) {
+            System.out.println("debugee's main(): caught MyException8");
+        } catch (MyException9 e) {
+            System.out.println("debugee's main(): caught MyException9");
+        }
+        return result;
+    }
+
+    public static int b(int i) throws MyException0, MyException1,
+        MyException2, MyException3, MyException4, MyException5, MyException6,
+        MyException7, MyException8, MyException9 {
+
+        switch(i) {
+           case 0:
+              throw new MyException0("MyException0");
+           case 1:
+              throw new MyException1("MyException1");
+           case 2:
+              throw new MyException2("MyException2");
+           case 3:
+              throw new MyException3("MyException3");
+           case 4:
+              throw new MyException4("MyException4");
+           case 5:
+              throw new MyException5("MyException5");
+           case 6:
+              throw new MyException6("MyException6");
+           case 7:
+              throw new MyException7("MyException7");
+           case 8:
+              throw new MyException8("MyException8");
+           case 9:
+              throw new MyException9("MyException9");
+           default:
+              return i*i;
+        }
+    }
+}
+
+class MyException0 extends Exception {
+   public MyException0 (String s) {super(s);}
+}
+class MyException1 extends Exception {
+   public MyException1 (String s) {super(s);}
+}
+class MyException2 extends Exception {
+   public MyException2 (String s) {super(s);}
+}
+class MyException3 extends Exception {
+   public MyException3 (String s) {super(s);}
+}
+class MyException4 extends Exception {
+   public MyException4 (String s) {super(s);}
+}
+class MyException5 extends Exception {
+   public MyException5 (String s) {super(s);}
+}
+class MyException6 extends Exception {
+   public MyException6 (String s) {super(s);}
+}
+class MyException7 extends Exception {
+   public MyException7 (String s) {super(s);}
+}
+class MyException8 extends Exception {
+   public MyException8 (String s) {super(s);}
+}
+class MyException9 extends Exception {
+   public MyException9 (String s) {super(s);}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/classes/classes001/classes001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/classes/classes001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'classes' command.
+ * The test checks if jdb correctly replies on 'classes' command.
+ * The test passes when reply contains full names of all checked classes.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.classes.classes001.classes001
+ *        nsk.jdb.classes.classes001.classes001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.classes.classes001.classes001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.classes.classes001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class classes001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new classes001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.classes.classes001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".classes001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String NOT_VALID_SAMPLE   = "is not a valid";
+
+    static String[] checkedClasses = {
+        DEBUGGEE_CLASS,
+        DEBUGGEE_CLASS + "$Inner1",
+        DEBUGGEE_CLASS + "$Inner2",
+        DEBUGGEE_CLASS + "$Inner3",
+        DEBUGGEE_CLASS + "$Inner4",
+        DEBUGGEE_CLASS + "$Inner5",
+        DEBUGGEE_CLASS + "$Inner6",
+        DEBUGGEE_CLASS + "$Inner7",
+        DEBUGGEE_CLASS + "$Inner8",
+        DEBUGGEE_CLASS + "$InnerInt1",
+        DEBUGGEE_CLASS + "$InnerInt2",
+        DEBUGGEE_CLASS + "$InnerInt3",
+        DEBUGGEE_CLASS + "$InnerInt4",
+        DEBUGGEE_CLASS + "$InnerInt5",
+        PACKAGE_NAME + ".Outer1",
+        PACKAGE_NAME + ".Outer2",
+        PACKAGE_NAME + ".Outer3",
+        PACKAGE_NAME + ".OuterInt1",
+        PACKAGE_NAME + ".OuterInt2"
+                                      };
+
+    /* ------------------------------------- */
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.classes);
+
+        for (int i = 0; i < checkedClasses.length; i++) {
+            if (!checkClass(checkedClasses[i], reply)) {
+                success = false;
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkClass (String className, String[] reply) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(className);
+        if (found.length() == 0) {
+            log.complain("Failed to report class " + className);
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/classes/classes001/classes001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.classes.classes001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class classes001a {
+
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.classes.classes001";
+
+    public static void main(String args[]) {
+       classes001a _classes001a = new classes001a();
+       System.exit(classes001.JCK_STATUS_BASE + _classes001a.runIt(args, System.out));
+    }
+
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        init();
+
+        log.display("Debuggee PASSED");
+        return classes001.PASSED;
+    }
+
+    class Inner1 {}
+    interface InnerInt1 {}
+
+    public class Inner2 {}
+    public interface InnerInt2 {}
+
+    private class Inner3 {}
+    private interface InnerInt3 {}
+
+    protected class Inner4 {}
+    protected interface InnerInt4 {}
+
+    abstract class Inner5 {}
+    abstract interface InnerInt5 {}
+
+    final class Inner6 extends Inner5{}
+
+    class Inner7 extends Outer2{}
+    class Inner8 implements OuterInt1, OuterInt2, InnerInt1, InnerInt2, InnerInt3,  InnerInt4, InnerInt5 {}
+
+    private void init () {
+        Outer1 o1 = new Outer1();
+        Outer3 o3 = new Outer3();
+        Inner1 i1 = new Inner1();
+        Inner2 i2 = new Inner2();
+        Inner3 i3 = new Inner3();
+        Inner4 i4 = new Inner4();
+        Inner6 i6 = new Inner6();
+        Inner7 i7 = new Inner7();
+        Inner8 i8 = new Inner8();
+
+        lastBreak();
+    }
+}
+
+class Outer1 {}
+interface OuterInt1 {}
+
+abstract class Outer2 {}
+abstract interface OuterInt2 {}
+
+final class Outer3 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/classpath/classpath001/classpath001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/classpath/classpath001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * An "is it alive & breathing" test for the 'classpath' command.
+ * The test passes if reply on 'classpath' command is not empty.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.classpath.classpath001.classpath001
+ *        nsk.jdb.classpath.classpath001.classpath001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.classpath.classpath001.classpath001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.classpath.classpath001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class classpath001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new classpath001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.classpath.classpath001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".classpath001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        reply = jdb.receiveReplyFor(JdbCommand.classpath);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst("lasspath");
+        if (found.length() == 0) {
+            log.complain("Failed to report classpath");
+            success = false;
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/classpath/classpath001/classpath001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.classpath.classpath001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class classpath001a {
+    public static void main(String args[]) {
+       classpath001a _classpath001a = new classpath001a();
+       lastBreak();
+       System.exit(classpath001.JCK_STATUS_BASE + _classpath001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return classpath001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear002/clear002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/clear/clear002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'clear <class_id>.<method>' command.
+ * The test sets 3 breakpoints and then clears two of them after the
+ * first breakpoint is reached. The tests verifies that jdb does not
+ * halt execution at the cleared breakpoint.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.clear.clear002.clear002
+ *        nsk.jdb.clear.clear002.clear002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.clear.clear002.clear002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.clear.clear002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class clear002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new clear002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.clear.clear002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".clear002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+    static final String METHOD_TO_STOP   = DEBUGGEE_CLASS + ".func5";
+    static final String METHOD1_TO_CLEAR = DEBUGGEE_CLASS + ".func4";
+    static final String METHOD2_TO_CLEAR = DEBUGGEE_CLASS + "$A.func7";
+    static final String REMOVED_SAMPLE   = "Removed:";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        log.display("Setting breakpoint in method: " + METHOD1_TO_CLEAR);
+        jdb.setBreakpointInMethod(METHOD1_TO_CLEAR);
+
+        log.display("Setting breakpoint in method: " + METHOD2_TO_CLEAR);
+        jdb.setBreakpointInMethod(METHOD2_TO_CLEAR);
+
+        log.display("Setting breakpoint in method: " + METHOD_TO_STOP);
+        jdb.setBreakpointInMethod(METHOD_TO_STOP);
+
+        if (!checkClear (METHOD1_TO_CLEAR)) {
+            success = false;
+        }
+
+        if (!checkClear (METHOD2_TO_CLEAR)) {
+            success = false;
+        }
+
+        jdb.contToExit(2);
+
+        grep = new Paragrep(jdb.getTotalReply());
+        count = grep.find(Jdb.BREAKPOINT_HIT);
+        if (count != 2) {
+            log.complain("Should hit 2 breakpoints.");
+            log.complain("Breakpoint hit count reported: " + count);
+            success = false;
+        }
+
+        if (!checkBreakpoint (METHOD1_TO_CLEAR, grep)) {
+            success = false;
+        }
+
+        if (!checkBreakpoint (METHOD2_TO_CLEAR, grep)) {
+            success = false;
+        }
+    }
+
+    private boolean checkBreakpoint (String methodName, Paragrep grep) {
+        String found;
+        boolean result = true;
+        int count;
+        Vector v;
+
+        v = new Vector();
+        v.add(Jdb.BREAKPOINT_HIT);
+        v.add(methodName);
+
+        found = grep.findFirst(v);
+        if (found.length() > 0) {
+            log.complain("Wrong hit at removed breakpoint in method:" + methodName);
+            result = false;
+        }
+        return result;
+    }
+
+    private boolean checkClear (String methodName) {
+        Paragrep grep;
+        String found;
+        String[] reply;
+        boolean result = true;
+        int count;
+        Vector v;
+
+        v = new Vector();
+        v.add(REMOVED_SAMPLE);
+        v.add(methodName);
+
+        log.display("Clearing breakpoint in method:" + methodName);
+        reply = jdb.receiveReplyFor(JdbCommand.clear + methodName);
+        grep = new Paragrep(reply);
+
+        found = grep.findFirst(v);
+        if (found.length() == 0) {
+            log.complain("Failed to clear breakpoint in method: " + methodName);
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear002/clear002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.clear.clear002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class clear002a {
+    public static void main(String args[]) {
+       clear002a _clear002a = new clear002a();
+       lastBreak();
+       System.exit(clear002.JCK_STATUS_BASE + _clear002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(0) + A.func7(0);
+
+        log.display("Debuggee PASSED");
+        return clear002.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1;
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1;
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1;
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1;
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1;
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+
+    static class A {
+        public static int func7 (int i) {
+            return i++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear003/clear003.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/clear/clear003.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A negative test case for the 'clear <class_id>.<method>' command.
+ *  The test sets 2 breakpoints and then tries to clear non-existent
+ *  breakpoint after the first breakpoint is reached. The tests verifies
+ *  that jdb correctly reports about attempt to clear non-existent
+ *  breakpoint.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.clear.clear003.clear003
+ *        nsk.jdb.clear.clear003.clear003a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.clear.clear003.clear003
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.clear.clear003;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class clear003 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new clear003().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.clear.clear003";
+    static final String TEST_CLASS = PACKAGE_NAME + ".clear003";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+    static final String METHOD4 = "func4";
+    static final String METHOD5 = "func5";
+    static final String METHOD_TO_CLEAR = DEBUGGEE_CLASS + "." + METHOD4;
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        log.display("Setting breakpoint in method: " + METHOD5);
+        jdb.setBreakpointInMethod(DEBUGGEE_CLASS + "." + METHOD5);
+
+        log.display("Clearing breakpoint.");
+        reply = jdb.receiveReplyFor(JdbCommand.clear + METHOD_TO_CLEAR);
+        grep = new Paragrep(reply);
+        count = grep.find("Removed:");
+        if (count > 0) {
+            log.complain("Cleared non-existent breakpoint in method: " + METHOD_TO_CLEAR);
+            success = false;
+        }
+
+        jdb.contToExit(2);
+
+        grep = new Paragrep(jdb.getTotalReply());
+        count = grep.find(Jdb.BREAKPOINT_HIT);
+        if (count != 2) {
+            log.complain("Should hit 2 breakpoints.");
+            log.complain("Breakpoint hit count reported: " + count);
+            success = false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear003/clear003a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.clear.clear003;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class clear003a {
+    public static void main(String args[]) {
+       clear003a _clear003a = new clear003a();
+       lastBreak();
+       System.exit(clear003.JCK_STATUS_BASE + _clear003a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(0);
+
+        log.display("Debuggee PASSED");
+        return clear003.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1;
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1;
+    }
+
+    public int func3(int i) {
+        int value;
+        value = func4(i) + 1;
+        return value;
+    }
+
+    public int func4(int i) {
+       int value;
+       value = func5(i) + 1;
+       return value;
+    }
+
+    public int func5(int i) {
+       int value;
+       value = func6(i) + 1;
+       return value;
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear004/clear004.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/clear/clear004.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A positive test case for the 'clear <class_id:line>' command.
+ *  The test sets 3 breakpoints and then clears one after the first
+ *  breakpoint is reached. The tests verifies that jdb does not
+ *  halt execution at the cleared breakpoint.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/clear/clear004 test and
+ *  replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.clear.clear004.clear004
+ *        nsk.jdb.clear.clear004.clear004a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.clear.clear004.clear004
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.clear.clear004;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class clear004 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new clear004().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.clear.clear004";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".clear004";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+    static final String[] BREAKPOINTS = new String[]
+        { DEBUGGEE_CLASS + ":63",
+          DEBUGGEE_CLASS + ":67",
+          DEBUGGEE_CLASS + ":71" };
+    static final String REMOVED_SAMPLE   = "Removed:";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        for (int i = 0; i < BREAKPOINTS.length; i++) {
+           log.display("Setting breakpoint at " + BREAKPOINTS[i]);
+           reply = jdb.receiveReplyFor(JdbCommand.stop_at + BREAKPOINTS[i]);
+        }
+
+        if (!checkClear (BREAKPOINTS[1])) {
+            success = false;
+        }
+
+        jdb.contToExit(3);
+
+        grep = new Paragrep(jdb.getTotalReply());
+        count = grep.find(Jdb.BREAKPOINT_HIT);
+        if (count != 3) {
+            log.complain("Should hit 3 breakpoints.");
+            log.complain("Breakpoint hit count reported: " + count);
+            success = false;
+        }
+
+        if (!checkBreakpoint (BREAKPOINTS[1], grep)) {
+            success = false;
+        }
+
+    }
+
+    private boolean checkBreakpoint (String breakpoint, Paragrep grep) {
+        String found;
+        boolean result = true;
+        int count;
+        Vector v;
+
+        v = new Vector();
+        v.add(Jdb.BREAKPOINT_HIT);
+        v.add(breakpoint);
+
+        found = grep.findFirst(v);
+        if (found.length() > 0) {
+            log.complain("Wrong hit at removed breakpoint at:" + breakpoint);
+            result = false;
+        }
+        return result;
+    }
+
+    private boolean checkClear (String breakpoint) {
+        Paragrep grep;
+        String found;
+        String[] reply;
+        boolean result = true;
+        int count;
+        Vector v;
+
+        v = new Vector();
+        v.add(REMOVED_SAMPLE);
+        v.add(breakpoint);
+
+        log.display("Clearing breakpoint at: " + breakpoint);
+        reply = jdb.receiveReplyFor(JdbCommand.clear + breakpoint);
+        grep = new Paragrep(reply);
+
+        found = grep.findFirst(v);
+        if (found.length() == 0) {
+            log.complain("Failed to clear breakpoint at: " + breakpoint);
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/clear/clear004/clear004a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.clear.clear004;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class clear004a {
+    public static void main(String args[]) {
+       clear004a _clear004a = new clear004a();
+       lastBreak();
+       System.exit(clear004.JCK_STATUS_BASE + _clear004a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(0) + A.func7(0);
+
+        log.display("Debuggee PASSED");
+        return clear004.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1;
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1;
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1;  // this is line for breakpoint // clear004.BREAKPOINTS[0]
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1;  // this is line for cleared breakpoint // clear004.BREAKPOINTS[1]
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1;  // this is line for breakpoint // clear004.BREAKPOINTS[2]
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+
+    static class A {
+        public static int func7 (int i) {
+            return i++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/down/down002/down002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/down/down002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This tests the jdb 'down' command. The test sets a breakpoint
+ *  at 'func5' method in debugged 'nsk.jdb.down.down002a' class and then
+ *  runs the debugee.  Once, an execution suspends at 'func5' method,
+ *  the 'down' command is issued to the debugger several times.
+ *  The output is processed by counting the number of times
+ *  each method name appears in the stack trace. The test passes
+ *  if the obtained count matches the expected one.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/down/down001 test and
+ *  replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.down.down002.down002
+ *        nsk.jdb.down.down002.down002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.down.down002.down002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.down.down002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class down002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new down002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.down.down002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".down002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] FRAMES = new String[][] {
+        {"[1]", DEBUGGEE_CLASS + ".func5"},
+        {"[2]", DEBUGGEE_CLASS + ".func4"},
+        {"[3]", DEBUGGEE_CLASS + ".func3"},
+        {"[4]", DEBUGGEE_CLASS + ".func2"},
+        {"[5]", DEBUGGEE_CLASS + ".func1"},
+        {"[6]", DEBUGGEE_CLASS + ".runIt"},
+        {"[7]", DEBUGGEE_CLASS + ".main"}
+                                                };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.receiveReplyFor(JdbCommand.stop_in + DEBUGGEE_CLASS + ".func5");
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        for (int i = 0; i < (FRAMES.length-1); i++) {
+            jdb.receiveReplyFor(JdbCommand.up);
+        }
+
+        for (int i = 0; i < (FRAMES.length-1); i++) {
+            jdb.receiveReplyFor(JdbCommand.down);
+            jdb.receiveReplyFor(JdbCommand.where);
+        }
+
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        grep = new Paragrep(reply);
+
+        for (int i = 1; i < (FRAMES.length-1); i++) {
+            v = new Vector();
+            v.add(FRAMES[i][0]);
+            v.add(FRAMES[i][1]);
+            count = grep.find(v);
+            if (count != (i+1)) {
+                failure("Unexpected number of the stack frame: " + FRAMES[i][1] +
+                    "\n\texpected value : " + (i+1) + ", got : " + count);
+            }
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/down/down002/down002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.down.down002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class down002a {
+    public static void main(String args[]) {
+       down002a _down002a = new down002a();
+       lastBreak();
+       System.exit(down002.JCK_STATUS_BASE + _down002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(0);
+
+        log.display("Debuggee PASSED");
+        return down002.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1;
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1;
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1;
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1;
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1;
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/dump/dump002/dump002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/dump/dump002.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the 'dump' command.
+ *  The test works as follows. Upon the debuggee is suspended
+ *  on breakpoint, jdb issues 'dump' command for an object
+ *  of debugged class and for element in array fields.
+ *  The test passes if all checked fields with their values
+ *  are listed.
+ *  The test consists of two parts:
+ *    dump002.java  - test driver, i.e. launches jdb and debuggee,
+ *                       writes commands to jdb, reads the jdb output,
+ *    dump002a.java - the debugged application.
+ * COMMENTS
+ *  The test replaces the nsk/jdb/dump/dump001 one.
+ *  Test fixed according to test bug:
+ *  5045859 TEST_BUG: some JDB tests do not recognize JDB prompt
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.dump.dump002.dump002
+ *        nsk.jdb.dump.dump002.dump002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.dump.dump002.dump002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.dump.dump002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class dump002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        compoundPromptIdent = COMPOUND_PROMPT_IDENT;
+        return new dump002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.dump.dump002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".dump002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String COMPOUND_PROMPT_IDENT = "main";
+
+    static final String[] CHECKED_FIELDS = {
+        "_dump002a",
+        "iStatic",
+        "iPrivate",
+        "iProtect",
+        "iPublic",
+        "iFinal",
+        "iTransient",
+        "iVolatile",
+        "iArray",
+        "sStatic",
+        "sPrivate",
+        "sProtected",
+        "sPublic",
+        "sFinal",
+        "sTransient",
+        "sVolatile",
+        "sArray",
+        "fBoolean",
+        "fByte",
+        "fChar",
+        "fDouble",
+        "fFloat",
+        "fInt",
+        "fLong",
+        "fShort"
+                                         };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v = new Vector();
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.dump + DEBUGGEE_CLASS + "._dump002a");
+        grep = new Paragrep(reply);
+        for (int i = 0; i < CHECKED_FIELDS.length; i++) {
+            v.setSize(0);
+            v.add(CHECKED_FIELDS[i]);
+            v.add("null");
+            if (grep.find(v) > 0) {
+                failure("The field is not dumped : " + CHECKED_FIELDS[i]);
+            }
+        }
+
+        String checkedField = DEBUGGEE_CLASS + ".iArray[0]";
+        reply = jdb.receiveReplyFor(JdbCommand.dump + checkedField);
+        checkField(reply, checkedField);
+
+        checkedField = DEBUGGEE_CLASS + ".sArray[0]";
+        reply = jdb.receiveReplyFor(JdbCommand.dump + checkedField);
+        checkField(reply, checkedField);
+
+        jdb.contToExit(1);
+    }
+
+    void checkField (String[] reply, String fieldName) {
+        Paragrep grep;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.setSize(0);
+        v.add(fieldName);
+        v.add("null");
+        if (grep.find(v) > 0) {
+            failure("The field is not dumped : " + fieldName);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/dump/dump002/dump002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.dump.dump002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class dump002a {
+    static dump002a _dump002a = new dump002a();
+
+    public static void main(String args[]) {
+       System.exit(dump002.JCK_STATUS_BASE + _dump002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return dump002.PASSED;
+    }
+
+    static     int iStatic    = 0;
+    private    int iPrivate   = 1;
+    protected  int iProtect   = 2;
+    public     int iPublic    = 3;
+    final      int iFinal     = 4;
+    transient  int iTransient = 5;
+    volatile   int iVolatile  = 6;
+
+    static     int [] iArray = { 7 };
+
+    static     String sStatic    = "zero";
+    private    String sPrivate   = "one";
+    protected  String sProtected = "two";
+    public     String sPublic    = "three";
+    final      String sFinal     = "four";
+    transient  String sTransient = "five";
+    volatile   String sVolatile  = "six";
+
+    static     String [] sArray = { "seven" };
+
+    boolean fBoolean = true;
+    byte    fByte    = Byte.MAX_VALUE;
+    char    fChar    = Character.MAX_VALUE;
+    double  fDouble  = Double.MAX_VALUE;
+    float   fFloat   = Float.MAX_VALUE;
+    int     fInt     = Integer.MAX_VALUE;
+    long    fLong    = Long.MAX_VALUE;
+    short   fShort   = Short.MAX_VALUE;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/eval/eval001/eval001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/eval/eval001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'eval <expr>' command.
+ * The test checks if jdb correctly prints values for the following
+ * expressions:
+ *  - static field,
+ *  - instance field,
+ *  - element of array field,
+ *  - return value of a method,
+ *  - arithmetic expression of local variables,
+ *  - return value of public method of the java.lang.String class.
+ * The test passes when all printed values are equal to expected ones.
+ * The test consists of two program:
+ *   eval001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   eval001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.eval.eval001.eval001
+ *
+ * @comment make sure eval001a is compiled w/ full debug info
+ * @clean nsk.jdb.eval.eval001.eval001a
+ * @compile -g:lines,source,vars eval001a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.eval.eval001.eval001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.eval.eval001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class eval001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new eval001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.eval.eval001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".eval001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] checkedExpr = {
+        { DEBUGGEE_CLASS + ".myStaticField", "-2147483648" },
+        { DEBUGGEE_CLASS + "._eval001a.myInstanceField", "9223372036854775807" },
+        { DEBUGGEE_CLASS + "._eval001a.myArrayField[0][0].toString()", "ABCDE" },
+        { DEBUGGEE_CLASS + "._eval001a.myMethod()", "2147483647" },
+        { "myClass.toString().equals(\"abcde\")", "true"},
+        { "i + j + k", "777"},
+        { "new java.lang.String(\"Hello, World\").length()", "12"}
+                                          };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // to get out of lastBreak()
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+
+        for (int i = 0; i < checkedExpr.length; i++) {
+            if (!checkValue(checkedExpr[i][0], checkedExpr[i][1])) {
+                success = false;
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkValue (String expr, String value) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        Vector v;
+        boolean result = true;
+
+        reply = jdb.receiveReplyFor(JdbCommand.eval + expr);
+        grep = new Paragrep(reply);
+        found = grep.findFirst(value);
+        if (found.length() <= 0) {
+            log.complain("jdb failed to report value of expression: " + expr);
+            log.complain("expected : " + value + " ;\nreported: " + (reply.length > 0? reply[0]: ""));
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/eval/eval001/eval001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.eval.eval001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class eval001a {
+
+    static eval001a _eval001a = new eval001a();
+
+    public static void main(String args[]) {
+       System.exit(eval001.JCK_STATUS_BASE + _eval001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        MyClass myClass = new MyClass("abcde");
+        int i = 111;
+        int j = 222;
+        int k = 444;
+
+        synchronized (this) {
+            lastBreak();
+        }
+
+        log.display("Debuggee PASSED");
+        return eval001.PASSED;
+    }
+
+    static private int myStaticField = Integer.MIN_VALUE;
+    protected long myInstanceField;
+    public MyClass[][] myArrayField;
+
+    private eval001a () {
+         myArrayField = new MyClass[][] {new MyClass[] {new MyClass("ABCDE")}};
+         myInstanceField = Long.MAX_VALUE;
+    }
+
+    synchronized private int myMethod() {
+        return Integer.MAX_VALUE;
+    }
+
+    static class MyClass {
+        String line;
+
+        public MyClass (String s) {
+            line = s;
+        }
+
+        public String toString() {
+             return line;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/exclude/exclude001.
+ * VM Testbase keywords: [jpda, jdb, quarantine]
+ * VM Testbase comments: JDK-8191037
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'exclude' command.
+ * The debuggee program (exclude001a.java) starts three
+ * addional threads of MyThread class. The 'run' method of these
+ * threads invokes java.lang.System.currentTimeMillis() and
+ * com.sun.jdi.Bootstrap.virtualMachineManager() methods.
+ * There are three test cases:
+ *  - block all exclude filter;
+ *  - modified exclude filter allowing tracing events for java.* methods,
+ *    which is set with 'exclude javax.*,sun.*,com.sun.*,jdk.*' command;
+ *  - modified exclude filter allowing tracing events for com.sun.* methods,
+ *    which is set with 'exclude java.*,javax.*,sun.*,jdk.*' command.
+ *  - non-modified, predefined exclude filter;
+ *  - modified exclude filter allowing tracing events for java.* methods,
+ *    which is set with 'exclude javax.*,sun.*,com.sun.*' command;
+ *  - modified exclude filter allowing tracing events for all system methods,
+ *    which is set with 'exclude none' command.
+ * For each test case the correspondent MyThread thread is started and
+ * suspended at a breakpoint. Then method tracing is turned on with
+ * 'trace methods <thread id>' command with correspondent exclude filtering.
+ * The test passes if debuggee suspends on method enter/exit of only
+ * filtered classes, i.e. in comply with exclude filter previously set.
+ * The test consists of two program:
+ *   exclude001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   exclude001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.exclude.exclude001.exclude001
+ *        nsk.jdb.exclude.exclude001.exclude001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.exclude.exclude001.exclude001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.exclude.exclude001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class exclude001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new exclude001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.exclude.exclude001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".exclude001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+
+    static final String JAVA_CORE_METHOD = "java.lang.System.currentTimeMillis";
+    static final String COM_SUN_METHOD   = "com.sun.jdi.Bootstrap.virtualMachineManager";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        String oldExclude = "";
+        boolean javaTraced = false;
+        boolean comTraced = false;
+        boolean nskTraced = false;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        // getting predefined 'exclude' value
+        reply = jdb.receiveReplyFor(JdbCommand.exclude);
+        if (reply.length == 0) {
+            log.complain("Predefined excluded lists of classes is empty");
+            success = false;
+        } else {
+
+            oldExclude = reply[0];
+
+            for (int testCase = 0; testCase < exclude001a.numThreads; testCase++) {
+
+                reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+                if (jdb.isAtBreakpoint(reply, LAST_BREAK)) {
+
+                    threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+                    if (threads.length != 1) {
+                        log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
+                        log.complain("Found: " + threads.length);
+                        success = false;
+                    } else {
+
+                        reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak;
+
+                        switch (testCase) {
+                        case 0: // block all
+                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,sun.*,com.sun.*,jdk.*");
+
+                                break;
+                        case 1: // allow java.*
+                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "javax.*,sun.*,com.sun.*,jdk.*");
+                                break;
+                        case 2: // allow com.sun.*
+                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,sun.*,jdk.");
+                                break;
+                        }
+
+                        reply = jdb.receiveReplyFor(JdbCommand.trace + "methods " + threads[0]);
+
+                        while (true) {
+                            reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+                            grep = new Paragrep(reply);
+                            count = grep.find(JAVA_CORE_METHOD);
+                            if (count > 0) {
+                                if (testCase != 0) {
+                                    javaTraced = true;
+                                } else {
+                                    log.complain("Trace message for excluded method: " + JAVA_CORE_METHOD);
+                                }
+                            }
+
+                            count = grep.find(COM_SUN_METHOD);
+                            if (count > 0) {
+                                if (testCase == 2) {
+                                    comTraced = true;
+                                } else {
+                                    log.complain("Trace message for excluded method: " + COM_SUN_METHOD);
+                                }
+                            }
+
+                            count = grep.find(DEBUGGEE_THREAD + ".run");
+                            if (count > 0) {
+                                nskTraced = true;
+
+                                reply = jdb.receiveReplyFor(JdbCommand.exclude + oldExclude);
+                                reply = jdb.receiveReplyFor(JdbCommand.untrace + "methods "+ threads[0]);
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        jdb.contToExit(2);
+
+        if (!javaTraced) {
+            log.complain("There were no tracing events for " + JAVA_CORE_METHOD + "() method while turned off filter");
+            success = false;
+        }
+        if (!comTraced) {
+            log.complain("There were no tracing events for " + COM_SUN_METHOD + "() method while turned off filter");
+            success = false;
+        }
+        if (!nskTraced) {
+            log.complain("There were no tracing events for " + DEBUGGEE_THREAD + ".run() method ");
+            success = false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.exclude.exclude001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+import com.sun.jdi.*;
+
+
+/* This is debuggee aplication */
+public class exclude001a {
+    public static void main(String args[]) {
+       exclude001a _exclude001a = new exclude001a();
+       System.exit(exclude001.JCK_STATUS_BASE + _exclude001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static final String MYTHREAD  = "MyThread";
+    static final int numThreads   = 3;   // number of threads.
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        Thread holder [] = new Thread[numThreads];
+
+        for (int i = 0; i < numThreads ; i++) {
+            holder[i] = new MyThread(MYTHREAD + "-" + i);
+            holder[i].start();
+            try {
+                holder[i].join();
+            } catch (InterruptedException e) {
+                log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                return exclude001.FAILED;
+            }
+        }
+
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return exclude001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    String name;
+
+    public MyThread (String s) {
+        super(s);
+        name = s;
+    }
+
+    public void run() {
+
+        exclude001a.lastBreak();
+
+        long time = java.lang.System.currentTimeMillis();
+
+        VirtualMachineManager vmm = com.sun.jdi.Bootstrap.virtualMachineManager();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/fields/fields001/fields001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/fields/fields001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'fields <class id>' command.
+ * There are three test cases:
+ *  - request for the fields defined in class,
+ *  - request for the fields defined in inner class,
+ *  - request for the fields inherited from super class.
+ * The test passes when reply contains names of all checked fields
+ * for a given debuggee's class.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.fields.fields001.fields001
+ *        nsk.jdb.fields.fields001.fields001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.fields.fields001.fields001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.fields.fields001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class fields001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new fields001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.fields.fields001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".fields001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String DEBUGGEE_CLASS1    = DEBUGGEE_CLASS + "$Inner";
+    static final String DEBUGGEE_CLASS2    = DEBUGGEE_CLASS + "$Extender";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String NOT_VALID_SAMPLE   = "is not a valid";
+
+    static String[] checkedFields1 = {
+        "i_st",    "o_st",
+        "i_pv",    "o_pv",
+        "i_pt",    "o_pt",
+        "i_pb",    "o_pb",
+        "i_fn",    "o_fn",
+        "i_tr",    "o_tr",
+        "i_vl",    "o_vl",
+        "i_a",     "o_a",
+        "i_aa",    "o_aa",
+        "i_aaa",   "o_aaa"
+                                      };
+
+    static String[] checkedFields2 = {
+        "ii_pv",    "oi_pv",
+        "ii_pt",    "oi_pt",
+        "ii_pb",    "oi_pb",
+        "ii_fn",    "oi_fn",
+        "ii_tr",    "oi_tr",
+        "ii_vl",    "oi_vl",
+        "ii_a",     "oi_a",
+        "ii_aa",    "oi_aa",
+        "ii_aaa",   "oi_aaa"
+                                      };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
+        if (!checkFields(DEBUGGEE_CLASS, reply, checkedFields1)) {
+            success = false;
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS1);
+        if (!checkFields(DEBUGGEE_CLASS1, reply, checkedFields2)) {
+            success = false;
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
+        if (!checkFields(DEBUGGEE_CLASS2, reply, checkedFields2)) {
+            success = false;
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkFields (String className, String[] reply, String[] checkedFields) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+        for (int i = 0; i < checkedFields.length; i++) {
+            count = grep.find(checkedFields[i]);
+            if (count == 0) {
+                log.complain("Failed to report field " + checkedFields[i] + " for class " + className);
+                result = false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/fields/fields001/fields001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.fields.fields001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class fields001a {
+
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.fields.fields001";
+
+    public static void main(String args[]) {
+       fields001a _fields001a = new fields001a();
+       System.exit(fields001.JCK_STATUS_BASE + _fields001a.runIt(args, System.out));
+    }
+
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return fields001.PASSED;
+    }
+
+    static     int i_st;
+    private    int i_pv;
+    protected  int i_pt;
+    public     int i_pb;
+    final      int i_fn = 0;;
+    transient  int i_tr;
+    volatile   int i_vl;
+    int []      i_a;
+    int [][]    i_aa;
+    int [][][]  i_aaa;
+
+    static     Object o_st;
+    private    Object o_pv;
+    protected  Object o_pt;
+    public     Object o_pb;
+    final      Object o_fn = new Object();
+    transient  Object o_tr;
+    volatile   Object o_vl;
+    Object []     o_a;
+    Object [][]   o_aa;
+    Object [][][] o_aaa;
+
+    class Inner {
+        private    int ii_pv;
+        protected  int ii_pt;
+        public     int ii_pb;
+        final      int ii_fn = 0;;
+        transient  int ii_tr;
+        volatile   int ii_vl;
+        int []      ii_a;
+        int [][]    ii_aa;
+        int [][][]  ii_aaa;
+
+        private    Object oi_pv;
+        protected  Object oi_pt;
+        public     Object oi_pb;
+        final      Object oi_fn = new Object();
+        transient  Object oi_tr;
+        volatile   Object oi_vl;
+        Object []     oi_a;
+        Object [][]   oi_aa;
+        Object [][][] oi_aaa;
+    }
+
+    class Extender extends Inner {};
+
+    Inner inner;
+    Extender extender;
+
+    public fields001a() {
+        inner = new Inner();
+        extender = new Extender();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/ignore/ignore001/ignore001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/ignore/ignore001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'ignore <class_id>' command.
+ * The tests sets catch hooks for two different exception
+ * which are thrown in the debuggee. Then these hooks are
+ * removed by 'ignore' command. The test checks the jdb does
+ * not halt execution on removed catch hooks.
+ * COMMENTS
+ *  The test was updated due fix of the bug 4683795.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.ignore.ignore001.ignore001
+ *        nsk.jdb.ignore.ignore001.ignore001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.ignore.ignore001.ignore001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.ignore.ignore001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class ignore001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new ignore001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.ignore.ignore001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".ignore001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String EXCEPTION_SAMPLE   = "Exception occurred:";
+    static final String REMOVED_SAMPLE     = "Removed:";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+//        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        log.display("Setting catch for: " + nsk.jdb.ignore.ignore001.ignore001a.JAVA_EXCEPTION);
+        reply = jdb.receiveReplyFor(JdbCommand._catch + " caught " + nsk.jdb.ignore.ignore001.ignore001a.JAVA_EXCEPTION);
+
+        log.display("Setting catch for: " + nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION1);
+        reply = jdb.receiveReplyFor(JdbCommand._catch + " caught " + nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION1);
+
+        log.display("Setting catch for: " + nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION2);
+        reply = jdb.receiveReplyFor(JdbCommand._catch + " caught " + nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION2);
+
+        for (;;) {
+            if (!checkCatch(nsk.jdb.ignore.ignore001.ignore001a.JAVA_EXCEPTION)) {
+               success = false;
+            }
+            if (!checkCatch(nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION1)) {
+               success = false;
+            }
+            if (!checkCatch(nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION2)) {
+               success = false;
+            }
+
+            if (!checkIgnore(nsk.jdb.ignore.ignore001.ignore001a.JAVA_EXCEPTION)) {
+               success = false;
+            }
+            if (!checkIgnore(nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION1)) {
+               success = false;
+            }
+            if (!checkIgnore(nsk.jdb.ignore.ignore001.ignore001a.USER_EXCEPTION2)) {
+               success = false;
+            }
+
+            jdb.contToExit(6);
+
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            count = grep.find(EXCEPTION_SAMPLE);
+            if (count != 3) {
+                success = false;
+                log.complain("Should report 3 catched exceptions.");
+                log.complain("Reported catched exception count is " + count);
+            }
+            break;
+        }
+    }
+
+    private boolean checkCatch (String exceptionName) {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        boolean result = true;
+
+//        log.display("Resuming debuggee.");
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        v = new Vector();
+        v.add(EXCEPTION_SAMPLE);
+        v.add(exceptionName);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(v);
+        if (found.length() == 0) {
+            log.complain("Failed to catch " + exceptionName);
+            result = false;
+        }
+        return result;
+    }
+
+    private boolean checkIgnore (String exceptionName) {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        boolean result = true;
+
+        log.display("Unsetting catch for: " + exceptionName);
+        reply = jdb.receiveReplyFor(JdbCommand.ignore + " caught " + exceptionName);
+
+        v = new Vector();
+        v.add(REMOVED_SAMPLE);
+        v.add(exceptionName);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(v);
+        if (found.length() == 0) {
+            log.complain("Failed to remove catch for " + exceptionName);
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/ignore/ignore001/ignore001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.ignore.ignore001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class ignore001a {
+
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.ignore.ignore001";
+    static final String JAVA_EXCEPTION = "java.lang.NumberFormatException";
+    static final String USER_EXCEPTION1 = PACKAGE_NAME + ".ignore001a$Exception1";
+    static final String USER_EXCEPTION2 = PACKAGE_NAME + ".Exception2";
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    public static void main(String args[]) {
+       ignore001a _ignore001a = new ignore001a();
+       System.exit(ignore001.JCK_STATUS_BASE + _ignore001a.runIt(args, System.out));
+    }
+
+//    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        for (int i = 0; i < 6; i++) {
+            a(i);
+        }
+
+        log.display("Debuggee PASSED");
+        return ignore001.PASSED;
+    }
+
+    private void a (int i) {
+        try {
+            switch (i) {
+            case 0: case 3:
+                log.display("Throwing NumberFormatException, i = " + i);
+                throw new java.lang.NumberFormatException();
+            case 1: case 4:
+                log.display("Throwing Exception1, i = " + i);
+                throw new Exception1();
+            case 2: case 5:
+                log.display("Throwing Exception2, i = " + i);
+                throw new Exception2();
+            }
+        } catch (java.lang.NumberFormatException e0) {
+        } catch (Exception1 e1) {
+        } catch (Exception2 e2) {
+        }
+//        lastBreak();
+    }
+
+    class Exception1 extends Exception {}
+}
+
+class Exception2 extends Exception {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/interrupt/interrupt001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'interrupt <thread id>' command.
+ * The debuggee program (interrupt001a.java) creates a number of additional
+ * threads with name like "MyThread-<number>" and starts them. The jdb
+ * suspends the debuggee at a moment when the additional threads are
+ * waiting for notification for lock objects and then tries to interrupt them.
+ * If these threads are interrupted then a value of the special
+ * "notInterrupted" variable should not be modified.
+ * Value of "notInterrupted" variable is checked by "eval <expr>" command.
+ * The test passes if the value is equal to 0 and fails otherwise..
+ * COMMENTS
+ * Modified due to fix of the bug:
+ *  4760826 TTY: 'interrupt <threadID>' command sometimes does not work in Mantis
+ * Modified due to fix of the bug:
+ *  4974992 Missed prompt with jdb testcase nsk/jdb/interrupt/interrupt001
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.interrupt.interrupt001.interrupt001
+ *        nsk.jdb.interrupt.interrupt001.interrupt001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.interrupt.interrupt001.interrupt001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.interrupt.interrupt001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class interrupt001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        return new interrupt001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.interrupt.interrupt001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".interrupt001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".breakHere";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = DEBUGGEE_CLASS + "$" + MYTHREAD;
+    static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notInterrupted.get()";
+
+    static int numThreads = nsk.jdb.interrupt.interrupt001.interrupt001a.numThreads;
+
+    private static Pattern tidPattern = Pattern.compile("(0x[0-9a-f]+)");
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != numThreads) {
+            log.complain("jdb should report " + numThreads + " instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        pauseTillAllThreadsWaiting(threads);
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.interrupt + threads[i]);
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.threads);
+        reply = jdb.receiveReplyFor(JdbCommand.cont, true);
+
+        reply = jdb.receiveReplyFor(JdbCommand.eval + DEBUGGEE_RESULT);
+        grep = new Paragrep(reply);
+        found = grep.findFirst(DEBUGGEE_RESULT + " =" );
+        if (found.length() > 0) {
+            if (found.indexOf(DEBUGGEE_RESULT + " = 0") < 0) {
+               log.complain("Not all " + MYTHREAD + "s were interrupted.");
+               log.complain(found);
+               success = false;
+            }
+        } else {
+            log.complain("TEST BUG: not found value for " + DEBUGGEE_RESULT);
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private void pauseTillAllThreadsWaiting(String[] threads) {
+        String[] reply;
+        boolean tidswaiting = false;
+
+        Set<String> tids = new HashSet<>(Arrays.asList(threads));
+        Set<String> waitingTids = null;
+
+        do {
+            String[] thrdsRply = (String[])jdb.receiveReplyFor(JdbCommand.threads);
+            waitingTids = Arrays.asList(thrdsRply).stream()
+                .filter((r)-> r.endsWith("waiting"))
+                .map((r)->{
+                    Matcher m = tidPattern.matcher(r);
+                    if (m.find()) {
+                        return m.group(1);
+                    }
+                    return null;
+                })
+                .filter((r)-> r != null)
+                .collect(Collectors.toSet());
+
+            // If all Tids are waiting set allWorkersAreWaiting to true so
+            // the main test thread will get out of its breakpoint loop
+            // and continue with the test.
+            if (waitingTids.containsAll(tids)) {
+                reply = jdb.receiveReplyFor(JdbCommand.set + DEBUGGEE_CLASS + ".allWorkersAreWaiting=true");
+                tidswaiting = true;
+            } else {
+                reply = jdb.receiveReplyFor(JdbCommand.cont);
+            }
+        } while (!tidswaiting);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/interrupt/interrupt001/interrupt001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.interrupt.interrupt001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/* This is debuggee aplication */
+public class interrupt001a {
+    private class MyThread extends Thread {
+        final Object lock;
+        int ind;
+        String name;
+
+        public MyThread (Object l, int i, String n) {
+            lock = l;
+            ind = i;
+            name = n;
+        }
+
+        public void run() {
+            synchronized (lock) {
+                synchronized (waitnotify) {
+                    threadRunning = true;
+                    waitnotify.notify();
+                }
+
+                try {
+                    flags[ind] = false;
+                    while (!flags[ind]) {
+                        lock.wait();
+                    }
+                } catch (InterruptedException e) {
+                    notInterrupted.decrementAndGet();
+                    synchronized (waitnotify) {
+                        waitnotify.notify();
+                    }
+                }
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+       interrupt001a _interrupt001a = new interrupt001a();
+       System.exit(interrupt001.JCK_STATUS_BASE + _interrupt001a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    static final String MYTHREAD        = "MyThread";
+    static final int numThreads         = 5;   // number of threads
+    static volatile boolean allWorkersAreWaiting = false;
+
+    private final Object waitnotify            = new Object();
+    private volatile boolean threadRunning;
+    private volatile boolean[] flags     = new boolean[numThreads];
+
+    private JdbArgumentHandler argumentHandler;
+    private Log log;
+
+    public static final AtomicInteger notInterrupted = new AtomicInteger(numThreads);
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        int i;
+        Thread[] holder = new Thread[numThreads];
+        Object[] locks = new Object[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            locks[i] = new Object();
+            holder[i] = new MyThread(locks[i], i, MYTHREAD + "-" + i);
+        }
+
+        synchronized (waitnotify) {
+            for (i = 0; i < numThreads ; i++) {
+                holder[i].start();
+                try {
+                     threadRunning = false;
+                     while (!threadRunning) {
+                         waitnotify.wait();
+                     }
+                } catch (InterruptedException e) {
+                    log.complain("Main thread was interrupted while waiting for start of " + MYTHREAD + "-" + i);
+                    return interrupt001.FAILED;
+                }
+            }
+        }
+
+        // allWorkersAreWaiting will be set to true by the debugger thread
+        // when it sees all of the worker treads are waiting.
+        do {
+            breakHere();  // a break to get thread ids and then to interrupt MyThreads.
+        } while (!allWorkersAreWaiting);
+
+        long waitTime = argumentHandler.getWaitTime() * 60 * 1000;
+        long startTime = System.currentTimeMillis();
+        while (notInterrupted.get() > 0 && System.currentTimeMillis() - startTime <= waitTime) {
+            synchronized (waitnotify) {
+                try {
+                    waitnotify.wait(waitTime);
+                } catch (InterruptedException e) {
+                    log.display("Main thread was interrupted while waiting");
+                }
+            }
+        }
+        for (i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                synchronized (locks[i]) {
+                    flags[i] = true;
+                    locks[i].notifyAll();
+                }
+            }
+        }
+        breakHere(); // a break to check if MyThreads were interrupted
+
+        log.display("Debuggee PASSED");
+        return interrupt001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/kill/kill001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'kill <thread id> <expr>' command.
+ * The debuggee program (kill001a.java) creates a number of additional
+ * threads with name like "MyThread-<number>" and starts them. The jdb
+ * suspends debuggee at moment when additional threads try to obtain
+ * lock on synchronized object (previously locked in main thread)
+ * and then tries to kill them. If these threads are killed then
+ * a value of the special "notKilled" variable should not be modified.
+ * Value of "notKilled" variable is checked by "eval <expr>" command.
+ * The test passes if the value is equal to 0 and fails otherwise..
+ * COMMENTS
+ *  Modified due to fix of the test bug:
+ *  4940902 TEST_BUG: race in nsk/jdb/kill/kill001
+ *  Modified due to fix of the bug:
+ *  5024081 TEST_BUG: nsk/jdb/kill/kill001 is slow
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.kill.kill001.kill001
+ *        nsk.jdb.kill.kill001.kill001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.kill.kill001.kill001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.kill.kill001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class kill001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        return new kill001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.kill.kill001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".kill001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".breakHere";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+    static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notKilled";
+    static final String DEBUGGEE_EXCEPTIONS = DEBUGGEE_CLASS + ".exceptions";
+
+    static int numThreads = nsk.jdb.kill.kill001.kill001a.numThreads;
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != numThreads) {
+            log.complain("jdb should report " + numThreads + " instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyForWithMessageWait(JdbCommand.kill + threads[i] + " " +
+                                                       DEBUGGEE_EXCEPTIONS + "[" + i + "]",
+                                                       "killed");
+        }
+
+        for (int i = 0; i <= numThreads; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+        }
+
+        // make sure the debugger is at a breakpoint
+        if (!jdb.isAtBreakpoint(reply, LAST_BREAK)) {
+            log.display("Expected breakpoint has not been hit yet");
+            jdb.waitForMessage(0, LAST_BREAK);
+        }
+        log.display("Breakpoint has been hit");
+
+        reply = jdb.receiveReplyForWithMessageWait(JdbCommand.eval + DEBUGGEE_RESULT,
+                                                   DEBUGGEE_RESULT + " =");
+        grep = new Paragrep(reply);
+        found = grep.findFirst(DEBUGGEE_RESULT + " =" );
+        if (found.length() > 0) {
+            if (found.indexOf(DEBUGGEE_RESULT + " = 0") < 0) {
+               log.complain("Not all " + MYTHREAD + "s were killed. " + found + " remaining");
+               success = false;
+            }
+        } else {
+            log.complain("Value for " + DEBUGGEE_RESULT + " is not found.");
+            success = false;
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.threads);
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill001/kill001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.kill.kill001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+/* This is debuggee aplication */
+public class kill001a {
+    public static void main(String args[]) {
+       kill001a _kill001a = new kill001a();
+       System.exit(kill001.JCK_STATUS_BASE + _kill001a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    static final String MYTHREAD         = "MyThread";
+    static final int numThreads          = 5;   // number of threads. one lock per thread.
+    static Object lock                   = new Object();
+    static Object waitnotify             = new Object();
+    public static volatile int notKilled = 0;
+    static final String message          = "kill001a's Exception";
+    static int waitTime;
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static final Throwable[] exceptions = {
+                    new ThreadDeath(),
+                    new NullPointerException(message),
+                    new SecurityException(message),
+                    new com.sun.jdi.IncompatibleThreadStateException(message),
+                    new MyException(message)
+                                          };
+
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+        waitTime = argumentHandler.getWaitTime() * 60 * 1000;
+
+        int i;
+        Thread holder [] = new Thread[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            holder[i] = new MyThread(MYTHREAD + "-" + i);
+        }
+
+        // lock monitor to prevent threads from finishing after they started
+        synchronized (lock) {
+            synchronized (waitnotify) {
+                for (i = 0; i < numThreads ; i++) {
+                    holder[i].start();
+                    try {
+                        waitnotify.wait();
+                    } catch (InterruptedException e) {
+                        log.complain("Main thread was interrupted while waiting for start of " + MYTHREAD + "-" + i);
+                        return kill001.FAILED;
+                    }
+                }
+            }
+            breakHere();  // a break to get thread ids and then to kill MyThreads.
+        }
+
+        // wait during watTime until all MyThreads will be killed
+        long oldTime = System.currentTimeMillis();
+        while ((System.currentTimeMillis() - oldTime) <= kill001a.waitTime) {
+            boolean waited = false;
+            for (i = 0; i < numThreads ; i++) {
+                if (holder[i].isAlive()) {
+                    waited = true;
+                    try {
+                        synchronized(waitnotify) {
+                            waitnotify.wait(1000);
+                        }
+                    } catch (InterruptedException e) {
+                        log.display("Main thread was interrupted while waiting for killing of " + MYTHREAD + "-" + i);
+                    }
+                }
+            }
+            if (!waited) {
+                break;
+            }
+        }
+        breakHere(); // a break to check if MyThreads were killed
+        log.display("notKilled == " + notKilled);
+
+        for (i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                log.display("Debuggee FAILED");
+                return kill001.FAILED;
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return kill001.PASSED;
+    }
+
+    static class MyException extends Exception {
+        MyException (String message) {
+            super(message);
+        }
+    }
+}
+
+
+class MyThread extends Thread {
+    String name;
+
+    public MyThread (String n) {
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        String ThreadFinished = "WARNING: Thread finished: " + this.name;
+        String ThreadInterrupted = "WARNING: Thread was interrupted while waiting for killing: " + this.name;
+        kill001a.log.display("Thread started: " + this.name);
+
+        synchronized (kill001a.waitnotify) {
+            kill001a.waitnotify.notify();
+        }
+        // prevent thread from early finish
+        synchronized (kill001a.lock) {}
+
+        // sleep during waitTime to give debugger a chance to kill debugee's thread
+        try {
+            Thread.currentThread().sleep(kill001a.waitTime);
+        } catch (InterruptedException e) {
+            kill001a.log.display(ThreadInterrupted);
+            e.printStackTrace(kill001a.log.getOutStream());
+        }
+
+        kill001a.notKilled++;
+        kill001a.log.display(ThreadFinished);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill002/kill002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/kill/kill002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'kill <thread id> <expr>' command.
+ * The debuggee program (kill002a.java) creates a number of additional
+ * threads with name like "MyThread-<number>" and starts them. The jdb
+ * suspends debuggee at moment when additional threads are
+ * waiting for notification for lock objects and then tries to kill them.
+ * If these threads are killed then a value of the special
+ * "notKilled" variable should not be modified.
+ * Value of "notKilled" variable is checked by "eval <expr>" command.
+ * The test passes if the value is equal to 0 and fails otherwise..
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.kill.kill002.kill002
+ *        nsk.jdb.kill.kill002.kill002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.kill.kill002.kill002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.kill.kill002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class kill002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        return new kill002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.kill.kill002";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".kill002";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".breakHere";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+    static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notKilled";
+    static final String DEBUGGEE_EXCEPTIONS = DEBUGGEE_CLASS + ".exceptions";
+
+    static int numThreads = nsk.jdb.kill.kill002.kill002a.numThreads;
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != numThreads) {
+            log.complain("jdb should report " + numThreads + " instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyForWithMessageWait(JdbCommand.kill + threads[i] + " " +
+                                                       DEBUGGEE_EXCEPTIONS + "[" + i + "]",
+                                                       "killed");
+        }
+        reply = jdb.receiveReplyFor(JdbCommand.threads);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // make sure the debugger is at a breakpoint
+        if (!jdb.isAtBreakpoint(reply, LAST_BREAK)) {
+            log.display("Expected breakpoint has not been hit yet");
+            jdb.waitForMessage(0, LAST_BREAK);
+        }
+        log.display("Breakpoint has been hit");
+
+        reply = jdb.receiveReplyForWithMessageWait(JdbCommand.eval + DEBUGGEE_RESULT,
+                                            DEBUGGEE_RESULT + " =");
+        grep = new Paragrep(reply);
+        found = grep.findFirst(DEBUGGEE_RESULT + " =" );
+        if (found.length() > 0) {
+            if (found.indexOf(DEBUGGEE_RESULT + " = 0") < 0) {
+               log.complain("Not all " + MYTHREAD + "s were killed. " + found + " remaining");
+               success = false;
+            }
+        } else {
+            log.complain("Value for " + DEBUGGEE_RESULT + " is not found.");
+            success = false;
+        }
+
+        jdb.contToExit(numThreads + 1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/kill/kill002/kill002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.jdb.kill.kill002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class kill002a {
+    public static void main(String args[]) {
+       kill002a _kill002a = new kill002a();
+       System.exit(kill002.JCK_STATUS_BASE + _kill002a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    static final String MYTHREAD         = "MyThread";
+    static final int numThreads          = 5;   // number of threads
+    static Object waitnotify             = new Object();
+    public static volatile int notKilled = 0;
+    static final String message          = "kill002a's Exception";
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static final Exception[] exceptions = {
+                    new InterruptedException(message),
+                    new NullPointerException(message),
+                    new SecurityException(message),
+                    new com.sun.jdi.IncompatibleThreadStateException(message),
+                    new MyException(message)
+                                          };
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        int i;
+        Thread[] holder = new Thread[numThreads];
+        Object[] locks = new Object[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            locks[i] = new Object();
+            holder[i] = new MyThread(locks[i], MYTHREAD + "-" + i);
+        }
+
+        synchronized (waitnotify) {
+            for (i = 0; i < numThreads ; i++) {
+                holder[i].start();
+                try {
+                    waitnotify.wait();
+                } catch (InterruptedException e) {
+                    log.complain("Main thread was interrupted while waiting for start of " + MYTHREAD + "-" + i);
+                    return kill002.FAILED;
+                }
+
+                synchronized (locks[i]) {  // holder[i] must wait on its lock[i] at this moment.
+                    log.display("Thread " + MYTHREAD + "-" + i + " is waiting");
+                }
+            }
+        }
+        breakHere();  // a break to get thread ids and then to kill MyThreads.
+
+        // waits on all MyThreads completion in case they were not killed
+        for (i = 0; i < numThreads ; i++) {
+            synchronized (locks[i]) {
+                locks[i].notifyAll();
+            }
+            if (holder[i].isAlive() && !holder[i].interrupted()) {
+                try {
+                    holder[i].join();
+                } catch (InterruptedException e) {
+                    log.display("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                }
+            }
+        }
+        breakHere(); // a break to check if MyThreads were killed
+
+        log.display("notKilled == " + notKilled);
+        log.display("Debuggee PASSED");
+        return kill002.PASSED;
+    }
+
+    static class MyException extends Exception {
+        MyException (String message) {
+            super(message);
+        }
+    }
+}
+
+
+class MyThread extends Thread {
+    Object lock;
+    String name;
+
+    public MyThread (Object l, String n) {
+        lock = l;
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        final String ThreadFinished = "WARNING: Thread finished: " + this.name;
+        String ThreadInterrupted = "WARNING: Thread was interrupted while waiting for killing: " + this.name;
+        kill002a.log.display("Thread started: " + this.name);
+
+        synchronized (lock) {
+            synchronized (kill002a.waitnotify) {
+                kill002a.waitnotify.notify();
+            }
+
+            try {
+                lock.wait();
+                kill002a.notKilled++;
+                kill002a.log.display(ThreadFinished);
+            } catch (Exception e) {
+                kill002a.log.display(ThreadInterrupted);
+                e.printStackTrace(kill002a.log.getOutStream());
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/klass/class001/class001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/class/class001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'class <class_id>' command.
+ * The test checks if jdb correctly replies on request for
+ * given debuggee class via 'class' command.
+ * The test fails if :
+ *   - string "is not a valid" found in reply,
+ *   - reply does not contain full name of a checked class.
+ * Otherwise the test passes.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.klass.class001.class001
+ *        nsk.jdb.klass.class001.class001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.klass.class001.class001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.klass.class001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class class001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new class001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.klass.class001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".class001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String NOT_VALID_SAMPLE   = "is not a valid";
+
+    static String[] checkedClasses = {
+        DEBUGGEE_CLASS,
+        DEBUGGEE_CLASS + "$InnerInt1",
+        DEBUGGEE_CLASS + "$Inner2",
+        DEBUGGEE_CLASS + "$Inner3",
+        DEBUGGEE_CLASS + "$Inner4",
+        DEBUGGEE_CLASS + "$Inner5",
+        DEBUGGEE_CLASS + "$Inner6",
+        PACKAGE_NAME + ".Outer1"
+                                      };
+
+    /* ------------------------------------- */
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        for (int i = 0; i < checkedClasses.length; i++) {
+            if (!checkClass(checkedClasses[i])) {
+                success = false;
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkClass (String className) {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        String found;
+        boolean result = true;
+
+        reply = jdb.receiveReplyFor(JdbCommand._class + className);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(NOT_VALID_SAMPLE);
+        if (found.length() > 0) {
+            log.complain("Failed to report class " + className);
+            result = false;
+        }
+        found = grep.findFirst(className);
+        if (found.length() == 0) {
+            log.complain("Failed to report class " + className);
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/klass/class001/class001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.klass.class001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class class001a {
+
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.klass.class001";
+
+    public static void main(String args[]) {
+       class001a _class001a = new class001a();
+       System.exit(class001.JCK_STATUS_BASE + _class001a.runIt(args, System.out));
+    }
+
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        init();
+
+        log.display("Debuggee PASSED");
+        return class001.PASSED;
+    }
+
+    interface InnerInt1 {}
+    public class Inner2 implements InnerInt1 {}
+    private class Inner3 {}
+    protected class Inner4 {}
+    abstract class Inner5 {}
+    final class Inner6 extends Inner5{}
+
+    private void init () {
+        Outer1 o1 = new Outer1();
+        Inner2 i2 = new Inner2();
+        Inner3 i3 = new Inner3();
+        Inner4 i4 = new Inner4();
+        Inner6 i6 = new Inner6();
+
+        lastBreak();
+    }
+}
+
+class Outer1 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/list/list002/list002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/list/list002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the 'list' command.
+ *  It lists the source of given method and the source on a given line.
+ *  The test passes if it find expected strings in jdb's output.
+ *  The test consists of two parts:
+ *    list002.java  - test driver, i.e. launches jdb and debuggee,
+ *                    writes commands to jdb, reads the jdb output,
+ *    list002a.java - the debugged application.
+ * COMMENTS
+ *  The test functionally equals to nsk/jdb/list/list001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @build nsk.jdb.list.list002.list002
+ *        nsk.jdb.list.list002.list002a
+ * @run driver jdk.test.lib.FileInstaller list002a.java src/nsk/jdb/list/list002/list002a.java
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.list.list002.list002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      "-jdb.option=-sourcepath src/"
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.list.list002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class list002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new list002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.list.list002";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".list002";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".runIt";
+    static final int    LINE_NUMBER     = 38;
+
+    final static String METHOD_SOURCE[] = new String[] {
+        "public int runIt(String args[], PrintStream out) {",
+        "JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);",
+        "Log log = new Log(out, argumentHandler);",
+        "log.display(\"Debuggee PASSED\");",
+        "return list002.PASSED;"
+                                                    };
+
+    final static String LINE_SOURCE =
+        "System.exit(list002.JCK_STATUS_BASE + _list002a.runIt(args, System.out));";
+
+    final static String SOURCE_NOT_FOUND = "Source file not found";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.list + "runIt");
+        grep = new Paragrep(reply);
+        if (grep.find(SOURCE_NOT_FOUND) > 0) {
+            failure(reply[0]);
+        } else {
+            for (int i = 0; i < METHOD_SOURCE.length; i++) {
+                if (grep.find(METHOD_SOURCE[i]) == 0) {
+                    failure("Line is not found in method sources:\n\t"+
+                        METHOD_SOURCE[i]);
+                }
+            }
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.list + LINE_NUMBER);
+        grep = new Paragrep(reply);
+        if (grep.find(SOURCE_NOT_FOUND) > 0) {
+            failure(reply[0]);
+        } else {
+            if (grep.find(LINE_SOURCE) == 0) {
+                failure("Line " + LINE_NUMBER + " is not found:\n\t"+
+                    LINE_SOURCE);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/list/list002/list002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.list.list002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/* This is debuggee aplication */
+public class list002a {
+    static list002a _list002a = new list002a();
+
+    public static void main(String args[]) { // list002.LINE_NUMBER
+       System.exit(list002.JCK_STATUS_BASE + _list002a.runIt(args, System.out));
+    }
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return list002.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/locals/locals002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the 'locals' command.
+ *  The test sets breakpoints in 'allKindsOfLocals' and 'allKindsOfArgs'
+ *  methods of debugged 'locals002a' class. Once the debuggee is
+ *  suspended in method, the test via 'locals' command compares
+ *  the values of all visible variables with expected ones.
+ *  The test consists of two parts:
+ *    locals002.java  - test driver, i.e. launches jdb and debuggee,
+ *                       writes commands to jdb, reads the jdb output,
+ *    locals002a.java - the debugged application.
+ * COMMENTS
+ *  The test functionally equals to nsk/jdb/locals/locals001 test
+ *  and replaces it.
+ *  Test fixed according to test bug:
+ *     5045859 TEST_BUG: some JDB tests do not recognize JDB prompt
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.locals.locals002.locals002
+ *
+ * @comment make sure locals002a is compiled w/ full debug info
+ * @clean nsk.jdb.locals.locals002.locals002a
+ * @compile -g:lines,source,vars locals002a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.locals.locals002.locals002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.locals.locals002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class locals002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        compoundPromptIdent = COMPOUND_PROMPT_IDENT;
+        return new locals002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.locals.locals002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".locals002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String COMPOUND_PROMPT_IDENT = "main";
+    static final int    BREAKPOINT_LINE1 = 84;
+    static final int    BREAKPOINT_LINE2 = 100;
+
+    static final String LOCALS[][] = new String[][] {
+       { "boolVar"  , "true"         , "false"         },
+       { "byteVar"  , "27"           , "12"            },
+       { "charVar"  , "V"            , "A"             },
+       { "shortVar" , "767"          , "327"           },
+       { "intVar"   , "1474"         , "3647"          },
+       { "longVar"  , "21345"        , "65789"         },
+       { "floatVar" , "3.141"        , "4.852"         },
+       { "doubleVar", "2.578"        , "3.8976"        },
+       { "objVar"   , "objVarString" , "objArgString"  },
+       { "arrVar"   , "int[5]"       , "int[3]"        }
+
+                                                    };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + BREAKPOINT_LINE1);
+        jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + BREAKPOINT_LINE2);
+
+        jdb.receiveReplyFor(JdbCommand.cont);
+        reply = jdb.receiveReplyFor(JdbCommand.locals);
+        grep = new Paragrep(reply);
+        for (int i = 0; i < LOCALS.length; i++) {
+            v = new Vector();
+            v.add(LOCALS[i][0]);
+            v.add(LOCALS[i][2]);
+            if (grep.find(v) == 0) {
+                failure("Cannot find " + LOCALS[0][0] +
+                    " with expected value: " + LOCALS[i][2]);
+            }
+        }
+
+        jdb.receiveReplyFor(JdbCommand.cont);
+        reply = jdb.receiveReplyFor(JdbCommand.locals);
+        grep = new Paragrep(reply);
+        for (int i = 0; i < LOCALS.length; i++) {
+            v = new Vector();
+            v.add(LOCALS[i][0]);
+            v.add(LOCALS[i][1]);
+            if (grep.find(v) == 0) {
+                failure("Cannot find " + LOCALS[0][0] +
+                    " with expected value: " + LOCALS[i][1]);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkStop () {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        Vector v;
+        boolean result = true;
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.locals.locals002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class locals002a {
+    static locals002a _locals002a = new locals002a();
+
+    public static void main(String args[]) {
+       System.exit(locals002.JCK_STATUS_BASE + _locals002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int arr[] = new int[3];
+
+        for (int i = 0 ; i < 3 ; i++) arr[i] = i*i;
+
+        allKindsOfVars (
+            false,
+            (byte)12,
+            'A',
+            (short)327,
+            3647,
+            (long)65789,
+            (float)4.852,
+            (double)3.8976,
+            "objArgString",
+            arr
+                       );
+
+        allKindsOfLocals();
+
+        log.display("Debuggee PASSED");
+        return locals002.PASSED;
+    }
+
+   public void allKindsOfVars (
+       boolean boolVar,
+       byte    byteVar,
+       char    charVar,
+       short   shortVar,
+       int     intVar,
+       long    longVar,
+       float   floatVar,
+       double  doubleVar,
+       Object  objVar,
+       int[]   arrVar
+                              )
+   {
+       System.out.println("Arguments but no locals"); // locals002.BREAKPOINT_LINE1
+   }
+
+   static void allKindsOfLocals()  {
+       boolean boolVar   = true;
+       byte    byteVar   = 27;
+       char    charVar   = 'V';
+       short   shortVar  = (short)767;
+       int     intVar    = 1474;
+       long    longVar   = (long)21345;
+       float   floatVar  = (float)3.141;
+       double  doubleVar = (double)2.578;
+       Object  objVar    = "objVarString";
+       int[]   arrVar    = new int[5];
+
+       for (int j = 0; j < 5 ; j++) arrVar[j] = j;
+       System.out.println("Locals but no arguments"); // locals002.BREAKPOINT_LINE2
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/methods/methods002/methods002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/methods/methods002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the 'methods' command.
+ *  The test checks the following cases
+ *    - class with various method modifiers,
+ *    - class with various constructors,
+ *    - class with various overloaded methods,
+ *    - abstract class and interface,
+ *    - implementing class,
+ *    - class with inherited methods,
+ *    - class with inherited and overrided methods.
+ *  The test passes if signatures for all expected methods are listed
+ *  in reply on command for every case.
+ *  The test consists of two parts:
+ *    methods002.java  - test driver, i.e. launches jdb and debuggee,
+ *                       writes commands to jdb, reads the jdb output,
+ *    methods002a.java - the debugged application.
+ * COMMENTS
+ *  This test replaces the nsk/jdb/methods/methods001 one.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.methods.methods002.methods002
+ *        nsk.jdb.methods.methods002.methods002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.methods.methods002.methods002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.methods.methods002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class methods002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new methods002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.methods.methods002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".methods002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // Case for class with method modifiers
+        String testedClass1 = TEST_CLASS + "a";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass1);
+        for (int i = 1; i <= 33; i++) {
+            checkMethod( reply, "m" + intToString(i), 1, testedClass1, testedClass1 );
+        }
+        for (int i = 1; i <= 3; i++) {
+            checkMethod( reply, "f" + intToString(i), 1, testedClass1, testedClass1 );
+        }
+
+        // Case for class with many constructors
+        String testedClass2 = TEST_CLASS + "b";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass2);
+        String[] reply1 = toStringArray(reply);  // on Windows reply is single string with embedded \r\n symbols
+        checkMethod( reply1, "<init>", 4, testedClass2, testedClass2 );
+
+        // Case for class with overloaded methods
+        String testedClass3 = TEST_CLASS + "c";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass3);
+        reply1 = toStringArray(reply);   // // on Windows reply is single string with embedded \r\n symbols
+        checkMethod( reply1, "m01", 3, testedClass3, testedClass3 );
+
+        // Case for abstract class
+        String testedClass4 = TEST_CLASS + "d";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass4);
+        checkMethod( reply, "m01", 1, testedClass4, testedClass4 );
+
+        // Case for interface
+        String testedClass5 = TEST_CLASS + "i";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass5);
+        checkMethod( reply, "i01", 1, testedClass5, testedClass5 );
+
+        // Case for class with implemented method
+        String testedClass6 = TEST_CLASS + "e";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass6);
+        checkMethod( reply, "m01", 1, testedClass4, testedClass6 );
+        checkMethod( reply, "i01", 1, testedClass5, testedClass6 );
+        checkMethod( reply, "m01", 1, testedClass6, testedClass6 );
+
+        // Case for class with inherited methods
+        String testedClass7 = TEST_CLASS + "f";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass7);
+        for (int i = 1; i <= 33; i++) {
+            checkMethod( reply, "m" + intToString(i), 1, testedClass1, testedClass7 );
+        }
+        for (int i = 1; i <= 3; i++) {
+            checkMethod( reply, "f" + intToString(i), 1, testedClass1, testedClass7 );
+        }
+
+        // Case for class with inherited and overrided methods
+        String testedClass8 = TEST_CLASS + "g";
+        reply = jdb.receiveReplyFor(JdbCommand.methods + testedClass8);
+        for (int i = 1; i <= 33; i++) {
+            checkMethod( reply, "m" + intToString(i), 1, testedClass8, testedClass8 );
+        }
+        for (int i = 1; i <= 33; i++) {
+            checkMethod( reply, "m" + intToString(i), 1, testedClass1, testedClass8 );
+        }
+        for (int i = 1; i <= 3; i++) {
+            checkMethod( reply, "f" + intToString(i), 1, testedClass1, testedClass8 );
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private void checkMethod (
+        String[] reply,       /* reply on 'methods' command */
+        String methodName,    /* method name */
+        int expOccur,         /* expected number of occurences of the method */
+        String ownerClass,    /* name of class defining method */
+        String testedClass    /* name of tested class */
+                             ) {
+
+        Paragrep grep = new Paragrep(reply);
+        Vector v = new Vector();
+
+        v.add(ownerClass);
+        v.add(methodName);
+        int j = grep.find(v);
+        if (j != expOccur) {
+            failure("Wrong number of occurences of method " + methodName +
+                "\n\t of class " + ownerClass +
+                "\n\t in class " + testedClass +
+                "\n\t expected number: " + expOccur + " got: " + j);
+        }
+    }
+
+    private String[] toStringArray (String[] arr) {
+        Vector v = new Vector();
+        for (int i = 0; i < arr.length; i++) {
+            StringTokenizer st = new StringTokenizer(arr[i], "\r\n");
+            while (st.hasMoreTokens()) {
+                v.add(st.nextToken());
+            }
+        }
+        Object[] objects = v.toArray();
+        String[] results = new String[objects.length];
+        for (int i = 0; i < objects.length; i++) {
+            results[i] = (String)objects[i];
+        }
+        return results;
+    }
+
+    private String intToString (int i) {
+        String s = String.valueOf(i);
+        if (s.length()==1)
+            s = "0" + s;
+        return s;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/methods/methods002/methods002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.methods.methods002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class methods002a {
+    static methods002a _methods002a = new methods002a();
+
+    public static void main(String args[]) {
+       System.exit(methods002.JCK_STATUS_BASE + _methods002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        methods002b b = new methods002b(1);
+        methods002c c = new methods002c();
+        methods002e e = new methods002e();
+        methods002f f = new methods002f();
+        methods002g g = new methods002g();
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return methods002.PASSED;
+    }
+
+    static long lo;
+
+    // various method modifiers
+                 void  m01 (long l) { lo = l; };
+    private      void  m02 (long l) { lo = l; };
+    protected    void  m03 (long l) { lo = l; };
+    public       void  m04 (long l) { lo = l; };
+    static       void  m05 (long l) { lo = l; };
+    synchronized void  m06 (long l) { lo = l; };
+    strictfp     void  m07 (long l) { lo = l; };
+    native       void  m08 (long l);
+    public static synchronized strictfp void m09 (long l) { lo = l; };
+
+                 long  m10 (long l) { return lo + l; };
+    private      long  m11 (long l) { return lo + l; };
+    protected    long  m12 (long l) { return lo + l; };
+    public       long  m13 (long l) { return lo + l; };
+    static       long  m14 (long l) { return lo + l; };
+    synchronized long  m15 (long l) { return lo + l; };
+    strictfp     long  m16 (long l) { return lo + l; };
+    native       long  m17 (long l);
+    public static synchronized strictfp long m18 (long l) { return lo + l; };
+
+                 Object  m19 () { return new Object(); };
+    private      Object  m20 () { return new Object(); };
+    protected    Object  m21 () { return new Object(); };
+    public       Object  m22 () { return new Object(); };
+    static       Object  m23 () { return new Object(); };
+    synchronized Object  m24 () { return new Object(); };
+    strictfp     Object  m25 () { return new Object(); };
+    native       Object  m26 ();
+    public static synchronized strictfp Object m27 () { return new Object(); };
+
+
+    // array methods
+    double[]   m28 () { return new double[1]; };
+    double     m29 (double[] arr) {return arr[0];};
+    double[][] m30 (double[][] arr) {return arr;};
+
+    String[]   m31 () { return new String[1];};
+    String     m32 (String[] arr) { return arr[0];};
+    String[][] m33 (String[][] arr) {return arr;};
+
+    // final methods
+    final        void    f01 (long l) { lo = l; };
+    final        long    f02 (long l) { return lo + l; };
+    final        Object  f03 () { return new Object(); };
+}
+
+// Class with many constructors
+class methods002b {
+    int ind;
+    methods002b (int i) { ind = i; };
+
+    private   methods002b (int i, int j) { ind = i+j; };
+    protected methods002b (int i, int j, int k) { ind = i+j+k; };
+    public    methods002b (int i, int j, int k, int l) { ind = i+j+k+l; };
+}
+
+// Class with overloaded methods
+class methods002c {
+    int m01 (int i) { return i; };
+    int m01 (int i, int j) { return i+j; };
+    int m01 (int i, short j) { return i+j; };
+}
+
+// Class with abstract methods
+abstract class methods002d {
+    abstract void m01 ();
+}
+
+interface methods002i {
+    void i01 ();
+}
+
+class methods002e extends methods002d implements methods002i {
+    void m01 () {};
+    public void i01 () {};
+}
+
+// Class with inherited methods
+class methods002f extends methods002a {}
+
+// Class with inherited and overrided method
+class methods002g extends methods002f {
+    static long lo;
+
+                 void  m01 (long l) { lo = l; };
+    private      void  m02 (long l) { lo = l; };
+    protected    void  m03 (long l) { lo = l; };
+    public       void  m04 (long l) { lo = l; };
+    static       void  m05 (long l) { lo = l; };
+    synchronized void  m06 (long l) { lo = l; };
+    strictfp     void  m07 (long l) { lo = l; };
+    native       void  m08 (long l);
+    public static synchronized strictfp void m09 (long l) { lo = l; };
+
+                 long  m10 (long l) { return lo + l; };
+    private      long  m11 (long l) { return lo + l; };
+    protected    long  m12 (long l) { return lo + l; };
+    public       long  m13 (long l) { return lo + l; };
+    static       long  m14 (long l) { return lo + l; };
+    synchronized long  m15 (long l) { return lo + l; };
+    strictfp     long  m16 (long l) { return lo + l; };
+    native       long  m17 (long l);
+    public static synchronized strictfp long m18 (long l) { return lo + l; };
+
+                 Object  m19 () { return new Object(); };
+    private      Object  m20 () { return new Object(); };
+    protected    Object  m21 () { return new Object(); };
+    public       Object  m22 () { return new Object(); };
+    static       Object  m23 () { return new Object(); };
+    synchronized Object  m24 () { return new Object(); };
+    strictfp     Object  m25 () { return new Object(); };
+    native       Object  m26 ();
+    public static synchronized strictfp Object m27 () { return new Object(); };
+
+    double[]   m28 () { return new double[1]; };
+    double     m29 (double[] arr) {return arr[0];};
+    double[][] m30 (double[][] arr) {return arr;};
+
+    String[]   m31 () { return new String[1];};
+    String     m32 (String[] arr) { return arr[0];};
+    String[][] m33 (String[][] arr) {return arr;};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/monitor/monitor001/monitor001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/monitor/monitor001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test for the 'monitor <command>' command.
+ * The jdb sets up line breakpoint at the debugged application. Then four different
+ * commands are set as a "monitor" by 'monitor <command>' command. After resuming the
+ * debuggee stops at the breakpoint. All "monitored" commands should be executed.
+ * The test passes if correct replies for all "monitored" commands are found in jdb stdout
+ * stream.
+ * The test consists of two program:
+ *   monitor001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   monitor001a.java - the debugged application.
+ * COMMENTS
+ *  The test was updated due fix of the bug 4686159.
+ *  Test fixed according to test bug:
+ *  5041797 TEST_BUG: race condition in JDB output readirectors
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.monitor.monitor001.monitor001
+ *        nsk.jdb.monitor.monitor001.monitor001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.monitor.monitor001.monitor001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.monitor.monitor001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class monitor001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new monitor001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.monitor.monitor001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".monitor001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final int    LINE_NUMBER        = 47;
+
+    static final String[] CHECKED_COMMANDS = {
+        JdbCommand.threads,
+        JdbCommand.methods + DEBUGGEE_CLASS,
+        JdbCommand.fields  + DEBUGGEE_CLASS,
+        JdbCommand.eval + "(new java.lang.String(\"Hello, World\")).length()"
+                                             };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + LINE_NUMBER);
+
+        for (int i = 0; i < CHECKED_COMMANDS.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[i]);
+        }
+
+        int repliesCount = CHECKED_COMMANDS.length + 1;
+        reply = jdb.receiveReplyFor(JdbCommand.cont, true, repliesCount);
+
+        reply = jdb.receiveReplyFor(JdbCommand.monitor);
+        if (!checkMonitors(reply)) {
+            success = false;
+        }
+
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        if (!checkCommands(reply)) {
+            success = false;
+        }
+    }
+
+    private boolean checkMonitors(String[] reply) {
+        Paragrep grep;
+        String found;
+        Vector v;
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+        for (int i = 0; i < CHECKED_COMMANDS.length; i++) {
+            if ((count = grep.find(CHECKED_COMMANDS[i])) != 1) {
+                log.complain("Wrong number of monitor command: " + CHECKED_COMMANDS[i]);
+                log.complain("    Expected: 1; found: " + count);
+                result = false;
+            }
+        }
+
+        return result;
+    }
+
+    private boolean checkCommands(String[] reply) {
+        Paragrep grep;
+        String found;
+        Vector v = new Vector();
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+
+        // check 'threads'
+        v.add("java.lang.Thread");
+        v.add("main");
+        if ((count = grep.find(v)) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[0]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'methods'
+        if ((count = grep.find("runIt(java.lang.String[], java.io.PrintStream)")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[1]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'fields'
+        if ((count = grep.find(DEBUGGEE_CLASS + " _monitor001a")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[2]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'eval'
+        if ((count = grep.find("length() = 12")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[3]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/monitor/monitor001/monitor001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.monitor.monitor001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/* This is debuggee aplication */
+public class monitor001a {
+    static monitor001a _monitor001a = new monitor001a();
+
+    public static void main(String args[]) {
+        System.exit(monitor001.JCK_STATUS_BASE + _monitor001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+        int localInt = 0; // monitor001.LINE_NUMBER
+        localInt++; // dummy breakpoint
+        log.display("Debuggee PASSED");
+        return monitor001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/next/next001/next001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/next/next001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'next' command.
+ * The debuggee program (next001a.java) creates two additional
+ * threads of MyThread type and starts them. The jdb sets up breakpoint
+ * inside the method 'func2' which is invoked in these addional threads.
+ * When breakpoint is hitted the checked command is called at the line
+ * in which debuggee's method ('func3') is invoked. After this,
+ * the stack trace of the current method is checked by 'where' command.
+ * The test passes if only calling method ('func2') presents in stack
+ * trace, but not the called method ('func3').
+ * The test consists of two program:
+ *   next001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   next001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.next.next001.next001
+ *        nsk.jdb.next.next001.next001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.next.next001.next001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.next.next001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class next001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new next001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.next.next001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".next001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+
+    static final String[] checkedMethods = {"func1", "func2", "func3"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        int breakCount = 0;
+        int nextCount = 0;
+        for (int i = 0; i < next001a.numThreads; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            if (jdb.isAtBreakpoint(reply, LAST_BREAK)) {
+                breakCount++;
+                reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak;
+
+                reply = jdb.receiveReplyFor(JdbCommand.next);
+                if (!checkNext()) {
+                    success = false;
+                } else {
+                    nextCount++;
+                }
+            }
+        }
+
+        jdb.contToExit(1);
+
+        if (nextCount != next001a.numThreads) {
+            log.complain("Wrong number of 'next' events: " + nextCount);
+            log.complain("Must be equal to : " + next001a.numThreads);
+            success = false;
+        }
+    }
+
+
+    private boolean checkNext () {
+        Paragrep grep;
+        String found;
+        int count;
+        boolean result = true;
+        String[] reply;
+
+        reply = jdb.receiveReplyFor(JdbCommand.where);
+
+        grep = new Paragrep(reply);
+        count = grep.find(DEBUGGEE_THREAD + "." + checkedMethods[2]);
+        if (count > 0) {
+            log.complain("Debuggee is suspended in wrong method after 'next' command: " + DEBUGGEE_THREAD + "." + checkedMethods[2]);
+            result= false;
+        }
+
+        count = grep.find(DEBUGGEE_THREAD + "." + checkedMethods[1]);
+        if (count != 1) {
+            log.complain("Checked method does not exist in thread stack trace: " + DEBUGGEE_THREAD + "." + checkedMethods[1]);
+            result= false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/next/next001/next001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.next.next001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class next001a {
+    public static void main(String args[]) {
+       next001a _next001a = new next001a();
+       System.exit(next001.JCK_STATUS_BASE + _next001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static final String MYTHREAD  = "MyThread";
+    static final int numThreads   = 2;   // number of threads.
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        Thread holder [] = new Thread[numThreads];
+
+        for (int i = 0; i < numThreads ; i++) {
+            holder[i] = new MyThread();
+            holder[i].start();
+            try {
+                holder[i].join();
+            } catch (InterruptedException e) {
+                log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                return next001.FAILED;
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return next001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    public void run() {
+        int runLocal = func1(100);
+    }
+
+    public int func1(int i) {
+        return func2(i);
+    }
+
+    public int func2(int i) {
+        next001a.lastBreak();
+        int int2 = func3(i); // this is the line before 'next' command
+        return int2;         // this is the line after 'next' command
+    }
+
+    public int func3(int i) {
+        return i*i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect001/connect001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/connect/connect001.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-connect' option with 'com.sun.jdi.CommandLineLaunch"
+ *  connector.
+ *  Jdb is started with particular connector argument.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.options.connect.connect001a" string
+ *  is found in jdb's output stream:
+ *  The test consists of two parts:
+ *   connect001.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   connect001a.java - the debugged application.
+ * COMMENTS
+ *  The test is similar to nsk/jdb/run/run002, but uses particular connector
+ *  overriding settings in ini-file.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.connect.connect001.connect001
+ *        nsk.jdb.options.connect.connect001.connect001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.options.connect.connect001.connect001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -connector=launching
+ *      -transport=default
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.connect.connect001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class connect001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new connect001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect.connect001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected boolean shouldPass() {
+        String feature = "com.sun.jdi.CommandLineLaunch";
+        if (argumentHandler.shouldPass(feature)) {
+            log.println("Test passes because of not implemented feature: " + feature);
+            return true;
+        }
+        return super.shouldPass();
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect001/connect001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.options.connect.connect001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class connect001a {
+    static connect001a _connect001a = new connect001a();
+
+    public static void main(String args[]) {
+       System.exit(connect001.JCK_STATUS_BASE + _connect001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return connect001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect002/connect002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/connect/connect002.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-connect' option with 'com.sun.jdi.SocketAttach"
+ *  connector.
+ *  Jdb is started with particular connector argument.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.options.connect.connect002a" string
+ *  is found in jdb's output stream:
+ *  The test consists of two parts:
+ *   connect002.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   connect002a.java - the debugged application.
+ * COMMENTS
+ *  The test is similar to nsk/jdb/run/run002, but uses particular connector
+ *  overriding settings in ini-file.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.connect.connect002.connect002
+ *        nsk.jdb.options.connect.connect002.connect002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.options.connect.connect002.connect002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -connector=attaching
+ *      -transport=socket
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.connect.connect002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class connect002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new connect002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect.connect002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected boolean shouldPass() {
+        String feature = "com.sun.jdi.SocketAttach";
+        if (argumentHandler.shouldPass(feature)) {
+            log.println("Test passes because of not implemented feature: " + feature);
+            return true;
+        }
+        return super.shouldPass();
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect002/connect002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.options.connect.connect002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class connect002a {
+    static connect002a _connect002a = new connect002a();
+
+    public static void main(String args[]) {
+       System.exit(connect002.JCK_STATUS_BASE + _connect002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return connect002.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect003/connect003.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/connect/connect003.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-connect' option with 'com.sun.jdi.SharedMemoryAttach"
+ *  connector.
+ *  Jdb is started with particular connector argument.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.options.connect.connect003a" string
+ *  is found in jdb's output stream:
+ *  The test consists of two parts:
+ *   connect003.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   connect003a.java - the debugged application.
+ * COMMENTS
+ *  The test is similar to nsk/jdb/run/run002, but uses particular connector
+ *  overriding settings in ini-file.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.connect.connect003.connect003
+ *        nsk.jdb.options.connect.connect003.connect003a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.options.connect.connect003.connect003
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -connector=attaching
+ *      -transport=shmem
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.connect.connect003;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class connect003 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new connect003().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect.connect003";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect003";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected boolean shouldPass() {
+        String feature = "com.sun.jdi.SharedMemoryAttach";
+        if (argumentHandler.shouldPass(feature)) {
+            log.println("Test passes because of not implemented feature: " + feature);
+            return true;
+        }
+        return super.shouldPass();
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect003/connect003a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.options.connect.connect003;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class connect003a {
+    static connect003a _connect003a = new connect003a();
+
+    public static void main(String args[]) {
+       System.exit(connect003.JCK_STATUS_BASE + _connect003a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return connect003.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect004/connect004.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/connect/connect004.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-connect' option with 'com.sun.jdi.SocketListen"
+ *  connector.
+ *  Jdb is started with particular connector argument.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.options.connect.connect004a" string
+ *  is found in jdb's output stream:
+ *  The test consists of two parts:
+ *   connect004.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   connect004a.java - the debugged application.
+ * COMMENTS
+ *  The test is similar to nsk/jdb/run/run002, but uses particular connector
+ *  overriding settings in ini-file.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.connect.connect004.connect004
+ *        nsk.jdb.options.connect.connect004.connect004a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.options.connect.connect004.connect004
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -connector=listening
+ *      -transport=socket
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.connect.connect004;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class connect004 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new connect004().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect.connect004";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect004";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected boolean shouldPass() {
+        String feature = "com.sun.jdi.SocketListen";
+        if (argumentHandler.shouldPass(feature)) {
+            log.println("Test passes because of not implemented feature: " + feature);
+            return true;
+        }
+        return super.shouldPass();
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect004/connect004a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.options.connect.connect004;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class connect004a {
+    static connect004a _connect004a = new connect004a();
+
+    public static void main(String args[]) {
+       System.exit(connect004.JCK_STATUS_BASE + _connect004a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return connect004.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect005/connect005.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/connect/connect005.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-connect' option with 'com.sun.jdi.SharedMemoryListen"
+ *  connector.
+ *  Jdb is started with particular connector argument.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.options.connect.connect005a" string
+ *  is found in jdb's output stream:
+ *  The test consists of two parts:
+ *   connect005.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   connect005a.java - the debugged application.
+ * COMMENTS
+ *  The test is similar to nsk/jdb/run/run002, but uses particular connector
+ *  overriding settings in ini-file.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.connect.connect005.connect005
+ *        nsk.jdb.options.connect.connect005.connect005a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.options.connect.connect005.connect005
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -connector=listening
+ *      -transport=shmem
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.connect.connect005;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class connect005 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new connect005().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect.connect005";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect005";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected boolean shouldPass() {
+        String feature = "com.sun.jdi.SharedMemoryListen";
+        if (argumentHandler.shouldPass(feature)) {
+            log.println("Test passes because of not implemented feature: " + feature);
+            return true;
+        }
+        return super.shouldPass();
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/connect/connect005/connect005a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.options.connect.connect005;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class connect005a {
+    static connect005a _connect005a = new connect005a();
+
+    public static void main(String args[]) {
+       System.exit(connect005.JCK_STATUS_BASE + _connect005a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return connect005.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/options/listconnectors/listconnectors001/listconnectors001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/options/listconnectors/listconnectors001.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for '-listconnectors' option of jdb.
+ *  This test checks that jdb started with tested option prints to stdout
+ *  list of connectors and transports, that includes all supported
+ *  connectors and transport configurations:
+ *     com.sun.jdi.CommandLineLaunch (dt_socket, dt_shmem)
+ *     com.sun.jdi.RawLineLaunch (dt_socket, dt_shmem)
+ *     com.sun.jdi.SocketAttach (dt_socket)
+ *     com.sun.jdi.SocketListen (dt_socket)
+ *     com.sun.jdi.SharedMemoryAttach (dt_shmem)
+ *     com.sun.jdi.SharedMemoryListen (dt_shmem)
+ *  Those configurations, which are not supported on tested platform,
+ *  are just ignored.
+ *  This test does not actually use debuggee class and any connectors
+ *  regardless of settings in ini-file, and the main test class
+ *  specifically overrides default behaviour of framework classes.
+ *  The test consists of one part:
+ *     listconnectors001.java  - test driver, i.e. launches jdb
+ *                                 and checks its output.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.options.listconnectors.listconnectors001.listconnectors001
+ * @run main/othervm PropertyResolvingWrapper
+ *      nsk.jdb.options.listconnectors.listconnectors001.listconnectors001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -jdb.option=-listconnectors
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.options.listconnectors.listconnectors001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class listconnectors001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new listconnectors001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.options.connect";
+    static final String TEST_CLASS = PACKAGE_NAME + ".connect001";
+    static final String DEBUGGEE_CLASS = null;
+    static final String FIRST_BREAK    = null;
+    static final String LAST_BREAK     = null;
+
+    static final String TESTED_OPTION = "-listconnectors";
+    static final String TESTED_CONNECTORS_LIST[] = {
+        "com.sun.jdi.CommandLineLaunch", "dt_socket",
+        "com.sun.jdi.CommandLineLaunch", "dt_shmem",
+        "com.sun.jdi.RawCommandLineLaunch", "dt_socket",
+        "com.sun.jdi.RawCommandLineLaunch", "dt_shmem",
+        "com.sun.jdi.SocketAttach", "dt_socket",
+        "com.sun.jdi.SocketListen", "dt_socket",
+        "com.sun.jdi.SharedMemoryAttach", "dt_shmem",
+        "com.sun.jdi.SharedMemoryListen", "dt_shmem",
+    };
+    static final int TESTED_CONNECTORS_COUNT = TESTED_CONNECTORS_LIST.length / 2;
+/*
+    protected void launchJdbAndDebuggee(String debuggeeClass) throws Exception {
+        String jdbExecPath = argumentHandler.getJdbExecPath();
+        String args[] = {jdbExecPath, TESTED_OPTION};
+
+        launcher = new Launcher(argumentHandler, log);
+        jdb = new Jdb(launcher);
+        jdb.launch(args);
+    }
+ */
+
+    protected void initJdb() {
+        // do nothing
+    }
+
+    protected void runCases() {
+        // do noting
+    }
+
+    protected void afterJdbExit() {
+        String[] reply = jdb.getTotalReply();
+
+        for (int i = 0; i < TESTED_CONNECTORS_COUNT; i++) {
+            String connector = TESTED_CONNECTORS_LIST[i*2 + 0];
+            String transport = TESTED_CONNECTORS_LIST[i*2 + 1];
+            Paragrep grep = new Paragrep(reply);
+
+            Vector<String> v = new Vector<String>();
+            v.add(Jdb.SUPPORTED_CONNECTOR_NAME);
+            v.add(connector);
+            v.add(Jdb.SUPPORTED_TRANSPORT_NAME);
+            if (!transport.equals("*")) {
+                v.add(transport);
+            }
+
+            int found = grep.find(v);
+            if (found == 1) {
+                display("expected connector found:\n"
+                        + "  connector: " + connector
+                        + "  transport: " + transport
+                        + "  found: " + found);
+            } else if (found > 1) {
+                failure("duplicated connector found (see jdb.stdout):\n"
+                        + "  connector: " + connector
+                        + "  transport: " + transport
+                        + "  found: " + found);
+            } else if (argumentHandler.shouldPass(connector)
+                            || argumentHandler.shouldPass(connector, transport)) {
+                display("unsupported connector not found:\n"
+                        + "  connector: " + connector
+                        + "  transport: " + transport
+                        + "  found: " + found);
+            } else {
+                failure("no expected connector found (see jdb.stdout):\n"
+                        + "  connector: " + connector
+                        + "  transport: " + transport
+                        + "  found: " + found);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/pop/pop001/pop001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/pop/pop001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test case for the 'pop' command.
+ * The debugged application (pop001a.java) starts additional thread of MyThread
+ * class. The 'run()' method of the this class invokes recursively a number of
+ * int methods. The jdb sets breakpoint in the last called 'func5()' method
+ * to suspend the debugged VM when all the methods, i.e. from 'func1()' to
+ * 'func5()', are in MyThread's stack. Then jdb steps up three frame on stack
+ * by 'up 3' command. At this moment frame with 'func2()' is current.
+ * Then the 'pop' command is called. The test passes if after execution of
+ * tested command the 'func1()' frame becomes current and jdb correctly reports
+ * the thread stack and local variable(s) of the current frame.
+ * The test consists of two program:
+ *   pop001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   pop001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.pop.pop001.pop001
+ *        nsk.jdb.pop.pop001.pop001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.pop.pop001.pop001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.pop.pop001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class pop001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new pop001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.pop.pop001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".pop001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+    static final String[] CHECKED_METHODS = {"func1", "func2", "func3", "func4", "func5"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        while (true) {
+            String[] threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+            if (threads.length != 1) {
+                log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
+                log.complain("Found: " + threads.length);
+                success = false;
+                break;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.thread + threads[0]);
+
+            reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak()
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func5", "[1]", "lastBreak", false)) {
+                 success = false;
+            }
+            reply = jdb.receiveReplyFor(JdbCommand.up + " 3");
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func2", "[4]", "func3", false)) {
+                success = false;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.pop);
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func1", "[1]", "func2", true)) {
+                success = false;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.locals);
+            grep = new Paragrep(reply);
+            if (grep.find("Internal exception") > 0) {
+                log.complain("Internal exception was thrown while 'locals' command");
+                for (int i = 0; i < reply.length; i++) {
+                    log.complain(reply[i]);
+                }
+                success = false;
+            }
+
+            break;
+        }
+
+        jdb.contToExit(2);
+    }
+
+    private boolean checkStack (String[] reply, String shouldBe, String frameNum, String shouldNotBe, boolean pop ) {
+        Paragrep grep;
+        String found;
+        Vector v = new Vector();
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+        v.add(frameNum);
+        v.add(DEBUGGEE_THREAD + "." + shouldBe);
+        if ((count = grep.find(v)) != 1) {
+            log.complain("Contents of stack trace is incorrect " + ( pop? "after 'pop' command": ""));
+            log.complain("Searched for: " + DEBUGGEE_THREAD + "." + shouldBe);
+            log.complain("Count : " + count);
+            result = false;
+        }
+
+        if (grep.find(DEBUGGEE_THREAD + "." + shouldNotBe) > 0) {
+            log.complain("Contents of stack trace is incorrect " + ( pop? "after 'pop' command": ""));
+            log.complain("Found wrong frame: " + DEBUGGEE_THREAD + "." + shouldNotBe);
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/pop/pop001/pop001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.pop.pop001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class pop001a {
+
+    static final String MYTHREAD  = "MyThread";
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static pop001a _pop001a = new pop001a();
+
+    public static void main(String args[]) {
+       System.exit(pop001.JCK_STATUS_BASE + _pop001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        MyThread myThread = new MyThread(MYTHREAD);
+        myThread.start();
+
+        if (myThread.isAlive()) {
+            try {
+                myThread.join();
+            } catch (InterruptedException e) {
+                log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD);
+                return pop001.FAILED;
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return pop001.PASSED;
+    }
+}
+
+class MyThread extends Thread {
+
+    public MyThread (String name) {
+        super(name);
+    }
+
+    public void run() {
+        pop001a.log.display("run() started");
+        int runLocal;
+        int j = func1(0);
+        pop001a.log.display("run() finished");
+    }
+
+    public int func1(int intParam) {
+        pop001a.log.display("func1() started");
+        int func1Local;
+        intParam++;
+        return func2(intParam);
+    }
+
+    public int func2(int intParam) {
+        pop001a.log.display("func2() started");
+        int func2Local;
+        intParam++;
+        return func3(intParam);
+    }
+
+    public int func3(int intParam) {
+        pop001a.log.display("func3() started");
+        int func3Local;
+        intParam++;
+        return func4(intParam);
+    }
+
+    public int func4(int intParam) {
+        pop001a.log.display("func4() started");
+        int func4Local;
+        intParam++;
+        return func5(intParam);
+    }
+
+    public int func5(int intParam) {
+        pop001a.log.display("func5() started");
+        int func5Local;
+        intParam++;
+        pop001a.lastBreak();
+        return intParam;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/pop_exception/pop_exception001/pop_exception001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/pop_exception/pop_exception001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *         Test  for cr 6972759 "Step over not working after thrown exception and Pop"
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.pop_exception.pop_exception001.pop_exception001
+ *        nsk.jdb.pop_exception.pop_exception001.pop_exception001a
+ * @run main/othervm PropertyResolvingWrapper
+ *      nsk.jdb.pop_exception.pop_exception001.pop_exception001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.pop_exception.pop_exception001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class pop_exception001 extends JdbTest {
+
+    static final String PACKAGE_NAME    = "nsk.jdb.pop_exception.pop_exception001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".pop_exception001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new pop_exception001().runTest(argv, out);
+    }
+
+
+
+    protected void runCases() {
+
+        jdb.receiveReplyFor(JdbCommand._catch + "java.lang.NullPointerException");
+        jdb.receiveReplyFor(JdbCommand.cont);
+        //exception
+        jdb.receiveReplyFor(JdbCommand.pop);
+        jdb.receiveReplyFor(JdbCommand.pop);
+        jdb.receiveReplyFor(JdbCommand.ignore + "java.lang.NullPointerException");
+        jdb.receiveReplyFor(JdbCommand.step);
+        jdb.receiveReplyFor(JdbCommand.next);
+        jdb.receiveReplyFor(JdbCommand.next);
+        String[] reply = jdb.receiveReplyFor(JdbCommand.next);
+
+        jdb.quit();
+        checkJdbReply(reply);
+    }
+
+    private void checkJdbReply(String[] jdbReply) {
+        String replyString = "";
+        for(String s: jdbReply) {
+            replyString += s;
+            if(s.contains("line=")){
+                if(!s.contains("line=" + pop_exception001a.expectedFinish)) {
+                    throw new Failure("FAILED: Expected location: line=" + pop_exception001a.expectedFinish + "\n found: " + s);
+                } else {
+                    return;
+                }
+            }
+        }
+        throw new Failure("FAILED: Couldn't determinate finish position: " + replyString);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/pop_exception/pop_exception001/pop_exception001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.pop_exception.pop_exception001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/**
+ * debugee application
+ */
+public class pop_exception001a {
+    public static void main(String args[]) {
+       pop_exception001a _pop_exception001a = new pop_exception001a();
+       System.exit(Consts.JCK_STATUS_BASE + _pop_exception001a.runIt(args, System.out));
+    }
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    public int runIt(String args[], PrintStream out) {
+        int i = 0;
+        Object item = null;
+        try {
+            item = new Object();
+            i = 5; // expectedFinish
+            item = getItem(i);
+        } finally {
+            System.out.println("item = "+item);
+        }
+        return Consts.TEST_PASSED;
+    }
+
+    private Object getItem(int i) {
+        if (i == 5) {
+            throw new NullPointerException("Something went wrong");
+        } else {
+            return new Integer(i);
+        }
+    }
+
+    public final static String expectedFinish = "51";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/print/print002/print002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/print/print002.
+ * VM Testbase keywords: [quick, jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * This is a test for the 'print <expr>' command.
+ * The test checks if jdb correctly prints values for the following
+ * expressions:
+ *  - arithmetic expression of local variables,
+ *  - boolean expression of local variables,
+ *  - string field deeply nested in class hierarchy.
+ * The test passes when all printed values are equal to expected ones.
+ * The test consists of two program:
+ *   print002.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   print002a.java - the debugged application.
+ * COMMENTS
+ * The test replaces the nsk/jdb/print/print001 one.
+ * Test was fixed according to test bug:
+ *     4862693 NSK testcase nsk/jdb/print/print002 fails with operation not yet supported
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.print.print002.print002
+ *
+ * @comment make sure print002a is compiled w/ full debug info
+ * @clean nsk.jdb.print.print002.print002a
+ * @compile -g:lines,source,vars print002a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.print.print002.print002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.print.print002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class print002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new print002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.print.print002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".print002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] checkedExpr = {
+        { "i + j", "8"},
+        { "j - i", "4"},
+        { "j * i", "12"},
+        { "j / i", "3"},
+//        { "j % i", "0"},
+//        { "i++",   "2"},
+//        { "++i",   "3"},
+//        { "j--",   "6"},
+//        { "--j",   "5"},
+//        { "!b1 ",   "false"},
+//        { "b2 && b1", "false"},
+//        { "b2 || b1", "true"},
+        { "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.s", "foo" }
+                                          };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // to get out of lastBreak()
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+
+        for (int i = 0; i < checkedExpr.length; i++) {
+            if (!checkValue(checkedExpr[i][0], checkedExpr[i][1])) {
+                success = false;
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkValue (String expr, String value) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        Vector v;
+        boolean result = true;
+
+        reply = jdb.receiveReplyFor(JdbCommand.print + expr);
+        grep = new Paragrep(reply);
+        found = grep.findFirst(value);
+        if (found.length() <= 0) {
+            log.complain("jdb failed to report value of expression: " + expr);
+            log.complain("\t expected : " + value + " ;\n\t reported: " + (reply.length > 0? reply[0]: ""));
+            result = false;
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/print/print002/print002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.print.print002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class print002a {
+
+    static print002a _print002a = new print002a();
+
+    public static void main(String args[]) {
+       System.exit(print002.JCK_STATUS_BASE + _print002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = 2;
+        int j = 6;
+        boolean b1 = true;
+        boolean b2 = false;
+
+        A a = new A();
+
+        synchronized (this) {
+            lastBreak();
+        }
+
+        log.display("Debuggee PASSED");
+        return print002.PASSED;
+    }
+}
+
+class A {
+B b;
+A() { b = new B(); }
+}
+
+class B {
+C c;
+B() { c = new C(); }
+}
+
+class C {
+D d;
+C() { d = new D(); }
+}
+
+class D {
+E e;
+D() { e = new E(); }
+}
+
+class E {
+F f;
+E() { f = new F(); }
+}
+
+class F {
+G g;
+F() { g = new G(); }
+}
+
+class G {
+H h;
+G() { h = new H(); }
+}
+
+class H {
+I i;
+H() { i = new I(); }
+}
+
+class I {
+J j;
+I() { j = new J(); }
+}
+
+class J {
+K k;
+J() { k = new K(); }
+}
+
+class K {
+L l;
+K() { l = new L(); }
+}
+
+class L {
+M m;
+L() { m = new M(); }
+}
+
+class M {
+N n;
+M() { n = new N(); }
+}
+
+class N {
+O o;
+N() { o = new O(); }
+}
+
+class O {
+P p;
+O() { p = new P(); }
+}
+
+class P {
+Q q;
+P() { q = new Q(); }
+}
+
+class Q {
+R r;
+Q() { r = new R(); }
+}
+
+class R {
+S s;
+R() { s = new S(); }
+}
+
+class S {
+T t;
+S() { t = new T(); }
+}
+
+class T {
+U u;
+T() { u = new U(); }
+}
+
+class U {
+V v;
+U() { v = new V(); }
+}
+
+class V {
+W w;
+V() { w = new W(); }
+}
+
+class W {
+X x;
+W() { x = new X(); }
+}
+
+class X {
+Y y;
+X() { y = new Y(); }
+}
+
+class Y {
+Z z;
+Y() { z = new Z(); }
+}
+
+class Z {
+  String s;
+  Z() { s  = "foo";}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/jdb.scenario	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,5 @@
+classes
+threads
+methods nsk.jdb.read.read001.read001a
+fields nsk.jdb.read.read001.read001a
+locals
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/read001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/read/read001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test for the 'read <filename>' command.
+ * The jdb stops the debugged application on enter in read001a.lastBreak()
+ * method. Then the tested command is called for the 'jdb.scenario' file.
+ * The test passes if correct replies for all commands containing in
+ * 'jdb.scenario' are found in jdb stdout stream.
+ * The test consists of two program:
+ *   read001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   read001a.java - the debugged application.
+ * COMMENTS
+ * Only limited number of commands is used in 'jdb.scenario' file because
+ * the jdb does not wait until end of reply for current command and
+ * immediatly executes the next command from 'jdb.scenario'.
+ * Fixed test according to test bug:
+ *     4665075 TTY: error messages for commands from scenario file of 'read' command
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.read.read001.read001
+ *
+ * @comment make sure read001a is compiled w/ full debug info
+ * @clean nsk.jdb.read.read001.read001a
+ * @compile -g:lines,source,vars read001a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.read.read001.read001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.read.read001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class read001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new read001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.read.read001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".read001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK    = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK     = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String SCENARIO_FILE = "jdb.scenario";
+    static final int SCENARIO_COMMANDS_COUNT = 5;
+
+    protected void runCases() {
+        String[] reply;
+        String workdir = argumentHandler.getWorkDir();
+
+        // stop in lastBreak() method
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // return to testedInstanceMethod()
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+
+        String command = JdbCommand.read + workdir + File.separator + SCENARIO_FILE;
+        int count = SCENARIO_COMMANDS_COUNT + 1;
+        reply = jdb.receiveReplyFor(command, true, count);
+
+        if (!checkCommands(reply)) {
+            success = false;
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkCommands(String[] reply) {
+        Paragrep grep;
+        String found;
+        Vector v = new Vector();
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+
+        // check 'threads'
+        log.display("Check reply for command: classes");
+        if ((count = grep.find("nsk.jdb.read.read001.read001aTestedClass")) != 1) {
+            log.complain("Wrong number of execution of command: classes");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'threads'
+        log.display("Check reply for command: threads");
+        if ((count = grep.find("TestedThreadInstance")) != 1) {
+            log.complain("Wrong number of execution of command: threads");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'methods'
+        log.display("Check reply for command: methods");
+        if ((count = grep.find("testedInstanceMethod()")) != 1) {
+            log.complain("Wrong number of execution of command: methods nsk.jdb.read.read001a");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'fields'
+        log.display("Check reply for command: fields");
+        if ((count = grep.find("testedStaticFieldBoolean")) != 1) {
+            log.complain("Wrong number of execution of command: fields nsk.jdb.read.read001.presentedInstance");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'locals'
+        log.display("Check reply for command: locals");
+        if ((count = grep.find("testedLocalVarInt")) != 1) {
+            log.complain("Wrong number of execution of command: locals");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+/*
+        // check 'eval'
+        log.display("Check reply for command: eval");
+        if ((count = grep.find("556600")) != 1) {
+            log.complain("Wrong number of execution of command: "
+                        + "eval nsk.jdb.read.read001a.staticInt+instanceInt*3");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'print'
+        log.display("Check reply for command: print");
+        if ((count = grep.find("staticString = \"static string of read001a class\"")) != 1) {
+            log.complain("Wrong number of execution of command: "
+                        + "print nsk.jdb.read.read001.read001a.staticString"
+                        );
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        // check 'dump'
+        log.display("Check reply for command: dump");
+        if ((count = grep.find("instance of nsk.jdb.read.read001.read001a")) != 1) {
+            log.complain("Wrong number of execution of command: "
+                        + "dump nsk.jdb.read.read001.read001a._read001a");
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+ */
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/read/read001/read001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.read.read001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class read001a {
+
+    static boolean testedStaticFieldBoolean = true;
+    double testedInstanceFieldDouble = (double)3.1414926;
+
+    public static void main(String args[]) {
+        read001a _read001a = new read001a();
+        System.exit(read001.JCK_STATUS_BASE + _read001a.runIt(args, System.out));
+    }
+
+    void lastBreak () {}
+
+    void testedInstanceMethod() {
+        int testedLocalVarInt = 0;
+        String testedLocalVarString = "foo";
+
+        lastBreak();
+
+        testedLocalVarString = "bar";
+    }
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+        int localInt = 0;
+
+        read001aTestedClass obj = new read001aTestedClass();
+        read001aTestedThread thread = new read001aTestedThread("TestedThreadInstance");
+
+        synchronized (thread.finishingMonitor) {
+            synchronized (thread.startingMonitor) {
+                try {
+                    thread.start();
+                    thread.startingMonitor.wait();
+                } catch (InterruptedException e) {
+                    throw new Failure("Interrupted while starting tested thread: " + e);
+                }
+            }
+
+            testedInstanceMethod();
+        }
+
+        try {
+            thread.join();
+        } catch (InterruptedException e) {
+            throw new Failure("Interrupted while finishing tested thread: " + e);
+        }
+
+        log.display("Debuggee PASSED");
+        return read001.PASSED;
+    }
+}
+
+class read001aTestedClass {
+    char instanceFiledChar = 'x';
+}
+
+class read001aTestedThread extends Thread {
+
+    Object startingMonitor = new Object();
+    Object finishingMonitor = new Object();
+
+    public read001aTestedThread(String name) {
+        super(name);
+    }
+
+    public void run() {
+        synchronized (startingMonitor) {
+            startingMonitor.notifyAll();
+        }
+
+        synchronized (finishingMonitor) {
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/RedefinedClass.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.redefine.redefine001;
+
+public class RedefinedClass {
+    public static String foo() {
+        return "BEFORE_REDEFINITION"; //  This string is substituted with
+                                      //  'return "AFTER_REDEFINITION";' in
+                                      //  the newclass/RedefinedClass.java.
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/newclass_g/RedefinedClass.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.redefine.redefine001;
+
+public class RedefinedClass {
+    public static String foo() {
+        return "AFTER_REDEFINITION";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/redefine001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/redefine/redefine001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'redefine <class id> <class file name>' command.
+ * The debuggee program invokes three times method 'foo()' of RedefinedClass
+ * class. This class in redefined with checked command each time before last
+ * two invocations. If redefinitions occurs then the value returned by 'foo()'
+ * method must be different from one returned previous invocation.
+ * The test passes if method 'foo()' of the RedefinedClass returns expected
+ * values.
+ * The test consists of three program:
+ *   redefine001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   redefine001a.java - the debugged application.
+ *   RedefinedClass.java - the class to be redefined.
+ *   newclass_g/RedefinedClass.java - the redefining class.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.redefine.redefine001.redefine001
+ *        nsk.jdb.redefine.redefine001.redefine001a
+ *
+ * @comment compile newclass_g/RedefinedClass.java to newclass_g
+ * @build ExecDriver
+ * @run driver PropertyResolvingWrapper ExecDriver --cmd
+ *      ${compile.jdk}/bin/javac
+ *      -d ${test.classes}/newclass_g
+ *      -g:lines,source,vars
+ *      -cp ${test.class.path}
+ *      ${test.src}/newclass_g/RedefinedClass.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.redefine.redefine001.redefine001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.redefine.redefine001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+import nsk.share.classload.ClassLoadUtils;
+
+import java.io.*;
+import java.util.*;
+
+public class redefine001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new redefine001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.redefine.redefine001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".redefine001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String REDEFINED_CLASS    = PACKAGE_NAME + ".RedefinedClass";
+    static final String BEFORE_REDEFINITION = "BEFORE_REDEFINITION";
+    static final String FIRST_REDEFINITION  = "AFTER_REDEFINITION";
+    static final String SECOND_REDEFINITION = BEFORE_REDEFINITION;
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak()
+
+        reply = jdb.receiveReplyFor(JdbCommand.eval + DEBUGGEE_CLASS + ".flag");
+        grep = new Paragrep(reply);
+        if (grep.find(BEFORE_REDEFINITION) == 0) {
+            log.complain("Wrong value of redefine001a.flag before redefinition: " + (reply.length > 0? reply[0]: ""));
+            success = false;
+        }
+
+        String className = RedefinedClass.class.getName();
+        String pathToRedefFile1 = ClassLoadUtils.getRedefineClassFileName("newclass_g", className);
+        if (new File(pathToRedefFile1).exists()) {
+            reply = jdb.receiveReplyFor(JdbCommand.redefine + REDEFINED_CLASS + " " + pathToRedefFile1);
+
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+            reply = jdb.receiveReplyFor(JdbCommand.eval + DEBUGGEE_CLASS + ".flag");
+            grep = new Paragrep(reply);
+            if (grep.find(FIRST_REDEFINITION) == 0) {
+                log.complain("Wrong value of redefine001a.flag after first redefinition: " + (reply.length > 0? reply[0]: ""));
+                success = false;
+            }
+        } else {
+            log.complain("File does not exists: " + pathToRedefFile1);
+            success = false;
+        }
+
+        String pathToRedefFile2 = ClassLoadUtils.getClassPathFileName(className);
+        if (new File(pathToRedefFile2).exists()) {
+            reply = jdb.receiveReplyFor(JdbCommand.redefine + REDEFINED_CLASS + " " + pathToRedefFile2);
+
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+            reply = jdb.receiveReplyFor(JdbCommand.eval + DEBUGGEE_CLASS + ".flag");
+            grep = new Paragrep(reply);
+            if (grep.find(SECOND_REDEFINITION) == 0) {
+                log.complain("Wrong value of redefine001a.flag after second redefinition: " + (reply.length > 0? reply[0]: ""));
+                success = false;
+            }
+        } else {
+            log.complain("File does not exists: " + pathToRedefFile2);
+            success = false;
+        }
+
+        jdb.contToExit(2);
+    }
+
+    private boolean checkStop () {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        Vector v;
+        boolean result = true;
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/redefine/redefine001/redefine001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.redefine.redefine001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class redefine001a {
+    static redefine001a _redefine001a = new redefine001a();
+
+    public static void main(String args[]) {
+       System.exit(redefine001.JCK_STATUS_BASE + _redefine001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        RedefinedClass c = new RedefinedClass();
+
+        flag = c.foo();
+
+        lastBreak(); // at this point RedefinedClass is redefined.
+
+        flag = c.foo();
+
+        lastBreak();
+
+        flag = c.foo();
+
+        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return redefine001.PASSED;
+    }
+
+    static String flag = "";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/reenter/reenter001/reenter001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/reenter/reenter001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test case for the 'reenter' command.
+ * The debugged application (reenter001a.java) starts additional thread of MyThread
+ * class. The 'run()' method of the this class invokes recursively a number of
+ * int methods. The jdb sets breakpoint in the last called 'func5()' method
+ * to suspend the debugged VM when all the methods, i.e. from 'func1()' to
+ * 'func5()', are in MyThread's stack. Then jdb steps up three frame on stack
+ * by 'up 3' command. At this moment frame with 'func2()' is current.
+ * Then the 'reenter' command is called. The test passes if after execution of
+ * tested command the 'func2()' frame reentered, i.e. top frame of the stack.
+ * The test consists of two program:
+ *   reenter001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   reenter001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.reenter.reenter001.reenter001
+ *        nsk.jdb.reenter.reenter001.reenter001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.reenter.reenter001.reenter001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.reenter.reenter001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class reenter001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new reenter001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.reenter.reenter001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".reenter001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+    static final String[] CHECKED_METHODS = {"func1", "func2", "func3", "func4", "func5"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        while (true) {
+            String[] threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+            if (threads.length != 1) {
+                log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
+                log.complain("Found: " + threads.length);
+                success = false;
+                break;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.thread + threads[0]);
+
+            reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak()
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func5", "[1]", "lastBreak", false)) {
+                success = false;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.up + " 3");
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func2", "[4]", "func3", false)) {
+                success = false;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.reenter);
+
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            if (!checkStack(reply, "func2", "[1]", "func3", true)) {
+                success = false;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.locals);
+            grep = new Paragrep(reply);
+            if (grep.find("Internal exception") > 0) {
+                log.complain("Internal exception was thrown while 'locals' command");
+                for (int i = 0; i < reply.length; i++) {
+                    log.complain(reply[i]);
+                }
+                success = false;
+            }
+
+            break;
+        }
+
+        jdb.contToExit(2);
+    }
+
+    private boolean checkStack (String[] reply, String shouldBe, String frameNum, String shouldNotBe, boolean reenter ) {
+        Paragrep grep;
+        String found;
+        Vector v = new Vector();
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+        v.add(frameNum);
+        v.add(DEBUGGEE_THREAD + "." + shouldBe);
+        if ((count = grep.find(v)) != 1) {
+            log.complain("Contents of stack trace is incorrect " + ( reenter? "after 'reenter' command": ""));
+            log.complain("Searched for: " + DEBUGGEE_THREAD + "." + shouldBe);
+            log.complain("Count : " + count);
+            result = false;
+        }
+
+        if (grep.find(DEBUGGEE_THREAD + "." + shouldNotBe) > 0) {
+            log.complain("Contents of stack trace is incorrect " + ( reenter? "after 'reenter' command": ""));
+            log.complain("Found wrong frame: " + DEBUGGEE_THREAD + "." + shouldNotBe);
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/reenter/reenter001/reenter001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.reenter.reenter001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class reenter001a {
+
+    static final String MYTHREAD  = "MyThread";
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static reenter001a _reenter001a = new reenter001a();
+
+    public static void main(String args[]) {
+       System.exit(reenter001.JCK_STATUS_BASE + _reenter001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        MyThread myThread = new MyThread(MYTHREAD);
+        myThread.start();
+
+        if (myThread.isAlive()) {
+            try {
+                myThread.join();
+            } catch (InterruptedException e) {
+                log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD);
+                return reenter001.FAILED;
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return reenter001.PASSED;
+    }
+}
+
+class MyThread extends Thread {
+
+    public MyThread (String name) {
+        super(name);
+    }
+
+    public void run() {
+        reenter001a.log.display("run() started");
+        int runLocal;
+        int j = func1(0);
+        reenter001a.log.display("run() finished");
+    }
+
+    public int func1(int intParam) {
+        reenter001a.log.display("func1() started");
+        int func1Local;
+        intParam++;
+        return func2(intParam);
+    }
+
+    public int func2(int intParam) {
+        reenter001a.log.display("func2() started");
+        int func2Local;
+        intParam++;
+        return func3(intParam);
+    }
+
+    public int func3(int intParam) {
+        reenter001a.log.display("func3() started");
+        int func3Local;
+        intParam++;
+        return func4(intParam);
+    }
+
+    public int func4(int intParam) {
+        reenter001a.log.display("func4() started");
+        int func4Local;
+        intParam++;
+        return func5(intParam);
+    }
+
+    public int func5(int intParam) {
+        reenter001a.log.display("func5() started");
+        int func5Local;
+        intParam++;
+        reenter001a.lastBreak();
+        return intParam;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/b4689395.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @bug 4689395
+ * @summary converted from VM Testbase nsk/jdb/regression/b4689395.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *     Regression test for the bug
+ *         4689395 (P4/S3) "step over" after a class is redefined acts like "step out"
+ *         Release summary: 1.4
+ *         Hardware version: generic
+ *         O/S version (unbundled products): 5.8
+ *     The test consists of two java-files:
+ *         b4689395.java  - launches jdb and debuggee, writes commands to jdb,
+ *                          reads the jdb output;
+ *         b4689395a.java - the debugged application.
+ *     The debugged application (b4689395a.java) defines method minor() that
+ *     prints four lines into System.out. b4689395 sets a breakpoint on the 54th
+ *     line
+ *         System.out.println("A breakpoint is here.");
+ *     and then redefines b4689395a with newclass/b4689395a. Those classes differ
+ *     just in the 30th line (period is omitted in newclass/b4689395a). After that
+ *     the debuggee invokes 'next' command. The test fails if
+ *     b4689395.ERROR_MESSAGE message appears in output, otherwise the test passes.
+ * COMMENTS
+ *     The test reproduces the bug on Solsparc.
+ *     java version "1.4.1-beta"
+ *     Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
+ *     Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
+ *     Command line
+ *         ../jdk1.4.1-b14/solsparc/bin/java b4689395 -arch=sparc
+ *         -waittime=2 -debugee.vmkind=java
+ *         -jdb=../jdk1.4.1-b14/solsparc/bin/jdb
+ *         -workdir=../b4689395 -jdb.option= -debugee.vmkeys=
+ *     #launcher > Compound prompt found: main[1]
+ *     #Test cases starts.
+ *     #Sending command: stop at b4689395a:54
+ *     #
+ *     #launcher > Compound prompt found: main[1]
+ *     #Sending command: cont
+ *     #
+ *     #launcher > Compound prompt found: main[1]
+ *     #Sending command: redefine b4689395a b4689395/newclass/b4689395a.class
+ *     #
+ *     #launcher > Compound prompt found: main[1]
+ *     #Sending command: next
+ *     #
+ *     #launcher > Compound prompt found: main[1]
+ *     ## ERROR: 'ERROR_M' is not expected to be printed after 'next' command.
+ *     #Sending command: cont
+ *     #
+ *     #Test cases ends.
+ *     #Waiting for jdb exits
+ *     #jdb normally exited
+ *     ## ERROR: TEST FAILED
+ *     #
+ *     #
+ *     ##>
+ *     ##>  SUMMARY: Following errors occured
+ *     ##>      during test execution:
+ *     ##>
+ *     ## ERROR: 'ERROR_M' is not expected to be printed after 'next' command.
+ *     ## ERROR: TEST FAILED
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.regression.b4689395.b4689395
+ *        nsk.jdb.regression.b4689395.b4689395a
+ *
+ * @comment compile newclass/b4689395a.java to newclass
+ * @build ExecDriver
+ * @run driver PropertyResolvingWrapper ExecDriver --cmd
+ *      ${compile.jdk}/bin/javac
+ *      -d ${test.classes}/newclass
+ *      -cp ${test.class.path}
+ *      ${test.src}/newclass/b4689395a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.regression.b4689395.b4689395
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.regression.b4689395;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+import nsk.share.classload.ClassLoadUtils;
+
+import java.io.*;
+import java.util.*;
+
+public class b4689395 extends JdbTest {
+        final static String TEST_CLASS     = b4689395.class.getName();
+        final static String DEBUGGEE_CLASS = TEST_CLASS + "a";
+        final static String FIRST_BREAK    = DEBUGGEE_CLASS + ".main";
+        final static String ERROR_MESSAGE  = "ERROR_M";
+        final static int    LINE_NUMBER    = 54;
+        private String classFile;
+
+        public static void main (String argv[]) {
+                System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+        }
+
+        public static int run(String argv[], PrintStream out) {
+                debuggeeClass =  DEBUGGEE_CLASS;
+                firstBreak = FIRST_BREAK;
+                return new b4689395().runTest(argv, out);
+        }
+
+        public b4689395() {
+                classFile = ClassLoadUtils.getRedefineClassFileName(DEBUGGEE_CLASS);
+                if (classFile == null)
+                        throw new TestFailure("Unable to find redefine class file in classpath for: " + DEBUGGEE_CLASS);
+        }
+
+        protected void runCases() {
+                String[] reply;
+                reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + LINE_NUMBER);
+                reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+                if (new File(classFile).exists()) {
+                        reply = jdb.receiveReplyFor(JdbCommand.redefine + DEBUGGEE_CLASS
+                                        + " " + classFile);
+                        reply = jdb.receiveReplyFor(JdbCommand.next);
+
+                        Paragrep grep = new Paragrep(reply);
+                        if (grep.find(ERROR_MESSAGE) != 0) {
+                                log.complain("'" + ERROR_MESSAGE + "' is not expected to be "
+                                                + "printed after 'next' command.");
+                                success = false;
+                        }
+                } else {
+                        log.complain("File does not exist: " + classFile);
+                        success = false;
+                }
+
+                jdb.contToExit(1);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/b4689395a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.regression.b4689395;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/* This is debuggee aplication */
+public class b4689395a {
+        static b4689395a _b4689395a = new b4689395a();
+        final static String ERROR_MESSAGE  = "ERROR_M";
+
+        public static void main(String args[]) {
+                System.exit(Consts.JCK_STATUS_BASE + _b4689395a.runIt(args, System.out));
+        }
+
+        public int runIt(String args[], PrintStream out) {
+                JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+                Log log = new Log(out, argumentHandler);
+
+                minor();
+
+                log.display("Debuggee PASSED");
+                return Consts.TEST_PASSED;
+        }
+
+        public static void minor() {
+                System.out.println("In the top of the method minor()."); // b4689395.LINE_NUMBER
+                System.out.println("A breakpoint is here.");
+                System.out.println("In the bottom of the method minor().");
+                System.out.println(ERROR_MESSAGE);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/regression/b4689395/newclass/b4689395a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.regression.b4689395;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+/* This is debuggee aplication */
+public class b4689395a {
+        static b4689395a _b4689395a = new b4689395a();
+        final static String ERROR_MESSAGE  = "ERROR_M";
+
+        public static void main(String args[]) {
+                System.exit(Consts.JCK_STATUS_BASE + _b4689395a.runIt(args, System.out));
+        }
+
+        public int runIt(String args[], PrintStream out) {
+                JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+                Log log = new Log(out, argumentHandler);
+
+                minor();
+
+                log.display("Debuggee PASSED");
+                return Consts.TEST_PASSED;
+        }
+
+        public static void minor() {
+                System.out.println("In the top of the method minor()"); // b4689395.LINE_NUMBER
+                System.out.println("A breakpoint is here.");
+                System.out.println("In the bottom of the method minor().");
+                System.out.println(ERROR_MESSAGE);
+        }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/resume/resume002/resume002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/resume/resume002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This is a test for jdb 'resume all' and 'resume <thread id>' commands.
+ *  The debuggee starts 5 'MyThreads' that are all suspended on the lock
+ *  that the main thread holds. The the test driver issues the following
+ *  commands for check:
+ *    - 'suspend all' : "All threads suspended" message is expected in
+ *      jdb output stream;
+ *    - 'resume all' : "All threads resumed" message is expected in
+ *      jdb output stream;
+ *    - 'suspend <thread_id>' for each 'MyThread';
+ *    - 'resume <thread_id>' for each 'MyThread'.
+ *  The test consists of two parts:
+ *    resume002.java  - test driver, i.e. launches jdb and debuggee,
+ *                      writes commands to jdb, reads the jdb output,
+ *    resume002a.java - the debugged application.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/resume/resume001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.resume.resume002.resume002
+ *        nsk.jdb.resume.resume002.resume002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.resume.resume002.resume002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.resume.resume002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class resume002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new resume002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.resume.resume002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".resume002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String THREAD_NAME      = "MyThread";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        String[] threadIds = jdb.getThreadIds(PACKAGE_NAME + "." + THREAD_NAME);
+
+        reply = jdb.receiveReplyFor(JdbCommand.suspend);
+        grep = new Paragrep(reply);
+        if (grep.find("All threads suspended") == 0) {
+            failure("jdb cannot suspend all threads");
+        }
+        reply = jdb.receiveReplyFor(JdbCommand.resume, false);
+        grep = new Paragrep(reply);
+        if (grep.find("All threads resumed") == 0) {
+            failure("jdb cannot resume all threads");
+        }
+
+        jdb.receiveReplyFor(JdbCommand.thread + threadIds[0]);
+
+        for (int i = 0; i < resume002a.numThreads; i++) {
+            jdb.receiveReplyFor(JdbCommand.suspend + threadIds[i]);
+            jdb.receiveReplyFor(JdbCommand.resume + threadIds[i]);
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/resume/resume002/resume002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.resume.resume002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class resume002a {
+    public static void main(String args[]) {
+        resume002a _resume002a = new resume002a();
+        System.exit(resume002.JCK_STATUS_BASE + _resume002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+    static int numThreads = 5;   // number of threads
+    static Thread holder [] = new Thread[numThreads];
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        Lock lock = new Lock();
+
+        try {
+            lock.setLock();
+            for (int i = 0; i < numThreads ; i++) {
+                holder[i] = new MyThread(lock, "MyThread#" + i);
+                synchronized (waitnotify) {
+                    holder[i].start();
+                    waitnotify.wait();
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in main thread: " +
+                e.getMessage());
+            System.exit(resume002.FAILED);
+        }
+
+        lastBreak();   // When jdb stops here, there should be 5 running MyThreads.
+        lock.releaseLock();
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return resume002.PASSED;
+    }
+
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true)
+            wait();
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
+
+class MyThread extends Thread {
+
+    Lock lock;
+    String name;
+
+    MyThread (Lock l, String name) {
+        this.lock = l;
+        this.name = name;
+    }
+
+    public void run() {
+        synchronized (resume002a.waitnotify) {
+            resume002a.waitnotify.notifyAll();
+        }
+        try {
+            lock.setLock();
+        } catch(Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in MyThread: " +
+                e.getMessage());
+            System.exit(resume002.FAILED);
+        }
+        lock.releaseLock();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/run/run002/run002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/run/run002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the 'run' command.
+ *  The 'run' command is issued in the superclass of test driver class.
+ *  The test is passed if "run nsk.jdb.run.run002a" string is found
+ *  in jdb's output stream:
+ *  The test consists of two parts:
+ *   run002.java  - test driver, i.e. launches jdb and debuggee,
+ *                  writes commands to jdb, reads the jdb output,
+ *   run002a.java - the debugged application.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/run/run001 test and
+ *  replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.run.run002.run002
+ *        nsk.jdb.run.run002.run002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.run.run002.run002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.run.run002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class run002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new run002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.run.run002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".run002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.contToExit(1);
+
+        if (argumentHandler.isLaunchingConnector()) {
+            reply = jdb.getTotalReply();
+            grep = new Paragrep(reply);
+            v = new Vector();
+            v.add(JdbCommand.run);
+            v.add(DEBUGGEE_CLASS);
+            if (grep.find(v) != 1) {
+                failure("jdb failed to run debugged application.");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/run/run002/run002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.run.run002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class run002a {
+    static run002a _run002a = new run002a();
+
+    public static void main(String args[]) {
+       System.exit(run002.JCK_STATUS_BASE + _run002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        log.display("Debuggee PASSED");
+        return run002.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set001/set001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/set/set001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'set <lvalue> = <expr>' command.
+ * The test checks if jdb correctly sets value for the following
+ * fields and variables:
+ *  - static field,
+ *  - instance field
+ * The jdb suspends the debuggee inside the method runIt and then tries
+ * to set new values for the fields and variables using checked command.
+ * Then the debuggee checks if modified fields/variables have expected
+ * values. If not, then special errorMessage variable is appended with
+ * the info of wrong values. The test passes when length of errorMessage
+ * is equal to 0, and fails otherwise.
+ * The test consists of two program:
+ *   set001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   set001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.set.set001.set001
+ *
+ * @comment make sure set001a is compiled w/ full debug info
+ * @clean nsk.jdb.set.set001.set001a
+ * @compile -g:lines,source,vars set001a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.set.set001.set001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.set.set001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class set001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new set001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.set.set001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".set001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String ERROR_MESSAGE = DEBUGGEE_CLASS + ".errorMessage";
+
+    static final String[][] checkedExpr = {
+        { DEBUGGEE_CLASS + ".myStaticField", "-2147483648" },
+        { DEBUGGEE_CLASS + "._set001a.myInstanceField", "9223372036854775807" },
+                                          };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // to get out of lastBreak()
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+
+        // set values
+        for (int i = 0; i < checkedExpr.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.set + checkedExpr[i][0] + " = " + checkedExpr[i][1]);
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+        // check value of debuggeeResult
+        reply = jdb.receiveReplyFor(JdbCommand.eval + ERROR_MESSAGE);
+        //if everything is OK reply will look like this
+        //  nsk.jdb.set.set001.set001a.errorMessage = ""
+        if (!reply[0].contains("\"\"")) {
+            log.complain("jdb failed to set value for expression(s): ");
+            for (int i = 0; i < reply.length; i++) {
+                log.complain(reply[i]);
+            }
+            success = false;
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set001/set001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.set.set001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class set001a {
+
+    private static final String DEBUGGEE_PASSED = "Debuggee PASSED";
+    private static final String DEBUGGEE_FAILED = "Debuggee FAILED";
+
+    static set001a _set001a = new set001a();
+
+    public static void main(String args[]) {
+       System.exit(set001.JCK_STATUS_BASE + _set001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+        String debuggeeResult = DEBUGGEE_PASSED;
+
+        int localInt = 0;
+        lastBreak();
+        /* jdb should change values of fileds and variables */
+
+        if (set001a.myStaticField != Integer.MIN_VALUE) {
+            errorMessage += "\nWrong value of set001a.myStaticField: " + set001a.myStaticField + ", expected: " + Integer.MIN_VALUE;
+        }
+        if (_set001a.myInstanceField != Long.MAX_VALUE) {
+            errorMessage += "\nWrong value of _set001a.myInstanceField: " + _set001a.myInstanceField + ", expected: " + Long.MAX_VALUE;
+        }
+        if (errorMessage.length() > 0) {
+            debuggeeResult = DEBUGGEE_FAILED;
+        }
+
+        lastBreak(); // a breakpoint to check value of debuggeeResult
+
+        log.display(debuggeeResult);
+        if (debuggeeResult.equals(DEBUGGEE_PASSED)) {
+            return set001.PASSED;
+        } else {
+            return set001.FAILED;
+        }
+    }
+
+    static String errorMessage = "";
+    static private int myStaticField;
+    protected long myInstanceField;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set002/set002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/set/set002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'set <lvalue> = <expr>' command.
+ * The test checks if jdb correctly sets value for the following
+ * fields and variables:
+ *  - element of array field,
+ *  - local variable
+ * Probably needs to be merged with set001
+ * The jdb suspends the debuggee inside the method runIt and then tries
+ * to set new values for the fields and variables using checked command.
+ * Then the debuggee checks if modified fields/variables have expected
+ * values. If not, then special errorMessage variable is appended with
+ * the info of wrong values. The test passes when length of errorMessage
+ * is equal to 0, and fails otherwise.
+ * The test consists of two programs:
+ *   set002.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   set002a.java - the debugged application.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.set.set002.set002
+ *
+ * @comment make sure set002a is compiled w/ full debug info
+ * @clean nsk.jdb.set.set002.set002a
+ * @compile -g:lines,source,vars set002a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.set.set002.set002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.set.set002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class set002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+
+        return new set002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.set.set002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".set002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String ERROR_MESSAGE = DEBUGGEE_CLASS + ".errorMessage";
+
+    static final String[][] checkedExpr = {  //not broken, can be run safely even if 4660158 is not fixed
+        { DEBUGGEE_CLASS + "._set002a.myArrayField[0][0].line", "\"ABCDE\"" },
+        { "localInt", "java.lang.Integer.MIN_VALUE"}
+                                          };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // to get out of lastBreak()
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+
+        // set values
+        for (int i = 0; i < checkedExpr.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.set + checkedExpr[i][0] + " = " + checkedExpr[i][1]);
+        }
+
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+        // check value of debuggeeResult
+        reply = jdb.receiveReplyFor(JdbCommand.eval + ERROR_MESSAGE);
+
+        //if everything is OK reply will look like this
+        //  nsk.jdb.set.set002.set002a.errorMessage = ""
+        if (!reply[0].contains("\"\"")) {
+            log.complain("jdb failed to set value for expression(s): ");
+            for (int i = 0; i < reply.length; i++) {
+                log.complain(reply[i]);
+            }
+            success = false;
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/set/set002/set002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.set.set002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class set002a {
+
+    private static final String DEBUGGEE_PASSED = "Debuggee PASSED";
+    private static final String DEBUGGEE_FAILED = "Debuggee FAILED";
+
+    static set002a _set002a = new set002a();
+
+    public static void main(String args[]) {
+       System.exit(set002.JCK_STATUS_BASE + _set002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+        String debuggeeResult = DEBUGGEE_PASSED;
+
+        int localInt = 0;
+        lastBreak();
+        /* jdb should change values of fileds and variables */
+
+        if (!_set002a.myArrayField[0][0].toString().equals("ABCDE")) {
+            errorMessage += "\nWrong value of _set002a.myArrayField[0][0]: " + _set002a.myArrayField[0][0] + ", expected: \"ABCDE\"";
+        }
+        if (localInt != Integer.MIN_VALUE) {
+            errorMessage += "\nWrong value of localInt: " + localInt + ", expected: " + Integer.MIN_VALUE;
+        }
+        if (errorMessage.length() > 0) {
+            debuggeeResult = DEBUGGEE_FAILED;
+        }
+
+        lastBreak(); // a breakpoint to check value of debuggeeResult
+
+        log.display(debuggeeResult);
+        if (debuggeeResult.equals(DEBUGGEE_PASSED)) {
+            return set002.PASSED;
+        } else {
+            return set002.FAILED;
+        }
+    }
+
+    static String errorMessage = "";
+    public MyClass[][] myArrayField;
+
+    private set002a () {
+         myArrayField = new MyClass[][] {new MyClass[] {new MyClass("")}};
+    }
+
+    static class MyClass {
+        private String line;
+
+        public MyClass (String s) {
+            line = s;
+        }
+
+        public String toString() {
+             return line;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/step/step002/step002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/step/step002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * The test for the 'step' command.
+ * The test checks the following cases:
+ *   - step inside current method,
+ *   - step into called method,
+ *   - step up to calling method.
+ * The test works as follows. The jdb sets breakpoint at the line
+ * where new value is assigned to local variable. The jdb issues
+ * 'step' command. Then the test checks whether a step is done by
+ * requesting a value of local variable using 'eval' command.
+ * The next two cases are checked with a pair of 'step' and
+ * 'where' commands. The test checks a stack trace after step
+ * using 'where' command.
+ * The test consists of two program:
+ *   step002.java  - test driver, i.e. launches jdb and debuggee,
+ *                   writes commands to jdb, reads the jdb output,
+ *   step002a.java - the debugged application.
+ * COMMENTS
+ * This test replaces the nsk/jdb/step/step002 one.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.step.step002.step002
+ *
+ * @comment make sure step002a is compiled w/ full debug info
+ * @clean nsk.jdb.step.step002.step002a
+ * @compile -g:lines,source,vars step002a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.step.step002.step002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.step.step002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class step002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new step002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.step.step002";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".step002";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final int    BREAKPOINT_LINE = 50;
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + BREAKPOINT_LINE);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        // case #1 : step inside frame;
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+        reply = jdb.receiveReplyFor(JdbCommand.eval + "intVar");
+        grep = new Paragrep(reply);
+        if (grep.find("1234") == 0) {
+            failure("CASE #1 FAILED: Wrong location after step inside current method");
+        }
+
+        // case #1 : step into called frame;
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+        reply = jdb.receiveReplyFor(JdbCommand.where);
+        grep = new Paragrep(reply);
+        if (grep.find("foo") == 0) {
+            failure("CASE #2 FAILED: Wrong location after step into called method");
+        }
+
+        // case #1 : step out to calling frame;
+        reply = jdb.receiveReplyFor(JdbCommand.step);
+        reply = jdb.receiveReplyFor(JdbCommand.where);
+        grep = new Paragrep(reply);
+        if (grep.find("foo") > 0) {
+            failure("CASE #2 FAILED: Wrong location after step up to calling method");
+        }
+        if (grep.find("runIt") == 0) {
+            failure("CASE #2 FAILED: Wrong location after step up to calling method");
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/step/step002/step002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.step.step002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class step002a {
+    public static void main(String args[]) {
+       step002a _step002a = new step002a();
+       System.exit(step002.JCK_STATUS_BASE + _step002a.runIt(args, System.out));
+    }
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        int intVar = 0;
+        intVar += 1234;          // step002.BREAKPOINT_LINE
+        intVar = foo(2);
+
+        log.display("Debuggee PASSED");
+        return step002.PASSED;
+    }
+
+    int foo (int i) {
+        return i*i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/step_up/step_up001/step_up001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/step_up/step_up001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test for the 'step up' command.
+ * The debuggee program (step_up001a.java) creates two additional
+ * threads of MyThread type and starts them. The jdb sets up breakpoint
+ * inside the method 'func2' which is invoked in these addional threads.
+ * When breakpoint is hitted the checked command is called. After this,
+ * the stack trace of the current method is checked by 'where' command.
+ * The test passes if only caller method ('func1') presents in stack
+ * trace, but neither of 'func2' nor 'func3' methods.
+ * The test consists of two program:
+ *   step_up001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   step_up001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.step_up.step_up001.step_up001
+ *        nsk.jdb.step_up.step_up001.step_up001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.step_up.step_up001.step_up001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.step_up.step_up001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class step_up001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new step_up001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.step_up.step_up001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".step_up001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+
+    static final String[] checkedMethods = {"func1", "func2", "func3"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        int breakCount = 0;
+        int stepupCount = 0;
+        for (int i = 0; i < step_up001a.numThreads; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            if (jdb.isAtBreakpoint(reply, LAST_BREAK)) {
+                breakCount++;
+                reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak;
+
+                reply = jdb.receiveReplyFor(JdbCommand.step_up);
+                if (!checkSteppedUp()) {
+                    success = false;
+                } else {
+                    stepupCount++;
+                }
+            }
+        }
+
+        jdb.contToExit(1);
+
+        if (stepupCount != step_up001a.numThreads) {
+            log.complain("Wrong number of step up events: " + stepupCount);
+            log.complain("Must be equal to : " + step_up001a.numThreads);
+            success = false;
+        }
+    }
+
+
+    private boolean checkSteppedUp () {
+        Paragrep grep;
+        String found;
+        int count;
+        boolean result = true;
+        String[] reply;
+
+        reply = jdb.receiveReplyFor(JdbCommand.where);
+
+        grep = new Paragrep(reply);
+        for (int i = 1 /* !!! */; i < checkedMethods.length; i++) {
+            count = grep.find(DEBUGGEE_THREAD + "." + checkedMethods[i]);
+            if (count > 0) {
+                log.complain("Wrong method in thread stack trace: " + DEBUGGEE_THREAD + "." + checkedMethods[i]);
+                result= false;
+            }
+        }
+
+        count = grep.find(DEBUGGEE_THREAD + "." + checkedMethods[0]);
+        if (count != 1) {
+            log.complain("Checked method does not exist in thread stack trace: " + DEBUGGEE_THREAD + "." + checkedMethods[0]);
+            result= false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/step_up/step_up001/step_up001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.step_up.step_up001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class step_up001a {
+    public static void main(String args[]) {
+       step_up001a _step_up001a = new step_up001a();
+       System.exit(step_up001.JCK_STATUS_BASE + _step_up001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static final String MYTHREAD  = "MyThread";
+    static final int numThreads   = 2;   // number of threads.
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        Thread holder [] = new Thread[numThreads];
+
+        for (int i = 0; i < numThreads ; i++) {
+            holder[i] = new MyThread();
+            holder[i].start();
+            try {
+                holder[i].join();
+            } catch (InterruptedException e) {
+                log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                return step_up001.FAILED;
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return step_up001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    public void run() {
+        int runLocal = func1(100);
+    }
+
+    public int func1(int i) {
+        return func2(i);
+    }
+
+    public int func2(int i) {
+        step_up001a.lastBreak();
+
+        return func3(i);
+    }
+
+    public int func3(int i) {
+        return i*i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/stop_at/stop_at002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *    Regression test for:
+ *    Bug ID: 4299394
+ *    Synopsis: TTY: Deferred breakpoints can't be set on inner classes
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.stop_at.stop_at002.stop_at002
+ *        nsk.jdb.stop_at.stop_at002.stop_at002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.stop_at.stop_at002.stop_at002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.stop_at.stop_at002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * Regression test for:
+ * Bug ID: 4299394
+ * Synopsis: TTY: Deferred breakpoints can't be set on inner classes
+ *
+ */
+
+public class stop_at002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new stop_at002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.stop_at.stop_at002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".stop_at002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:43";
+    static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:57";
+    static final String FAILURE_PATTERN = "Unable to set";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        if (!checkStop(DEBUGGEE_LOCATION1)) {
+            success = false;
+        }
+
+        if (!checkStop(DEBUGGEE_LOCATION2)) {
+            success = false;
+        }
+
+        jdb.contToExit(3);
+    }
+
+    private boolean checkStop (String location) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        boolean result = true;
+
+        log.display("Trying to set breakpoint at line: " + location);
+        reply = jdb.receiveReplyFor(JdbCommand.stop_at + location);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(FAILURE_PATTERN);
+        if (found.length() > 0) {
+            log.complain("jdb failed to set line breakpoint at line: " + found);
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.stop_at.stop_at002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class stop_at002a {
+    public static void main(String args[]) {
+       stop_at002a _stop_at002a = new stop_at002a();
+       lastBreak();
+       System.exit(stop_at002.JCK_STATUS_BASE + _stop_at002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        new Nested(true).new DeeperNested().new DeepestNested().foo(false);
+        Immersible var = new Inner().new MoreInner();
+        var.foo("whatever");
+
+        log.display("Debuggee PASSED");
+        return stop_at002.PASSED;
+    }
+
+    class Nested {
+        boolean flag;
+        Nested (boolean b) {
+            flag = b;
+        }
+        class DeeperNested {
+            class  DeepestNested {
+                public void foo(boolean input) {
+                    flag = input; /* <--------  This is line number 43 */
+                }
+            }
+        }
+    }
+
+    class Inner {
+        class MoreInner implements Immersible {
+            String content;
+
+            public MoreInner() {
+                content = "";
+            }
+            public void foo(String input) {
+                content += input; /* <--------  This is line number 57 */
+            }
+        }
+    }
+}
+
+interface Immersible {
+    public void foo(String input);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at003/stop_at003.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/stop_at/stop_at003.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the jdb "stop at <class:line>" command.
+ *  The test driver sets three breakpoints in debugged 'stop_at003b'
+ *  class:
+ *   - at line in static initilizer,
+ *   - at line in instance initilizer,
+ *   - at line in constructor,
+ *   - at line in exception handler.
+ *  The test passes if the debuggee is suspended at every breakpoint
+ *  had been set and "Breakpoint hit" message had been printed in
+ *  jdb's output stream.
+ *  The test consists of:
+ *   nsk.jdb.stop_at.stop_at003.java - test driver,
+ *   nsk.jdb.stop_at.stop_at003a.java - debugged application.
+ * COMMENTS
+ *  This test functionally covers to nsk/jdb/stop_at/stop_at001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.stop_at.stop_at003.stop_at003
+ *        nsk.jdb.stop_at.stop_at003.stop_at003a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.stop_at.stop_at003.stop_at003
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.stop_at.stop_at003;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * Regression test for:
+ * Bug ID: 4299394
+ * Synopsis: TTY: Deferred breakpoints can't be set on inner classes
+ *
+ */
+
+public class stop_at003 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new stop_at003().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.stop_at.stop_at003";
+    static final String TEST_CLASS = PACKAGE_NAME + ".stop_at003";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String[][] LOCATIONS = new String[][] {
+        { PACKAGE_NAME + ".stop_at003b:61", PACKAGE_NAME + ".stop_at003b.<clinit>()" },
+        { PACKAGE_NAME + ".stop_at003b:63", PACKAGE_NAME + ".stop_at003b.<init>()" },
+        { PACKAGE_NAME + ".stop_at003b:66", PACKAGE_NAME + ".stop_at003b.<init>()" },
+        { PACKAGE_NAME + ".stop_at003b:72", PACKAGE_NAME + ".stop_at003b.foo()" }
+                                                   };
+    static final String FAILURE_PATTERN = "Unable to set";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        for (int i = 0; i < LOCATIONS.length; i++) {
+            if (!checkStop(LOCATIONS[i][0])) {
+                failure("jdb failed to set line breakpoint at : " + LOCATIONS[i][0]);
+            }
+        }
+
+        for (int i = 0; i < LOCATIONS.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            if (!jdb.isAtBreakpoint(reply, LOCATIONS[i][1])) {
+                failure("Missed breakpoint at : " + LOCATIONS[i][0]);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkStop (String location) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        boolean result = true;
+
+        log.display("Trying to set breakpoint at line: " + location);
+        reply = jdb.receiveReplyFor(JdbCommand.stop_at + location);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(FAILURE_PATTERN);
+        if (found.length() > 0) {
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at003/stop_at003a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.stop_at.stop_at003;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class stop_at003a {
+
+
+    public static void main(String args[]) {
+       stop_at003a _stop_at003a = new stop_at003a();
+//       lastBreak();
+       System.exit(stop_at003.JCK_STATUS_BASE + _stop_at003a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        stop_at003b b = new stop_at003b();
+        b.foo();
+
+        log.display("Debuggee PASSED");
+        return stop_at003.PASSED;
+    }
+}
+
+class stop_at003b {
+    static int intField = 0;
+
+    static { intField = 1; }      // stop_at003.LOCATIONS[0]
+
+    { intField = 2; }             // stop_at003.LOCATIONS[1]
+
+    stop_at003b () {
+        intField++;               // stop_at003.LOCATIONS[2]
+    }
+
+    void foo () {
+        try {
+            throw new Exception("Exception in foo()");
+        } catch (Exception e) {   // stop_at003.LOCATIONS[3]
+            System.out.println("Exception in foo() is catched.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_in/stop_in002/stop_in002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/stop_in/stop_in002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This is a test for the jdb "stop at <class:line>" command.
+ *  The test driver sets three breakpoints in debugged 'stop_in002b'
+ *  class:
+ *   - in static initilizer,
+ *   - in constructor,
+ *   - in a method of static nested class,
+ *   - in a method of instance nested class,
+ *   - in final method.
+ *  The test passes if the debuggee is suspended at every breakpoint
+ *  had been set and "Breakpoint hit" message had been printed in
+ *  jdb's output stream.
+ *  The test consists of:
+ *   nsk.jdb.stop_in.stop_in002.java - test driver,
+ *   nsk.jdb.stop_in.stop_in002a.java - debugged application.
+ * COMMENTS
+ *  This test functionally covers nsk/jdb/stop_in/stop_in001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.stop_in.stop_in002.stop_in002
+ *        nsk.jdb.stop_in.stop_in002.stop_in002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.stop_in.stop_in002.stop_in002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.stop_in.stop_in002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+/*
+ * Regression test for:
+ * Bug ID: 4299394
+ * Synopsis: TTY: Deferred breakpoints can't be set on inner classes
+ *
+ */
+
+public class stop_in002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new stop_in002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.stop_in.stop_in002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".stop_in002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final String[] LOCATIONS = new String[] {
+        PACKAGE_NAME + ".stop_in002b.<clinit>",
+        PACKAGE_NAME + ".stop_in002b.<init>",
+        PACKAGE_NAME + ".stop_in002b$StaticNested.m1",
+        PACKAGE_NAME + ".stop_in002b$Inner.m2",
+        PACKAGE_NAME + ".stop_in002b.foo"
+                                                   };
+    static final String FAILURE_PATTERN = "Unable to set";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        for (int i = 0; i < LOCATIONS.length; i++) {
+            if (!checkStop(LOCATIONS[i])) {
+                failure("jdb failed to set line breakpoint at : " + LOCATIONS[i]);
+            }
+        }
+
+        for (int i = 0; i < LOCATIONS.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            if (!jdb.isAtBreakpoint(reply, LOCATIONS[i])) {
+                failure("Missed breakpoint at : " + LOCATIONS[i]);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkStop (String location) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        boolean result = true;
+
+        log.display("Trying to set breakpoint at : " + location);
+        reply = jdb.receiveReplyFor(JdbCommand.stop_in + location);
+
+        grep = new Paragrep(reply);
+        found = grep.findFirst(FAILURE_PATTERN);
+        if (found.length() > 0) {
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_in/stop_in002/stop_in002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.stop_in.stop_in002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class stop_in002a {
+
+
+    public static void main(String args[]) {
+       stop_in002a _stop_in002a = new stop_in002a();
+//       lastBreak();
+       System.exit(stop_in002.JCK_STATUS_BASE + _stop_in002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        stop_in002b b = new stop_in002b();
+        stop_in002b.StaticNested.m1();
+        b.inn.m2();
+        b.foo(1);
+
+        log.display("Debuggee PASSED");
+        return stop_in002.PASSED;
+    }
+}
+
+class stop_in002b {
+    static int intField = 0;
+    Inner inn = null;
+
+    static { intField = 1; }
+
+    stop_in002b () {
+        intField++;
+        inn = new Inner();
+    }
+
+    static class StaticNested {
+        public static void m1() {}
+    }
+
+    class Inner {
+        public void m2() {}
+    }
+
+    final int foo (int i) {return i++;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/suspend/suspend001/suspend001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/suspend/suspend001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test case for the 'suspend <thread id>' command.
+ * The debugged application (suspend001a.java) creates two addional threads.
+ * First thead is of Suspended class, second one is of MyThread class.
+ * The jdb stops debuggee at a moment after addional thread have started and
+ * before their completion. Then jdb calls 'suspend' command with id of
+ * the Suspended thread and resumes debuggee. The suspended thread should
+ * not modify special int 'notSuspended' variable of the suspend001a class.
+ * The test passes if suspend001a.notSuspended variable equals to 1, i.e.
+ * only not-suspended MyThread thread had modified it.
+ * The test consists of two program:
+ *   suspend001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   suspend001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.suspend.suspend001.suspend001
+ *        nsk.jdb.suspend.suspend001.suspend001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.suspend.suspend001.suspend001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.suspend.suspend001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class suspend001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new suspend001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.suspend.suspend001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".suspend001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK    = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK     = DEBUGGEE_CLASS + ".breakHere";
+
+    static final String SUSPENDED       = "Suspended";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + SUSPENDED;
+    static final String DEBUGGEE_RESULT = DEBUGGEE_CLASS + ".notSuspended";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+        while (true) {
+            threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+            if (threads.length != 1) {
+                log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
+                log.complain("Found: " + threads.length);
+                success = false;
+                break;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.suspend + threads[0]);
+
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+            if (!jdb.isAtBreakpoint(reply)) {
+                log.complain("Debugge does not reached second breakHere breakpoint");
+                success = false;
+                break;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.eval + DEBUGGEE_RESULT);
+            grep = new Paragrep(reply);
+            found = grep.findFirst(DEBUGGEE_RESULT + " =" );
+            if (found.length() > 0 && found.indexOf(DEBUGGEE_RESULT + " = null") < 0) {
+                if (found.indexOf(DEBUGGEE_RESULT + " = 1") < 0) {
+                   log.complain("Wrong value of " + DEBUGGEE_RESULT);
+                   log.complain(found);
+                   success = false;
+                }
+            } else {
+                log.complain("TEST BUG: not found value for " + DEBUGGEE_RESULT);
+                success = false;
+            }
+
+            break;
+        }
+
+        jdb.contToExit(2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/suspend/suspend001/suspend001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.suspend.suspend001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class suspend001a {
+    static suspend001a _suspend001a = new suspend001a();
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    public static void main(String args[]) {
+       System.exit(suspend001.JCK_STATUS_BASE + _suspend001a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    static Object lock                   = new Object();
+    static Object waitnotify             = new Object();
+    public static volatile int notSuspended = 0;
+
+    public int runIt(String args[], PrintStream out) {
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        Thread suspended = new Suspended("Suspended");
+        Thread myThread = new MyThread("MyThread");
+
+        // lock monitor to prevent threads from finishing after they started
+        synchronized (lock) {
+            synchronized (waitnotify) {
+                    suspended.start();
+                    try {
+                        waitnotify.wait();
+                    } catch (InterruptedException e) {
+                        log.complain("Main thread was interrupted while waiting for start of Suspended thread");
+                        return suspend001.FAILED;
+                    }
+
+                    myThread.start();
+                    try {
+                        waitnotify.wait();
+                    } catch (InterruptedException e) {
+                        log.complain("Main thread was interrupted while waiting for start of MyThread thread");
+                        return suspend001.FAILED;
+                    }
+            }
+            breakHere();  // a break to get thread ids and then to suspend Suspended thread.
+        }
+
+        // wait for MyThread completion
+        if (myThread.isAlive()) {
+            try {
+                myThread.join();
+            } catch (InterruptedException e) {
+                log.display("Main thread was interrupted while waiting for finish of MyThread thread");
+            }
+        }
+
+        // give 3 seconds for suspended thread to finish (if it is not really suspended).
+        try {
+            Thread.currentThread().sleep(3 * 1000);
+        } catch (InterruptedException e) {
+            log.display("Main thread was interrupted while sleeping");
+        }
+
+        breakHere(); // a break to check if Suspended was suspended
+
+        log.display("notSuspended == " + notSuspended);
+        log.display("Debuggee PASSED");
+        return suspend001.PASSED;
+    }
+
+    public static int getResult() {
+        return notSuspended;
+    }
+}
+
+class Suspended extends Thread {
+    String name;
+
+    public Suspended (String n) {
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        final String ThreadFinished = "Thread finished: " + this.name;
+        suspend001a.log.display("Thread started: " + this.name);
+
+        synchronized (suspend001a.waitnotify) {
+            suspend001a.waitnotify.notify();
+        }
+        // prevent thread from early finish
+        synchronized (suspend001a.lock) {}
+
+        suspend001a.notSuspended++;
+
+        suspend001a.log.display(ThreadFinished);
+    }
+}
+
+class MyThread extends Thread {
+    String name;
+
+    public MyThread (String n) {
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        final String ThreadFinished = "Thread finished: " + this.name;
+        suspend001a.log.display("Thread started: " + this.name);
+
+        synchronized (suspend001a.waitnotify) {
+            suspend001a.waitnotify.notify();
+        }
+        // prevent thread from early finish
+        synchronized (suspend001a.lock) {}
+
+        suspend001a.notSuspended++;
+
+        suspend001a.log.display(ThreadFinished);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/thread/thread002/thread002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/thread/thread002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This is a test for jdb 'thread <thread id>' command.
+ *  The debugee starts 5 'MyThreads' that are all suspended on the lock
+ *  that the main thread posseses. The 'threads' command is issued
+ *  at this point to obtain ids' od auxiliary threads. Then for each id
+ *  the 'thread' command is issued. The test checks that jdb correctly
+ *  switches between threads using 'eval <expr>' command. The expression
+ *  must return a string containing the name of current thread.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/threads/threads001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.thread.thread002.thread002
+ *        nsk.jdb.thread.thread002.thread002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.thread.thread002.thread002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.thread.thread002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class thread002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new thread002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.thread.thread002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".thread002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String THREAD_NAME      = "MyThread";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        String[] threadIds = jdb.getThreadIds(PACKAGE_NAME + "." + THREAD_NAME);
+
+        for (int i = 0; i < thread002a.numThreads; i++) {
+            jdb.receiveReplyFor(JdbCommand.thread + threadIds[i]);
+            jdb.receiveReplyFor(JdbCommand.print + DEBUGGEE_CLASS + ".holder[" + i + "].name");
+        }
+
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        grep = new Paragrep(reply);
+        for (int i = 0; i < threadIds.length; i++) {
+            count = grep.find(THREAD_NAME + "#" + i);
+            if (count != 1) {
+                 failure("jdb failed to switch to thread: " + threadIds[i]);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/thread/thread002/thread002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.thread.thread002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class thread002a {
+    public static void main(String args[]) {
+        thread002a _thread002a = new thread002a();
+        System.exit(thread002.JCK_STATUS_BASE + _thread002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+    static int numThreads = 5;   // number of threads
+    static Thread holder [] = new Thread[numThreads];
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        Lock lock = new Lock();
+
+        try {
+            lock.setLock();
+            for (int i = 0; i < numThreads ; i++) {
+                holder[i] = new MyThread(lock, "MyThread#" + i);
+                synchronized (waitnotify) {
+                    holder[i].start();
+                    waitnotify.wait();
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in main thread: " +
+                e.getMessage());
+            System.exit(thread002.FAILED);
+        }
+
+        lastBreak();   // When jdb stops here, there should be 5 running MyThreads.
+        lock.releaseLock();
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return thread002.PASSED;
+    }
+
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true)
+            wait();
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
+
+class MyThread extends Thread {
+
+    Lock lock;
+    String name;
+
+    MyThread (Lock l, String name) {
+        this.lock = l;
+        this.name = name;
+    }
+
+    public void run() {
+        synchronized (thread002a.waitnotify) {
+            thread002a.waitnotify.notifyAll();
+        }
+        try {
+            lock.setLock();
+        } catch(Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in MyThread: " +
+                e.getMessage());
+            System.exit(thread002.FAILED);
+        }
+        lock.releaseLock();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/threadgroup/threadgroup002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This is a test for jdb 'threadgroup <threadgroup_name>' command.
+ *  The main thread creates 3 threadgroups of 5 threads each.
+ *  All threads are locked in their 'run' method on a lock that the main
+ *  thread holds. The test passes if jdb correctly switches between
+ *  three user-defined threadgroups using 'threadgroup' command.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/threadgroup/threadgroup001
+ *  test and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.threadgroup.threadgroup002.threadgroup002
+ *        nsk.jdb.threadgroup.threadgroup002.threadgroup002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.threadgroup.threadgroup002.threadgroup002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.threadgroup.threadgroup002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class threadgroup002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new threadgroup002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.threadgroup.threadgroup002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".threadgroup002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+        jdb.receiveReplyFor(JdbCommand.threadgroups);
+
+        for (int i = 0; i < threadgroup002a.numThreadGroups; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.threadgroup + threadgroup002a.THREADGROUP_NAME + i);
+            grep = new Paragrep(reply);
+            count = grep.find("not a valid threadgroup name");
+            if (count > 0) {
+                failure("jdb cannot switch to valid threadgroup: " + threadgroup002a.THREADGROUP_NAME + i);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroup/threadgroup002/threadgroup002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.threadgroup.threadgroup002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class threadgroup002a {
+    public static void main(String args[]) {
+        threadgroup002a _threadgroup002a = new threadgroup002a();
+        System.exit(threadgroup002.JCK_STATUS_BASE + _threadgroup002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static int numThreadGroups = 3;
+    static int numThreads      = 15;
+    static Object waitnotify   = new Object();
+    final static String THREADGROUP_NAME = "MyThreadGroup#";
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        ThreadGroup tgHolder[] = new ThreadGroup[numThreadGroups];
+        Thread holder [] = new Thread[numThreads];
+        Lock lock = new Lock();
+
+        for (int i = 0; i < numThreadGroups ; i++ )
+            tgHolder[i] = new ThreadGroup(THREADGROUP_NAME + i);
+
+        try {
+            lock.setLock();
+            int factor = numThreads / numThreadGroups;
+            int k;
+            for (int i = 0; i < numThreadGroups ; i++) {
+                for (int j = 0; j < factor ; j++) {
+                    k = i * factor + j;
+                    holder[k] = new MyThread(lock, tgHolder[i], "MyThread#");
+                    synchronized (waitnotify) {
+                        holder[k].start();
+                        waitnotify.wait();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in main thread: " +
+                e.getMessage());
+            System.exit(threadgroup002.FAILED);
+        }
+
+        lastBreak();   // When jdb stops here, there should be 5 running MyThreads.
+        lock.releaseLock();
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return threadgroup002.PASSED;
+    }
+
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true)
+            wait();
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
+
+class MyThread extends Thread {
+
+    Lock lock;
+    MyThread (Lock l, ThreadGroup group, String name) {
+        super(group, name);
+        this.lock = l;
+    }
+
+    public void run() {
+        synchronized (threadgroup002a.waitnotify) {
+            threadgroup002a.waitnotify.notifyAll();
+        }
+        try {
+            lock.setLock();
+        } catch(Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in MyThread: " +
+                e.getMessage());
+            System.exit(threadgroup002.FAILED);
+        }
+        lock.releaseLock();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroups/threadgroups002/threadgroups002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/threadgroups/threadgroups002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This is a test for jdb 'threadgroups' command.
+ *  The main thread creates 3 threadgroups of 5 threads each.
+ *  All threads are locked in their 'run' method on a lock that the main
+ *  thread holds. The 'threadgroups' command is issued at this point.
+ *  The test passes if three user-defined threadgroups are reported.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/threadgroups/threadgroups001
+ *  test and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.threadgroups.threadgroups002.threadgroups002
+ *        nsk.jdb.threadgroups.threadgroups002.threadgroups002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.threadgroups.threadgroups002.threadgroups002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.threadgroups.threadgroups002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class threadgroups002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new threadgroups002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.threadgroups.threadgroups002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".threadgroups002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.threadgroups);
+        grep = new Paragrep(reply);
+        count = grep.find(threadgroups002a.THREADGROUP_NAME);
+        if (count != threadgroups002a.numThreadGroups ) {
+            failure("Unexpected number of " + threadgroups002a.THREADGROUP_NAME + " was listed: " + count +
+                "\n\texpected value: " + threadgroups002a.numThreadGroups);
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroups/threadgroups002/threadgroups002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.threadgroups.threadgroups002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class threadgroups002a {
+    public static void main(String args[]) {
+        threadgroups002a _threadgroups002a = new threadgroups002a();
+        System.exit(threadgroups002.JCK_STATUS_BASE + _threadgroups002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static int numThreadGroups = 3;
+    static int numThreads      = 15;
+    static Object waitnotify   = new Object();
+    final static String THREADGROUP_NAME = "MyThreadGroup#";
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        ThreadGroup tgHolder[] = new ThreadGroup[numThreadGroups];
+        Thread holder [] = new Thread[numThreads];
+        Lock lock = new Lock();
+
+        for (int i = 0; i < numThreadGroups ; i++ )
+            tgHolder[i] = new ThreadGroup(THREADGROUP_NAME + i);
+
+        try {
+            lock.setLock();
+            int factor = numThreads / numThreadGroups;
+            int k;
+            for (int i = 0; i < numThreadGroups ; i++) {
+                for (int j = 0; j < factor ; j++) {
+                    k = i * factor + j;
+                    holder[k] = new MyThread(lock, tgHolder[i], "MyThread#");
+                    synchronized (waitnotify) {
+                        holder[k].start();
+                        waitnotify.wait();
+                    }
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in main thread: " +
+                e.getMessage());
+            System.exit(threadgroups002.FAILED);
+        }
+
+        lastBreak();   // When jdb stops here, there should be 5 running MyThreads.
+        lock.releaseLock();
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return threadgroups002.PASSED;
+    }
+
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true)
+            wait();
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
+
+class MyThread extends Thread {
+
+    Lock lock;
+    MyThread (Lock l, ThreadGroup group, String name) {
+        super(group, name);
+        this.lock = l;
+    }
+
+    public void run() {
+        synchronized (threadgroups002a.waitnotify) {
+            threadgroups002a.waitnotify.notifyAll();
+        }
+        try {
+            lock.setLock();
+        } catch(Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in MyThread: " +
+                e.getMessage());
+            System.exit(threadgroups002.FAILED);
+        }
+        lock.releaseLock();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threads/threads002/threads002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/threads/threads002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This is a test for jdb 'threads' command.
+ *  The debugee starts 5 'MyThreads' that are all suspended on the lock
+ *  that the main thread posseses. The 'threads' command is issued
+ *  at this point. The test passes if 5 suspended 'MyThreads' are reported.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/threads/threads001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.threads.threads002.threads002
+ *        nsk.jdb.threads.threads002.threads002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.threads.threads002.threads002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.threads.threads002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class threads002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new threads002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.threads.threads002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".threads002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String THREAD_NAME      = PACKAGE_NAME + ".MyThread";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.threads);
+        grep = new Paragrep(reply);
+        count = grep.find(THREAD_NAME);
+        if (count != threads002a.numThreads ) {
+            failure("Unexpected number of " + THREAD_NAME + " was listed: " + count +
+                "\n\texpected value: " + threads002a.numThreads);
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/threads/threads002/threads002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.threads.threads002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class threads002a {
+    public static void main(String args[]) {
+        threads002a _threads002a = new threads002a();
+        System.exit(threads002.JCK_STATUS_BASE + _threads002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static int numThreads = 5;   // number of threads
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        Thread holder [] = new Thread[numThreads];
+        Lock lock = new Lock();
+
+        try {
+            lock.setLock();
+            for (int i = 0; i < numThreads ; i++) {
+                holder[i] = new MyThread(lock);
+                synchronized (waitnotify) {
+                    holder[i].start();
+                    waitnotify.wait();
+                }
+            }
+        } catch (Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in main thread: " +
+                e.getMessage());
+            System.exit(threads002.FAILED);
+        }
+
+        lastBreak();   // When jdb stops here, there should be 5 running MyThreads.
+        lock.releaseLock();
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return threads002.PASSED;
+    }
+
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true)
+            wait();
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
+
+class MyThread extends Thread {
+
+    Lock lock;
+    MyThread (Lock l) {
+        this.lock = l;
+    }
+
+    public void run() {
+        synchronized (threads002a.waitnotify) {
+            threads002a.waitnotify.notifyAll();
+        }
+        try {
+            lock.setLock();
+        } catch(Exception e) {
+            System.err.println("TEST ERROR: Caught unexpected Exception while waiting in MyThread: " +
+                e.getMessage());
+            System.exit(threads002.FAILED);
+        }
+        lock.releaseLock();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/trace/trace001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'trace methods <thread id>' command.
+ * The debuggee program (trace001a.java) creates two of additional
+ * threads with name like "MyThread-<number>" and starts them. The jdb
+ * suspends the debuggee at a moment when the additional threads are
+ * waiting for notification for lock objects and then turns on method
+ * tracing for these threads by checked command. After expected
+ * notification the additional threads invoke checked debuggee's methods.
+ * Thus jdb output must have the trace messages of checked methods'
+ * entrance and exit. The test passes if jdb output has two 'enter' messages
+ * and two 'exit' messages for every checked method.
+ * The test consists of two program:
+ *   trace001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   trace001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.trace.trace001.trace001
+ *        nsk.jdb.trace.trace001.trace001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.trace.trace001.trace001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.trace.trace001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class trace001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new trace001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.trace.trace001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".trace001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+
+    static final String[] CHECKED_METHODS = {"func1", "func2", "func3"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != 2) {
+            log.complain("jdb should report 2 instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.trace + "methods " + threads[i]);
+        }
+
+        jdb.contToExit(CHECKED_METHODS.length*threads.length*2 + 3);
+
+        reply = jdb.getTotalReply();
+        if (!checkTrace(CHECKED_METHODS, reply)) {
+            success = false;
+        }
+    }
+
+    private boolean checkTrace (String[] checkedMethods, String[] reply) {
+        Paragrep grep;
+        String found;
+        int count;
+        Vector v = new Vector();
+        boolean result = true;
+
+        grep = new Paragrep(reply);
+        for (int i = 0; i < checkedMethods.length; i++) {
+            v.removeAllElements();
+            v.add(DEBUGGEE_THREAD + "." + checkedMethods[i]);
+            v.add("Method entered");
+            count = grep.find(v);
+            if (count != 2) {
+                log.complain("Count of method enter is incorrect for the method : " + DEBUGGEE_THREAD + "." + checkedMethods[i]);
+                log.complain("Should be 2 trace messages, found : " + count);
+                result= false;
+            }
+
+            v.removeAllElements();
+            v.add(DEBUGGEE_THREAD + "." + checkedMethods[i]);
+            v.add("Method exited");
+            count = grep.find(v);
+            if (count != 2) {
+                log.complain("Count of method exit is incorrect for the method : " + DEBUGGEE_THREAD + "." + checkedMethods[i]);
+                log.complain("Should be 2 trace messages, found : " + count);
+                result= false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/trace/trace001/trace001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.trace.trace001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class trace001a {
+    public static void main(String args[]) {
+       trace001a _trace001a = new trace001a();
+       System.exit(trace001.JCK_STATUS_BASE + _trace001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static final String MYTHREAD  = "MyThread";
+    static final int numThreads   = 2;   // number of threads.
+
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i;
+        Thread holder [] = new Thread[numThreads];
+        Object[] locks = new Object[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            locks[i]  = new Object();
+            holder[i] = new MyThread(locks[i],MYTHREAD + "-" + i);
+        }
+
+        synchronized (waitnotify) {
+            for (i = 0; i < numThreads ; i++) {
+                holder[i].start();
+                try {
+                    waitnotify.wait();
+                } catch (InterruptedException e) {
+                    System.out.println("Main thread was interrupted while waiting for start of " + MYTHREAD + "-" + i);
+                    return trace001.FAILED;
+                }
+
+                synchronized (locks[i]) {  // holder[i] must wait on its lock[i] at this moment.
+                    System.out.println("Thread " + MYTHREAD + "-" + i + " is waiting");
+                }
+            }
+        }
+        lastBreak();  // a break to get thread ids and then to turn on tracing.
+
+        // waits on all MyThreads completion
+        for (i = 0; i < numThreads ; i++) {
+            synchronized (locks[i]) {
+                locks[i].notifyAll();
+            }
+            if (holder[i].isAlive() && !holder[i].interrupted()) {
+                try {
+                    holder[i].join();
+                } catch (InterruptedException e) {
+                    System.out.println("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                    return trace001.FAILED;
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return trace001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    Object lock;
+    String name;
+
+    public MyThread (Object l, String n) {
+        lock = l;
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        final String ThreadFinished = "Thread finished: " + this.name;
+        final String ThreadInterrupted = "Thread was interrupted: " + this.name;
+        System.out.println("Thread started: " + this.name);
+
+        synchronized (lock) {
+            synchronized (trace001a.waitnotify) {
+                trace001a.waitnotify.notify();
+            }
+
+            try {
+                lock.wait();
+                int square = func1(100);
+                System.out.println(ThreadFinished);
+            } catch (InterruptedException e) {
+                System.out.println(ThreadInterrupted);
+                e.printStackTrace();
+            }
+        }
+
+        System.out.println(ThreadFinished);
+    }
+
+    public int func1(int i) {
+        return func2(i);
+    }
+
+    public int func2(int i) {
+        return func3(i);
+    }
+
+    public int func3(int i) {
+        return i*i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/uncaught_exception/uncaught_exception002/uncaught_exception002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/uncaught_exception/uncaught_exception002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ *  This goal of this test is to verify that when the debugee
+ *  throws an uncaught exception, jdb halts the execution at the point
+ *  where the exception was thrown. The test verifies the following:
+ *    - the locals variables at this point can be printed out,
+ *    - "Exception occured" message is printed out.
+ *  The test consists of two parts:
+ *    uncaught_exception002.java  - test driver, i.e. launches jdb and debuggee,
+ *                       writes commands to jdb, reads the jdb output,
+ *    uncaught_exception002a.java - the debugged application.
+ * COMMENTS
+ *  The test is functionally equal to
+ *  nsk/jdb/uncaught_exception/uncaught_exception002 test and replaces it.
+ *  Modified due to fix of the bug:
+ *  4818762 TEST_BUG: two jdb test incorrectly check debuggee exit code
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.uncaught_exception.uncaught_exception002.uncaught_exception002
+ *
+ * @comment make sure uncaught_exception002a is compiled w/ full debug info
+ * @clean nsk.jdb.uncaught_exception.uncaught_exception002.uncaught_exception002a
+ * @compile -g:lines,source,vars uncaught_exception002a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper
+ *      nsk.jdb.uncaught_exception.uncaught_exception002.uncaught_exception002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.uncaught_exception.uncaught_exception002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class uncaught_exception002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new uncaught_exception002(true).runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.uncaught_exception.uncaught_exception002";
+    static final String TEST_CLASS = PACKAGE_NAME + ".uncaught_exception002";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[] FRAMES = new String[] {
+        DEBUGGEE_CLASS + ".func",
+        DEBUGGEE_CLASS + ".runIt",
+        DEBUGGEE_CLASS + ".main"                };
+
+    public uncaught_exception002 (boolean debuggeeShouldFail) {
+        super(debuggeeShouldFail);
+    }
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.receiveReplyFor(JdbCommand.cont);
+        jdb.receiveReplyFor(JdbCommand.locals);
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        grep = new Paragrep(reply);
+
+        v = new Vector();
+        v.add("Exception occurred");
+        v.add(PACKAGE_NAME + ".TenMultipleException");
+        if (grep.find(v) == 0) {
+            failure("jdb does not reported of TenMultipleException occurence");
+        }
+
+        v = new Vector();
+        v.add("localVar");
+        v.add("1234");
+        if (grep.find(v) == 0) {
+            failure("Local variable of stack frame the exception was thrown " +
+                "is not accessible");
+        }
+    }
+
+    private boolean checkStop () {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        Vector v;
+        boolean result = true;
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/uncaught_exception/uncaught_exception002/uncaught_exception002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.uncaught_exception.uncaught_exception002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class uncaught_exception002a {
+    static uncaught_exception002a _uncaught_exception002a = new uncaught_exception002a();
+
+    public static void main(String args[]) throws TenMultipleException {
+       System.exit(uncaught_exception002.JCK_STATUS_BASE + _uncaught_exception002a.runIt(args, System.out));
+    }
+
+    public int runIt(String args[], PrintStream out) throws TenMultipleException {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        func(10);
+
+        log.display("Debuggee PASSED");
+        return uncaught_exception002.PASSED;
+    }
+
+    public static int func(int i) throws TenMultipleException {
+        int localVar = 12345;
+
+        if ( i % 10 == 0 ) {
+            throw new TenMultipleException(i);
+        }
+        return i;
+    }
+}
+
+class TenMultipleException extends Exception {
+     TenMultipleException (int i) { super ("received " + i ); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/unmonitor/unmonitor001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DESCRIPTION
+ * A positive test for the 'unmonitor <monitor#>' command.
+ * The jdb sets up line breakpoint at the debugged application. Then
+ * the  following set of commands is called:
+ *  - three different commands are set as a "monitor" by 'monitor <command>',
+ *  - the first "monitored" command (i.e. 'locals') is deleted by 'unmonitor 1' command,
+ *  - another two command are set as a "monitor".
+ * After resuming the debuggee stops at the breakpoint. All "monitored" commands should
+ * be executed.
+ * The test passes if only un-deleted "monitored" commands are executed and number
+ * of "monitors" equals to 4.
+ * The test consists of two program:
+ *   unmonitor001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   unmonitor001a.java - the debugged application.
+ * COMMENTS
+ *  The test was updated due fix of the bug 4686159.
+ *  The test was updated due to fix of the RFE 4905231.
+ *  Test fixed according to test bug:
+ *    5041797 TEST_BUG: race condition in JDB output readirectors
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.unmonitor.unmonitor001.unmonitor001
+ *
+ * @comment make sure unmonitor001a is compiled w/ full debug info
+ * @clean nsk.jdb.unmonitor.unmonitor001.unmonitor001a
+ * @compile -g:lines,source,vars unmonitor001a.java
+ *
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.unmonitor.unmonitor001.unmonitor001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.unmonitor.unmonitor001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class unmonitor001 extends JdbTest {
+
+    public static void main (String argv[])  {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new unmonitor001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.unmonitor.unmonitor001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".unmonitor001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+    static final int    BREAKPOINT_LINE    = 47;
+
+    static final String[] CHECKED_COMMANDS = {
+        JdbCommand.locals,
+        JdbCommand.threads,
+        JdbCommand.methods + DEBUGGEE_CLASS,
+        JdbCommand.fields  + DEBUGGEE_CLASS,
+        JdbCommand.eval + "(new java.lang.String(\"Hello, World\")).length()"
+                                             };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        reply = jdb.receiveReplyFor(JdbCommand.stop_at + DEBUGGEE_CLASS + ":" + BREAKPOINT_LINE);
+
+        // set first three monitors
+        reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[0]);
+        reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[1]);
+        reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[2]);
+
+        // delete first monitor
+        reply = jdb.receiveReplyFor(JdbCommand.unmonitor + " 1");
+
+        // set first last two monitors
+        reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[3]);
+        reply = jdb.receiveReplyFor(JdbCommand.monitor + CHECKED_COMMANDS[4]);
+
+        int repliesCount = 4 + 1;
+        reply = jdb.receiveReplyFor(JdbCommand.cont, true, repliesCount);
+
+        reply = jdb.receiveReplyFor(JdbCommand.monitor);
+        if (!checkMonitors(reply)) {
+            success = false;
+        }
+
+        // Give some time to evaluate an expression
+        jdb.waitForMessage(0, "length() = 12");
+
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        if (!checkCommands(reply)) {
+            success = false;
+        }
+    }
+
+    private boolean checkMonitors(String[] reply) {
+        Paragrep grep;
+        String found;
+        Vector v;
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+        for (int i = 1; i < CHECKED_COMMANDS.length; i++) {
+            if ((count = grep.find(CHECKED_COMMANDS[i])) != 1) {
+                log.complain("Wrong number of monitor command: " + CHECKED_COMMANDS[i]);
+                log.complain("    Expected: 1; found: " + count);
+                result = false;
+            }
+        }
+
+        if ((count = grep.find(CHECKED_COMMANDS[0])) > 0) {
+            log.complain("Found deleted monitor: " + CHECKED_COMMANDS[0]);
+            log.complain("    Expected: 0; found: " + count);
+            result = false;
+        }
+
+        return result;
+    }
+
+    private boolean checkCommands(String[] reply) {
+        Paragrep grep;
+        String found;
+        Vector v = new Vector();;
+        boolean result = true;
+        int count;
+
+        grep = new Paragrep(reply);
+
+        // check deleted 'locals'
+        if ((count = grep.find("Local variables")) > 0) {
+            log.complain("Found execution of deleted monitor command: " + CHECKED_COMMANDS[0]);
+            result = false;
+        }
+
+        // check 'threads'
+        v.add("java.lang.Thread");
+        v.add("main");
+        if ((count = grep.find(v)) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[1]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'methods'
+        if ((count = grep.find("runIt(java.lang.String[], java.io.PrintStream)")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[2]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'fields'
+        if ((count = grep.find(DEBUGGEE_CLASS + " _unmonitor001a")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[3]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+        // check 'eval'
+        if ((count = grep.find("length() = 12")) != 1) {
+            log.complain("Wrong number of execution of monitored command: " + CHECKED_COMMANDS[4]);
+            log.complain("    Expected: 1; found: " + count);
+            result = false;
+        }
+
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.unmonitor.unmonitor001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class unmonitor001a {
+    static unmonitor001a _unmonitor001a = new unmonitor001a();
+
+    public static void main(String args[]) {
+        System.exit(unmonitor001.JCK_STATUS_BASE + _unmonitor001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+        int localInt = 0; // unmonitor001.BREAKPOINT_LINE
+        localInt++;
+        log.display("Debuggee PASSED");
+        return unmonitor001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/untrace/untrace001/untrace001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/untrace/untrace001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'untrace methods <thread id>' command.
+ * The debuggee program (untrace001a.java) creates an additional
+ * thread with name like "MyThread-1" and starts it. The jdb
+ * suspends the debuggee at a moment when the additional thread is
+ * waiting for notification for lock objects and then turns on method
+ * tracing for this thread by 'trace methods <thread id>' command.
+ * After expected notification the additional thread invokes checked
+ * debuggee's methods. Thus jdb output must have the trace messages of checked methods'
+ * entrance and exit.
+ * At second phase jdb suspends the debuggee and turns off tracing
+ * by checked command. After resuming the debuggee's additional
+ * thread invokes checked methods again. Tracing messages and debuggee's
+ * suspentions are not expected at this moment.
+ * The test passes if jdb output has one 'enter' messages and one 'exit'
+ * messages for every checked method.
+ * The test consists of two program:
+ *   untrace001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   untrace001a.java - the debugged application.
+ * COMMENTS
+ * Modified due to fix of the bug:
+ *  4785781 TTY: debuggee hangs in jdb 'untrace001' test in Mantis
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.untrace.untrace001.untrace001
+ *        nsk.jdb.untrace.untrace001.untrace001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.untrace.untrace001.untrace001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.untrace.untrace001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class untrace001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new untrace001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.untrace.untrace001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".untrace001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".breakHere";
+    static final String MYTHREAD        = "MyThread";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
+
+    static final String[] CHECKED_METHODS = {"func1", "func2", "func3"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != 1) {
+            log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.trace + "methods " + threads[i]);
+        }
+
+        // resumes debuggee suspended on method enter and exit until hit of the breakpoint
+        for (int i = 0; i < (CHECKED_METHODS.length*threads.length*2 + 1); i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.untrace + "methods " + threads[i]);
+        }
+
+        jdb.contToExit(CHECKED_METHODS.length*threads.length*2 + 2);
+
+        reply = jdb.getTotalReply();
+        if (!checkTrace(CHECKED_METHODS, reply)) {
+            success = false;
+        }
+    }
+
+    private boolean checkTrace (String[] checkedMethods, String[] reply) {
+        Paragrep grep;
+        String found;
+        int count;
+        Vector v = new Vector();
+        boolean result = true;
+
+        grep = new Paragrep(reply);
+        for (int i = 0; i < checkedMethods.length; i++) {
+            v.removeAllElements();
+            v.add(DEBUGGEE_THREAD + "." + checkedMethods[i]);
+            v.add("Method entered");
+            count = grep.find(v);
+            if (count != 1) {
+                log.complain("Count of method enter is incorrect for the method : " + DEBUGGEE_THREAD + "." + checkedMethods[i]);
+                log.complain("Should be 1 trace messages, found : " + count);
+                result= false;
+            }
+
+            v.removeAllElements();
+            v.add(DEBUGGEE_THREAD + "." + checkedMethods[i]);
+            v.add("Method exited");
+            count = grep.find(v);
+            if (count != 1) {
+                log.complain("Count of method exit is incorrect for the method : " + DEBUGGEE_THREAD + "." + checkedMethods[i]);
+                log.complain("Should be 1 trace messages, found : " + count);
+                result= false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/untrace/untrace001/untrace001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.untrace.untrace001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class untrace001a {
+
+    public static void main(String args[]) {
+       untrace001a _untrace001a = new untrace001a();
+       System.exit(untrace001.JCK_STATUS_BASE + _untrace001a.runIt(args, System.out));
+    }
+
+    static void breakHere() {}
+
+    static final String MYTHREAD  = "MyThread";
+    static final int numThreads   = 1;   // number of threads.
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    static Object mainThreadLock0 = new Object();
+    static Object mainThreadLock1 = new Object();
+    static volatile boolean mainThreadRunning;
+    static volatile boolean[] flags = new boolean[numThreads];
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        int i;
+        Thread holder [] = new Thread[numThreads];
+        Object[] locks = new Object[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            locks[i]  = new Object();
+            holder[i] = new MyThread(locks[i], i, MYTHREAD + "-" + i);
+        }
+
+        synchronized (mainThreadLock0) {
+            synchronized (mainThreadLock1) {
+                for (i = 0; i < numThreads ; i++) {
+                    holder[i].start();
+                    try {
+                         mainThreadRunning = false;
+                         while (!mainThreadRunning) {
+                             mainThreadLock1.wait();
+                         }
+                    } catch (InterruptedException e) {
+                        log.complain("Main thread was interrupted while waiting for start of " + MYTHREAD + "-" + i);
+                        return untrace001.FAILED;
+                    }
+
+                    synchronized (locks[i]) {  // holder[i] must wait on its lock[i] at this moment.
+                        log.display("Thread " + MYTHREAD + "-" + i + " is waiting");
+                    }
+                }
+            }
+            breakHere();  // a break to get thread ids and then to turn on tracing.
+
+            // waits on all MyThreads completion
+            for (i = 0; i < numThreads ; i++) {
+                synchronized (locks[i]) {
+                    flags[i] = true;
+                    locks[i].notifyAll();
+                }
+
+                try {
+                     mainThreadRunning = false;
+                     while (!mainThreadRunning) {
+                         mainThreadLock0.wait();
+                     }
+                } catch (InterruptedException e) {
+                    log.complain("Main thread was interrupted while waiting for " + MYTHREAD + "-" + i);
+                    return untrace001.FAILED;
+                }
+
+                breakHere();  // a break to turn off tracing.
+
+                synchronized (locks[i]) {
+                    flags[i] = true;
+                    locks[i].notifyAll();
+                }
+
+                if (holder[i].isAlive() && !holder[i].interrupted()) {
+                    try {
+                        holder[i].join();
+                    } catch (InterruptedException e) {
+                        log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i);
+                        return untrace001.FAILED;
+                    }
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return untrace001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    Object lock;
+    int ind;
+    String name;
+
+    public MyThread (Object l, int i, String n) {
+        lock = l;
+        ind = i;
+        name = n;
+    }
+
+    public void run() {
+        // Concatenate strings in advance to avoid lambda calculations later
+        final String ThreadFinished = "Thread finished: " + this.name;
+        final String ThreadInterrupted = "Thread was interrupted: " + this.name;
+        untrace001a.log.display("Thread started: " + this.name);
+
+        synchronized (lock) {
+            synchronized (untrace001a.mainThreadLock1) {
+                untrace001a.mainThreadRunning = true;
+                untrace001a.mainThreadLock1.notify();
+            }
+
+            try {
+                untrace001a.flags[ind] = false;
+                while (!untrace001a.flags[ind]) {
+                    lock.wait();
+                }
+                int square = func1(2);
+
+                synchronized (untrace001a.mainThreadLock0) {
+                    untrace001a.mainThreadRunning = true;
+                    untrace001a.mainThreadLock0.notify();
+                }
+
+                untrace001a.flags[ind] = false;
+                while (!untrace001a.flags[ind]) {
+                    lock.wait();
+                }
+                square = func1(3);
+
+                untrace001a.log.display(ThreadFinished);
+            } catch (InterruptedException e) {
+                untrace001a.log.display(ThreadInterrupted);
+            }
+        }
+
+        untrace001a.log.display(ThreadFinished);
+    }
+
+    public int func1(int i) {
+        return func2(i);
+    }
+
+    public int func2(int i) {
+        return func3(i);
+    }
+
+    public int func3(int i) {
+        return i*i;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch001/unwatch001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/unwatch/unwatch001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'unwatch access <class id>.<field name>' command.
+ * There are two test cases:
+ *  - unwatch access for the fields defined in class,
+ *  - unwatch access for the fields defined in inner class.
+ * At first phase of testing the access watch is set for all checked fields with
+ * "watch access" command. Then debugged application invokes the methods (updateFields)
+ * in which all checked fields participate in assigned expressions. Thus the jdb
+ * should report the access event for the fields.
+ * At seconds phase of testing all access watch monitors are deleted with
+ * the tested command. Then updateFields methods are invoked in debuggee again.
+ * The test passes jdb reports only once an access event for every checked fields.
+ * Correct report message in jdb stdout should contain full name of the field
+ * and "access encountered" words.
+ * The test consists of two program:
+ *   watch001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   watch001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.unwatch.unwatch001.unwatch001
+ *        nsk.jdb.unwatch.unwatch001.unwatch001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.unwatch.unwatch001.unwatch001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.unwatch.unwatch001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class unwatch001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new unwatch001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.unwatch.unwatch001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".unwatch001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String DEBUGGEE_CLASS2    = DEBUGGEE_CLASS + "$CheckedFields";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".breakHere";
+
+    static String[] checkedFields  = { "fS1", "FS0" };
+    static String[] checkedFields2 = { "fP1", "fU1", "fR1"};
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
+
+        watchFields (DEBUGGEE_CLASS, checkedFields);
+        watchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+        for (int i = 0; i < (checkedFields.length + checkedFields2.length + 2); i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+        }
+
+        unwatchFields (DEBUGGEE_CLASS, checkedFields);
+        unwatchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+        // excessive number of cont commands in case if unwatch command does not work.
+        jdb.contToExit(checkedFields.length + checkedFields2.length + 1);
+
+        reply = jdb.getTotalReply();
+        if (!checkFields (DEBUGGEE_CLASS, reply, checkedFields)) {
+            success = false;
+        }
+        if (!checkFields (DEBUGGEE_CLASS2, reply, checkedFields2)) {
+            success = false;
+        }
+    }
+
+    private void watchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.watch + " access " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private void unwatchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.unwatch + " access " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private boolean checkFields (String className, String[] reply, String[] checkedFields) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+        int count;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.add("access encountered");
+        for (int i = 0; i < checkedFields.length; i++) {
+            v.removeAllElements();
+            v.add("access encountered");
+            v.add(className + "." + checkedFields[i]);
+
+            count = grep.find(v);
+            if (count != 1) {
+                log.complain("jdb reported wrong number of access to the field " + className + "." + checkedFields[i]);
+                log.complain("Should be 1, reported: " + count);
+                result = false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch001/unwatch001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.unwatch.unwatch001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class unwatch001a {
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.unwatch.unwatch001";
+
+    public static void main(String args[]) {
+       unwatch001a _unwatch001a = new unwatch001a();
+       System.exit(unwatch001.JCK_STATUS_BASE + _unwatch001a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        log.display("Debuggee PASSED");
+        return unwatch001.PASSED;
+    }
+
+    static    boolean fS0, fS1[], fS2[][];
+    static    Boolean FS0, FS1[], FS2[][];
+
+    interface Inter {}
+    Inter     I0, I1[], I2[][];
+
+    // assign new values to fields
+    void updateFields(boolean flag) {
+
+        fS0 = flag ? fS0 : false;
+        fS1 = flag ? fS1 :  new boolean[] {fS0};
+        fS2 = flag ? fS2 :  new boolean[][] {fS1};
+
+        FS0 = flag ? FS0 : new Boolean(false);
+        FS1 = flag ? FS1 : new Boolean[] {FS0};
+        FS2 = flag ? FS2 : new Boolean[][] {FS1};
+
+        I0  = flag ? I0  : new CheckedFields();
+        I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
+        I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
+    }
+
+    class CheckedFields implements Inter {
+
+        private   byte    fP0, fP1[], fP2[][];
+        public    char    fU0, fU1[], fU2[][];
+        protected double  fR0, fR1[], fR2[][];
+        transient float   fT0, fT1[], fT2[][];
+        volatile  long    fV0, fV1[], fV2[][];
+
+        private   Byte      FP0, FP1[], FP2[][];
+        public    Character FU0, FU1[], FU2[][];
+        protected Double    FR0, FR1[], FR2[][];
+        transient Float     FT0, FT1[], FT2[][];
+        volatile  Long      FV0, FV1[], FV2[][];
+
+        // assign new values to fields
+        void updateFields(boolean flag) {
+
+            fP0 = flag ? fP0 : Byte.MIN_VALUE ;
+            fU0 = flag ? fU0 : Character.MIN_VALUE;
+            fR0 = flag ? fR0 : Double.MIN_VALUE;
+            fT0 = flag ? fT0 : Float.MIN_VALUE;
+            fV0 = flag ? fV0 : Integer.MIN_VALUE;
+
+            FP0 = flag ? FP0 : new Byte(Byte.MIN_VALUE) ;
+            FU0 = flag ? FU0 : new Character(Character.MIN_VALUE);
+            FR0 = flag ? FR0 : new Double(Double.MIN_VALUE);
+            FT0 = flag ? FT0 : new Float(Float.MIN_VALUE);
+            FV0 = flag ? FV0 : new Long(Long.MIN_VALUE);
+
+            fP1 = flag ? fP1 : new byte[] {fP0};
+            fP2 = flag ? fP2 : new byte[][] {fP1};
+            fU1 = flag ? fU1 : new char[] {fU0};
+            fU2 = flag ? fU2 : new char[][] {fU1};
+            fR1 = flag ? fR1 : new double[] {fR0};
+            fR2 = flag ? fR2 : new double[][] {fR1};
+            fT1 = flag ? fT1 : new float[] {fT0};
+            fT2 = flag ? fT2 : new float[][] {fT1};
+            fV1 = flag ? fV1 : new long[] {fV0};
+            fV2 = flag ? fV2 : new long[][] {fV1};
+
+            FP1 = flag ? FP1 : new Byte[] {FP0};
+            FP2 = flag ? FP2 : new Byte[][] {FP1};
+            FU1 = flag ? FU1 : new Character[] {FU0};
+            FU2 = flag ? FU2 : new Character[][] {FU1};
+            FR1 = flag ? FR1 : new Double[] {FR0};
+            FR2 = flag ? FR2 : new Double[][] {FR1};
+            FT1 = flag ? FT1 : new Float[] {FT0};
+            FT2 = flag ? FT2 : new Float[][] {FT1};
+            FV1 = flag ? FV1 : new Long[] {FV0};
+            FV2 = flag ? FV2 : new Long[][] {FV1};
+        }
+    }
+
+    CheckedFields fields;
+
+    public unwatch001a() {
+        fields = new CheckedFields();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch002/unwatch002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/unwatch/unwatch002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'unwatch all <class id>.<field name>' command.
+ * There are two test cases:
+ *  - unwatch all for the fields defined in class,
+ *  - unwatch all for the fields defined in inner class.
+ * At first phase of testing the full watch is set for all checked fields with
+ * "watch all" command. Then debugged application invokes the methods (updateFields)
+ * in which all checked fields participate in assigned expressions as well as are
+ * assigned to. Thus the jdb should report the access event and modification event
+ * for the fields.
+ * At seconds phase of testing all watch monitors are deleted with the tested
+ * command. Then updateFields methods are invoked in debuggee again.
+ * The test passes jdb reports only once an access and modification events for
+ * every checked fields. Correct report message in jdb stdout should contain full
+ * name of the field and "access encountered" or "will be" words.
+ * The test consists of two program:
+ *   watch002.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   watch002a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.unwatch.unwatch002.unwatch002
+ *        nsk.jdb.unwatch.unwatch002.unwatch002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.unwatch.unwatch002.unwatch002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.unwatch.unwatch002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class unwatch002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new unwatch002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.unwatch.unwatch002";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".unwatch002";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String DEBUGGEE_CLASS2    = DEBUGGEE_CLASS + "$CheckedFields";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".breakHere";
+
+    static String[] checkedFields  = { "FS1" };
+    static String[] checkedFields2 = { "FT1", "FV1" };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
+
+        watchFields (DEBUGGEE_CLASS, checkedFields);
+        watchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+//        jdb.contToExit((checkedFields.length *2)  + (checkedFields2.length *2) + 2);
+        for (int i = 0; i < (checkedFields.length *2 + checkedFields2.length*2 + 2); i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.cont);
+        }
+
+        unwatchFields (DEBUGGEE_CLASS, checkedFields);
+        unwatchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+        // excessive number of cont commands in case if unwatch command does not work.
+        jdb.contToExit(checkedFields.length*2 + checkedFields2.length*2 + 1);
+
+        reply = jdb.getTotalReply();
+        if (!checkFields (DEBUGGEE_CLASS, reply, checkedFields)) {
+            success = false;
+        }
+        if (!checkFields (DEBUGGEE_CLASS2, reply, checkedFields2)) {
+            success = false;
+        }
+    }
+
+    private void watchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.watch + " all " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private void unwatchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.unwatch + " all " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private boolean checkFields (String className, String[] reply, String[] checkedFields) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+        int count;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.add("access encountered");
+        for (int i = 0; i < checkedFields.length; i++) {
+            v.removeAllElements();
+            v.add("access encountered");
+            v.add(className + "." + checkedFields[i]);
+
+            count = grep.find(v);
+            if (count != 1) {
+                log.complain("jdb reported wrong number of access to the field " + className + "." + checkedFields[i]);
+                log.complain("Should be 1, reported: " + count);
+                result = false;
+            }
+
+            v.removeAllElements();
+            v.add(className + "." + checkedFields[i]);
+            v.add("will be instance");
+
+            count = grep.find(v);
+            if (count != 1) {
+                log.complain("jdb reported wrong number of modification of the field " + className + "." + checkedFields[i]);
+                log.complain("Should be 1, reported: " + count);
+                result = false;
+            }
+
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/unwatch/unwatch002/unwatch002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.unwatch.unwatch002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class unwatch002a {
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.unwatch.unwatch002";
+
+    public static void main(String args[]) {
+       unwatch002a _unwatch002a = new unwatch002a();
+       System.exit(unwatch002.JCK_STATUS_BASE + _unwatch002a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        log.display("Debuggee PASSED");
+        return unwatch002.PASSED;
+    }
+
+    static    boolean fS0, fS1[], fS2[][];
+    static    Boolean FS0, FS1[], FS2[][];
+
+    interface Inter {}
+    Inter     I0, I1[], I2[][];
+
+    // assign new values to fields
+    void updateFields(boolean flag) {
+
+        fS0 = flag ? fS0 : false;
+        fS1 = flag ? fS1 : new boolean[] {fS0};
+        fS2 = flag ? fS2 : new boolean[][] {fS1};
+
+        FS0 = flag ? FS0 : new Boolean(false);
+        FS1 = flag ? FS1 : new Boolean[] {FS0};
+        FS2 = flag ? FS2 : new Boolean[][] {FS1};
+
+        I0  = flag ? I0  : new CheckedFields();
+        I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
+        I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
+    }
+
+    class CheckedFields implements Inter {
+
+        private   byte    fP0, fP1[], fP2[][];
+        public    char    fU0, fU1[], fU2[][];
+        protected double  fR0, fR1[], fR2[][];
+        transient float   fT0, fT1[], fT2[][];
+        volatile  long    fV0, fV1[], fV2[][];
+
+        private   Byte      FP0, FP1[], FP2[][];
+        public    Character FU0, FU1[], FU2[][];
+        protected Double    FR0, FR1[], FR2[][];
+        transient Float     FT0, FT1[], FT2[][];
+        volatile  Long      FV0, FV1[], FV2[][];
+
+        // assign new values to fields
+        void updateFields(boolean flag) {
+
+            fP0 = flag ? fP0 : Byte.MIN_VALUE ;
+            fU0 = flag ? fU0 : Character.MIN_VALUE;
+            fR0 = flag ? fR0 : Double.MIN_VALUE;
+            fT0 = flag ? fT0 : Float.MIN_VALUE;
+            fV0 = flag ? fV0 : Integer.MIN_VALUE;
+
+            FP0 = flag ? FP0 : new Byte(Byte.MIN_VALUE) ;
+            FU0 = flag ? FU0 : new Character(Character.MIN_VALUE);
+            FR0 = flag ? FR0 : new Double(Double.MIN_VALUE);
+            FT0 = flag ? FT0 : new Float(Float.MIN_VALUE);
+            FV0 = flag ? FV0 : new Long(Long.MIN_VALUE);
+
+            fP1 = flag ? fP1 : new byte[] {fP0};
+            fP2 = flag ? fP2 : new byte[][] {fP1};
+            fU1 = flag ? fU1 : new char[] {fU0};
+            fU2 = flag ? fU2 : new char[][] {fU1};
+            fR1 = flag ? fR1 : new double[] {fR0};
+            fR2 = flag ? fR2 : new double[][] {fR1};
+            fT1 = flag ? fT1 : new float[] {fT0};
+            fT2 = flag ? fT2 : new float[][] {fT1};
+            fV1 = flag ? fV1 : new long[] {fV0};
+            fV2 = flag ? fV2 : new long[][] {fV1};
+
+            FP1 = flag ? FP1 : new Byte[] {FP0};
+            FP2 = flag ? FP2 : new Byte[][] {FP1};
+            FU1 = flag ? FU1 : new Character[] {FU0};
+            FU2 = flag ? FU2 : new Character[][] {FU1};
+            FR1 = flag ? FR1 : new Double[] {FR0};
+            FR2 = flag ? FR2 : new Double[][] {FR1};
+            FT1 = flag ? FT1 : new Float[] {FT0};
+            FT2 = flag ? FT2 : new Float[][] {FT1};
+            FV1 = flag ? FV1 : new Long[] {FV0};
+            FV2 = flag ? FV2 : new Long[][] {FV1};
+        }
+    }
+
+    CheckedFields fields;
+
+    public unwatch002a() {
+        fields = new CheckedFields();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/up/up002/up002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/up/up002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  This tests the jdb 'up' command. The test sets a breakpoint
+ *  at 'func5' method in debugged 'nsk.jdb.up.up002a' class and then
+ *  runs the debugee.  Once, an execution suspends at 'func5' method,
+ *  the 'up' command is issued to the debugger several times.
+ *  The output is processed by counting the number of times
+ *  each method name appears in the stack trace. The test passes
+ *  if the obtained count matches the expected one.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/up/up001 test and
+ *  replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.up.up002.up002
+ *        nsk.jdb.up.up002.up002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.up.up002.up002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.up.up002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class up002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new up002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.up.up002";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".up002";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] FRAMES = new String[][] {
+        {"[1]", DEBUGGEE_CLASS + ".func5"},
+        {"[2]", DEBUGGEE_CLASS + ".func4"},
+        {"[3]", DEBUGGEE_CLASS + ".func3"},
+        {"[4]", DEBUGGEE_CLASS + ".func2"},
+        {"[5]", DEBUGGEE_CLASS + ".func1"},
+        {"[6]", DEBUGGEE_CLASS + ".runIt"},
+        {"[7]", DEBUGGEE_CLASS + ".main"}
+                                                };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.receiveReplyFor(JdbCommand.stop_in + DEBUGGEE_CLASS + ".func5");
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        for (int i = 0; i < FRAMES.length; i++) {
+            jdb.receiveReplyFor(JdbCommand.where);
+            jdb.receiveReplyFor(JdbCommand.up);
+        }
+
+        jdb.contToExit(1);
+
+        reply = jdb.getTotalReply();
+        grep = new Paragrep(reply);
+
+        for (int i = 1; i < (FRAMES.length-1); i++) {
+            v = new Vector();
+            v.add(FRAMES[i][0]);
+            v.add(FRAMES[i][1]);
+            count = grep.find(v);
+            if (count != (i+1)) {
+                failure("Unexpected number of the stack frame: " + FRAMES[i][1] +
+                    "\n\texpected value : " + (i+1) + ", got : " + count);
+            }
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/up/up002/up002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.up.up002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class up002a {
+    public static void main(String args[]) {
+       up002a _up002a = new up002a();
+       lastBreak();
+       System.exit(up002.JCK_STATUS_BASE + _up002a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(0);
+
+        log.display("Debuggee PASSED");
+        return up002.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1;
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1;
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1;
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1;
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1;
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/use/use001/use001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/use/use001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'use [source file path]' command.
+ * The test checks if jdb correctly sets and shows source file path.
+ * Working directory is added to the current path using 'use' command
+ * with argument composed of old value and current working directory.
+ * The test passes if working directory is encountered in reply message
+ * returned by subsequent 'use' command.
+ * The test consists of two program:
+ *   use001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   use001a.java - the debugged application.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.use.use001.use001
+ *        nsk.jdb.use.use001.use001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.use.use001.use001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.use.use001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class use001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new use001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME = "nsk.jdb.use.use001";
+    static final String TEST_CLASS = PACKAGE_NAME + ".use001";
+    static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".lastBreak";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        String path = "";
+        String workdir = argumentHandler.getWorkDir();
+
+//        jdb.setBreakpointInMethod(LAST_BREAK);
+//        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        while (true) {
+            reply = jdb.receiveReplyFor(JdbCommand.use);
+/*
+            if (reply.length == 0) {
+                log.complain("Empty reply on first 'use' command");
+                success = false;
+                break;
+            }
+ */
+            if (reply.length > 0) {
+                path = reply[0];
+            }
+/*
+            grep = new Paragrep(reply);
+            count = grep.find(workdir);
+            if (count == 0) {
+                log.complain("Not found current working directory in source file path");
+                success = false;
+                break;
+            }
+ */
+            reply = jdb.receiveReplyFor(JdbCommand.use + workdir + File.pathSeparator + path);
+            if (reply.length == 0) {
+                log.complain("Empty reply on third 'use' command");
+                success = false;
+                break;
+            }
+
+            reply = jdb.receiveReplyFor(JdbCommand.use);
+            grep = new Paragrep(reply);
+            if (grep.find(workdir) == 0) {
+                log.complain("Current working directory should be in source file path");
+                success = false;
+                break;
+            }
+
+            break;
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/use/use001/use001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.use.use001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class use001a {
+    static use001a _use001a = new use001a();
+
+    public static void main(String args[]) {
+       System.exit(use001.JCK_STATUS_BASE + _use001a.runIt(args, System.out));
+    }
+
+//    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+//        lastBreak();
+
+        log.display("Debuggee PASSED");
+        return use001.PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch001/watch001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/watch/watch001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'watch access <class id>.<field name>' command.
+ * There are two test cases:
+ *  - access watch set for the fields defined in class,
+ *  - access watch set for the fields defined in inner class.
+ * The debugged application invokes the methods in which all checked fields
+ * participate in assigned expressions.
+ * The test passes jdb correctly reports on access event for all checked fields.
+ * Correct report message in jdb stdout should contain full name of the field
+ * and "access encountered" words.
+ * The test consists of two program:
+ *   watch001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   watch001a.java - the debugged application.
+ * COMMENTS
+ * Test fixed according to test bug:
+ *     5045859 TEST_BUG: some JDB tests do not recognize JDB prompt
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.watch.watch001.watch001
+ *        nsk.jdb.watch.watch001.watch001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.watch.watch001.watch001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.watch.watch001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class watch001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        compoundPromptIdent = COMPOUND_PROMPT_IDENT;
+        return new watch001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.watch.watch001";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".watch001";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String DEBUGGEE_CLASS2    = DEBUGGEE_CLASS + "$CheckedFields";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".breakHere";
+    static final String COMPOUND_PROMPT_IDENT = "main";
+
+    static String[] checkedFields  = { "fS0", "FS1" };
+    static String[] checkedFields2 = { "FP0", "FU1", "FR0", "FT1", "FV0" };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
+
+        watchFields (DEBUGGEE_CLASS, checkedFields);
+        watchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+        jdb.contToExit(checkedFields.length + checkedFields2.length + 2);
+
+        reply = jdb.getTotalReply();
+        if (!checkFields (DEBUGGEE_CLASS, reply, checkedFields)) {
+            success = false;
+        }
+        if (!checkFields (DEBUGGEE_CLASS2, reply, checkedFields2)) {
+            success = false;
+        }
+    }
+
+    private void watchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.watch + " access " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private boolean checkFields (String className, String[] reply, String[] checkedFields) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+        int count;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.add("access encountered");
+        for (int i = 0; i < checkedFields.length; i++) {
+            v.removeAllElements();
+            v.add("access encountered");
+            v.add(className + "." + checkedFields[i]);
+
+            found = grep.findFirst(v);
+            if (found.length() == 0) {
+                log.complain("Failed to report access to field " + className + "." + checkedFields[i]);
+                result = false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch001/watch001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.watch.watch001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class watch001a {
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.watch.watch001";
+
+    public static void main(String args[]) {
+       watch001a _watch001a = new watch001a();
+       System.exit(watch001.JCK_STATUS_BASE + _watch001a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        log.display("Debuggee PASSED");
+        return watch001.PASSED;
+    }
+
+    static    boolean fS0, fS1[], fS2[][];
+    static    Boolean FS0, FS1[], FS2[][];
+
+    interface Inter {}
+    Inter     I0, I1[], I2[][];
+
+    // assign new values to fields
+    void updateFields(boolean flag) {
+
+        fS0 = flag ? fS0 : false;
+        fS1 = flag ? fS1 :  new boolean[] {fS0};
+        fS2 = flag ? fS2 :  new boolean[][] {fS1};
+
+        FS0 = flag ? FS0 : new Boolean(false);
+        FS1 = flag ? FS1 : new Boolean[] {FS0};
+        FS2 = flag ? FS2 : new Boolean[][] {FS1};
+
+        I0  = flag ? I0  : new CheckedFields();
+        I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
+        I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
+    }
+
+    class CheckedFields implements Inter {
+
+        private   byte    fP0, fP1[], fP2[][];
+        public    char    fU0, fU1[], fU2[][];
+        protected double  fR0, fR1[], fR2[][];
+        transient float   fT0, fT1[], fT2[][];
+        volatile  long    fV0, fV1[], fV2[][];
+
+        private   Byte      FP0, FP1[], FP2[][];
+        public    Character FU0, FU1[], FU2[][];
+        protected Double    FR0, FR1[], FR2[][];
+        transient Float     FT0, FT1[], FT2[][];
+        volatile  Long      FV0, FV1[], FV2[][];
+
+        // assign new values to fields
+        void updateFields(boolean flag) {
+
+            fP0 = flag ? fP0 : Byte.MIN_VALUE ;
+            fU0 = flag ? fU0 : Character.MIN_VALUE;
+            fR0 = flag ? fR0 : Double.MIN_VALUE;
+            fT0 = flag ? fT0 : Float.MIN_VALUE;
+            fV0 = flag ? fV0 : Integer.MIN_VALUE;
+
+            FP0 = flag ? FP0 : new Byte(Byte.MIN_VALUE) ;
+            FU0 = flag ? FU0 : new Character(Character.MIN_VALUE);
+            FR0 = flag ? FR0 : new Double(Double.MIN_VALUE);
+            FT0 = flag ? FT0 : new Float(Float.MIN_VALUE);
+            FV0 = flag ? FV0 : new Long(Long.MIN_VALUE);
+
+            fP1 = flag ? fP1 : new byte[] {fP0};
+            fP2 = flag ? fP2 : new byte[][] {fP1};
+            fU1 = flag ? fU1 : new char[] {fU0};
+            fU2 = flag ? fU2 : new char[][] {fU1};
+            fR1 = flag ? fR1 : new double[] {fR0};
+            fR2 = flag ? fR2 : new double[][] {fR1};
+            fT1 = flag ? fT1 : new float[] {fT0};
+            fT2 = flag ? fT2 : new float[][] {fT1};
+            fV1 = flag ? fV1 : new long[] {fV0};
+            fV2 = flag ? fV2 : new long[][] {fV1};
+
+            FP1 = flag ? FP1 : new Byte[] {FP0};
+            FP2 = flag ? FP2 : new Byte[][] {FP1};
+            FU1 = flag ? FU1 : new Character[] {FU0};
+            FU2 = flag ? FU2 : new Character[][] {FU1};
+            FR1 = flag ? FR1 : new Double[] {FR0};
+            FR2 = flag ? FR2 : new Double[][] {FR1};
+            FT1 = flag ? FT1 : new Float[] {FT0};
+            FT2 = flag ? FT2 : new Float[][] {FT1};
+            FV1 = flag ? FV1 : new Long[] {FV0};
+            FV2 = flag ? FV2 : new Long[][] {FV1};
+        }
+    }
+
+    CheckedFields fields;
+
+    public watch001a() {
+        fields = new CheckedFields();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch002/watch002.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/watch/watch002.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'watch all <class id>.<field name>' command.
+ * There are two test cases:
+ *  - access and modification watch set for the fields defined in class,
+ *  - access and modification watch set for the fields defined in inner class.
+ * The debugged application invokes the methods in which all checked fields
+ * participate in assigned expressions as well as are assigned.
+ * The test passes jdb correctly reports on access and modification events for
+ * all checked fields. Correct report message in jdb stdout should contain full
+ * name of the field and "access encountered" or "will be" words.
+ * The test consists of two program:
+ *   watch002.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
+ *   watch002a.java - the debugged application.
+ * COMMENTS
+ * Test fixed according to test bug:
+ *     5045859 TEST_BUG: some JDB tests do not recognize JDB prompt
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.watch.watch002.watch002
+ *        nsk.jdb.watch.watch002.watch002a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.watch.watch002.watch002
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.watch.watch002;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class watch002 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        compoundPromptIdent = COMPOUND_PROMPT_IDENT;
+        return new watch002().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME       = "nsk.jdb.watch.watch002";
+    static final String TEST_CLASS         = PACKAGE_NAME + ".watch002";
+    static final String DEBUGGEE_CLASS     = TEST_CLASS + "a";
+    static final String DEBUGGEE_CLASS2    = DEBUGGEE_CLASS + "$CheckedFields";
+    static final String FIRST_BREAK        = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK         = DEBUGGEE_CLASS + ".breakHere";
+    static final String COMPOUND_PROMPT_IDENT = "main";
+
+    static String[] checkedFields  = { "FS0", "FS1" };
+    static String[] checkedFields2 = { "FP1", "FU1", "FR1", "FT1", "FV1" };
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS);
+
+        reply = jdb.receiveReplyFor(JdbCommand.fields + DEBUGGEE_CLASS2);
+
+        watchFields (DEBUGGEE_CLASS, checkedFields);
+        watchFields (DEBUGGEE_CLASS2, checkedFields2);
+
+        jdb.contToExit((checkedFields.length *2)  + (checkedFields2.length *2) + 2);
+
+        reply = jdb.getTotalReply();
+        if (!checkFields (DEBUGGEE_CLASS, reply, checkedFields)) {
+            success = false;
+        }
+        if (!checkFields (DEBUGGEE_CLASS2, reply, checkedFields2)) {
+            success = false;
+        }
+    }
+
+    private void watchFields (String className, String[] checkedFields) {
+        String[] reply;
+
+        for (int i = 0; i < checkedFields.length; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.watch + " all " + className + "." + checkedFields[i]);
+        }
+
+    }
+
+    private boolean checkFields (String className, String[] reply, String[] checkedFields) {
+        Paragrep grep;
+        String found;
+        boolean result = true;
+        int count;
+        Vector v = new Vector();
+
+        grep = new Paragrep(reply);
+        v.add("access encountered");
+        for (int i = 0; i < checkedFields.length; i++) {
+            v.removeAllElements();
+            v.add("access encountered");
+            v.add(className + "." + checkedFields[i]);
+
+            found = grep.findFirst(v);
+            if (found.length() == 0) {
+                log.complain("Failed to report access to field " + className + "." + checkedFields[i]);
+                result = false;
+            }
+
+            v.removeAllElements();
+            v.add("will be");
+            v.add(className + "." + checkedFields[i]);
+
+            found = grep.findFirst(v);
+            if (found.length() == 0) {
+                log.complain("Failed to report modification of field " + className + "." + checkedFields[i]);
+                result = false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/watch/watch002/watch002a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.watch.watch002;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class watch002a {
+    /* TEST DEPENDANT VARIABLES AND CONSTANTS */
+    static final String PACKAGE_NAME = "nsk.jdb.watch.watch002";
+
+    public static void main(String args[]) {
+       watch002a _watch002a = new watch002a();
+       System.exit(watch002.JCK_STATUS_BASE + _watch002a.runIt(args, System.out));
+    }
+
+    static void breakHere () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        breakHere();
+        updateFields(false);
+        fields.updateFields(false);
+
+        log.display("Debuggee PASSED");
+        return watch002.PASSED;
+    }
+
+    static    boolean fS0, fS1[], fS2[][];
+    static    Boolean FS0, FS1[], FS2[][];
+
+    interface Inter {}
+    Inter     I0, I1[], I2[][];
+
+    // assign new values to fields
+    void updateFields(boolean flag) {
+
+        fS0 = flag ? fS0 : false;
+        fS1 = flag ? fS1 : new boolean[] {fS0};
+        fS2 = flag ? fS2 : new boolean[][] {fS1};
+
+        FS0 = flag ? FS0 : new Boolean(false);
+        FS1 = flag ? FS1 : new Boolean[] {FS0};
+        FS2 = flag ? FS2 : new Boolean[][] {FS1};
+
+        I0  = flag ? I0  : new CheckedFields();
+        I1  = flag ? I1  : new CheckedFields[]   {new CheckedFields()};
+        I2  = flag ? I2  : new CheckedFields[][] {new CheckedFields[] {new CheckedFields()}};
+    }
+
+    class CheckedFields implements Inter {
+
+        private   byte    fP0, fP1[], fP2[][];
+        public    char    fU0, fU1[], fU2[][];
+        protected double  fR0, fR1[], fR2[][];
+        transient float   fT0, fT1[], fT2[][];
+        volatile  long    fV0, fV1[], fV2[][];
+
+        private   Byte      FP0, FP1[], FP2[][];
+        public    Character FU0, FU1[], FU2[][];
+        protected Double    FR0, FR1[], FR2[][];
+        transient Float     FT0, FT1[], FT2[][];
+        volatile  Long      FV0, FV1[], FV2[][];
+
+        // assign new values to fields
+        void updateFields(boolean flag) {
+
+            fP0 = flag ? fP0 : Byte.MIN_VALUE ;
+            fU0 = flag ? fU0 : Character.MIN_VALUE;
+            fR0 = flag ? fR0 : Double.MIN_VALUE;
+            fT0 = flag ? fT0 : Float.MIN_VALUE;
+            fV0 = flag ? fV0 : Integer.MIN_VALUE;
+
+            FP0 = flag ? FP0 : new Byte(Byte.MIN_VALUE) ;
+            FU0 = flag ? FU0 : new Character(Character.MIN_VALUE);
+            FR0 = flag ? FR0 : new Double(Double.MIN_VALUE);
+            FT0 = flag ? FT0 : new Float(Float.MIN_VALUE);
+            FV0 = flag ? FV0 : new Long(Long.MIN_VALUE);
+
+            fP1 = flag ? fP1 : new byte[] {fP0};
+            fP2 = flag ? fP2 : new byte[][] {fP1};
+            fU1 = flag ? fU1 : new char[] {fU0};
+            fU2 = flag ? fU2 : new char[][] {fU1};
+            fR1 = flag ? fR1 : new double[] {fR0};
+            fR2 = flag ? fR2 : new double[][] {fR1};
+            fT1 = flag ? fT1 : new float[] {fT0};
+            fT2 = flag ? fT2 : new float[][] {fT1};
+            fV1 = flag ? fV1 : new long[] {fV0};
+            fV2 = flag ? fV2 : new long[][] {fV1};
+
+            FP1 = flag ? FP1 : new Byte[] {FP0};
+            FP2 = flag ? FP2 : new Byte[][] {FP1};
+            FU1 = flag ? FU1 : new Character[] {FU0};
+            FU2 = flag ? FU2 : new Character[][] {FU1};
+            FR1 = flag ? FR1 : new Double[] {FR0};
+            FR2 = flag ? FR2 : new Double[][] {FR1};
+            FT1 = flag ? FT1 : new Float[] {FT0};
+            FT2 = flag ? FT2 : new Float[][] {FT1};
+            FV1 = flag ? FV1 : new Long[] {FV0};
+            FV2 = flag ? FV2 : new Long[][] {FV1};
+        }
+    }
+
+    CheckedFields fields;
+
+    public watch002a() {
+        fields = new CheckedFields();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where004/where004.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/where/where004.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A test case for the 'where' command. The test sets a breakpoint
+ *  at func5() in debugged `where004a` class and then runs debugee.
+ *  Once, execution comes to a halt at func5(), the 'where' command
+ *  is issued to the debugger. The test passes if items printed in
+ *  stack trace are equal to expected ones.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/where/where001 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.where.where004.where004
+ *        nsk.jdb.where.where004.where004a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.where.where004.where004
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.where.where004;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class where004 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new where004().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.where.where004";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".where004";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] FRAMES = new String[][] {
+        {DEBUGGEE_CLASS + ".func5", "71"},
+        {DEBUGGEE_CLASS + ".func4", "67"},
+        {DEBUGGEE_CLASS + ".func3", "63"},
+        {DEBUGGEE_CLASS + ".func2", "59"},
+        {DEBUGGEE_CLASS + ".func1", "55"},
+        {DEBUGGEE_CLASS + ".runIt", "48"},
+        {DEBUGGEE_CLASS + ".main",  "39"}
+                                                };
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.receiveReplyFor(JdbCommand.stop_in + DEBUGGEE_CLASS + ".func5");
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        reply = jdb.receiveReplyFor(JdbCommand.where);
+        grep = new Paragrep(reply);
+
+        for (int i = 0; i < FRAMES.length; i++) {
+            v = new Vector();
+            v.add(FRAMES[i][0]);
+            v.add(FRAMES[i][1]);
+            count = grep.find(v);
+            if (count != 1) {
+                failure("Unexpected number or location of the stack frame: " + FRAMES[i][0] +
+                    "\n\texpected value : 1, got one: " + count);
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where004/where004a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.where.where004;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class where004a {
+    public static void main(String args[]) {
+       where004a _where004a = new where004a();
+       lastBreak();
+       System.exit(where004.JCK_STATUS_BASE + _where004a.runIt(args, System.out)); // where004.FRAMES[6]
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(10); // where004.FRAMES[5]
+
+        log.display("Debuggee PASSED");
+        return where004.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1; // where004.FRAMES[4]
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1; // where004.FRAMES[3]
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1; // where004.FRAMES[2]
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1; // where004.FRAMES[1]
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1; // this is line for breakpoint // where004.FRAMES[0]
+    }
+
+    public int func6(int i) {
+        return i-5;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where005/where005.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/where/where005.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A test case for the 'where' command. The debugged 'where005a'
+ *  application throws a null pointer exception in 'func6()' method.
+ *  The test passes if the 'where' command produces the correct
+ *  stack trace.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/where/where002 test
+ *  and replaces it.
+ *  Modified due to fix of the bug:
+ *  4818762 TEST_BUG: two jdb test incorrectly check debuggee exit code
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.where.where005.where005
+ *        nsk.jdb.where.where005.where005a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.where.where005.where005
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.where.where005;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class where005 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new where005(true).runTest(argv, out);
+    }
+
+    public where005 (boolean debuggeeShouldFail) {
+        super(debuggeeShouldFail);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.where.where005";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".where005";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] FRAMES = new String[][] {
+        {DEBUGGEE_CLASS + ".func6", "76"},
+        {DEBUGGEE_CLASS + ".func5", "71"},
+        {DEBUGGEE_CLASS + ".func4", "67"},
+        {DEBUGGEE_CLASS + ".func3", "63"},
+        {DEBUGGEE_CLASS + ".func2", "59"},
+        {DEBUGGEE_CLASS + ".func1", "55"},
+        {DEBUGGEE_CLASS + ".runIt", "48"},
+        {DEBUGGEE_CLASS + ".main",  "39"}
+                                                };
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+        grep = new Paragrep(reply);
+
+        if (grep.find("NullPointerException") == 0) {
+            failure("Expected NullPointerException is not thrown");
+        } else {
+            reply = jdb.receiveReplyFor(JdbCommand.where);
+            grep = new Paragrep(reply);
+
+            for (int i = 0; i < FRAMES.length; i++) {
+                v = new Vector();
+                v.add(FRAMES[i][0]);
+                v.add(FRAMES[i][1]);
+                count = grep.find(v);
+                if (count != 1) {
+                    failure("Unexpected number or location of the stack frame: " + FRAMES[i][0] +
+                        "\n\texpected value : 1, got one: " + count);
+                }
+            }
+        }
+        jdb.sendCommand(JdbCommand.quit);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where005/where005a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//    THIS TEST IS LINE NUMBER SENSITIVE
+
+package nsk.jdb.where.where005;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class where005a {
+    public static void main(String args[]) {
+       where005a _where005a = new where005a();
+       lastBreak();
+       System.exit(where005.JCK_STATUS_BASE + _where005a.runIt(args, System.out)); // where005.FRAMES[7]
+    }
+
+    static void lastBreak () {}
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        int i = func1(10); // where005.FRAMES[6]
+
+        log.display("Debuggee PASSED");
+        return where005.PASSED;
+    }
+
+    public int func1(int i) {
+        return func2(i) + 1; // where005.FRAMES[5]
+    }
+
+    public int func2(int i) {
+        return func3(i) + 1; // where005.FRAMES[4]
+    }
+
+    public int func3(int i) {
+        return func4(i) + 1; // where005.FRAMES[3]
+    }
+
+    public int func4(int i) {
+       return func5(i) + 1; // where005.FRAMES[2]
+    }
+
+    public int func5(int i) {
+       return func6(i) + 1; // where005.FRAMES[1]
+    }
+
+    public int func6(int i) {
+        String s = null;
+        s.concat("null");  // throws NullPointerException // where005.FRAMES[0]
+        return i-5;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where006/where006.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/where/where006.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ *  A test to exercise the functionality of the 'where <thread_id>'
+ *  and the 'where all' commands.
+ *  The debugee creates 5 threads that are all suspended on locks
+ *  that the main thread posseses. The 'where <thread_id>' command
+ *  is used to get stack traces of all 5 suspended threads. The test
+ *  passes if contents of the stack trace match to expected output.
+ * COMMENTS
+ *  This test functionally equals to nsk/jdb/where/where003 test
+ *  and replaces it.
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.where.where006.where006
+ *        nsk.jdb.where.where006.where006a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.where.where006.where006
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.where.where006;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class where006 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new where006().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME     = "nsk.jdb.where.where006";
+    static final String TEST_CLASS       = PACKAGE_NAME + ".where006";
+    static final String DEBUGGEE_CLASS   = TEST_CLASS + "a";
+    static final String FIRST_BREAK      = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK       = DEBUGGEE_CLASS + ".lastBreak";
+
+    static final String[][] FRAMES = new String[][] {
+        {PACKAGE_NAME + ".MyThread.func5", "111"},
+        {PACKAGE_NAME + ".MyThread.func4", "103"},
+        {PACKAGE_NAME + ".MyThread.func3", "99"},
+        {PACKAGE_NAME + ".MyThread.func2", "95"},
+        {PACKAGE_NAME + ".MyThread.func1", "91"},
+        {PACKAGE_NAME + ".MyThread.run", "85"},
+                                                };
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        jdb.receiveReplyFor(JdbCommand.cont);
+
+        String[] threadIds = jdb.getThreadIds(PACKAGE_NAME + ".MyThread");
+        reply = jdb.receiveReplyFor(JdbCommand.where + "all");
+        for (int i = 0; i < where006a.numThreads; i++) {
+            checkFrames(threadIds[i], reply, 5);
+        }
+
+        for (int i = 0; i < where006a.numThreads; i++) {
+            reply = jdb.receiveReplyFor(JdbCommand.where + threadIds[i]);
+            checkFrames(threadIds[i], reply, 1);
+        }
+
+        jdb.contToExit(1);
+    }
+
+    void checkFrames (String threadId, String[] reply, int expectedVal) {
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+
+        grep = new Paragrep(reply);
+        for (int j = 0; j < FRAMES.length; j++) {
+            count = grep.find(FRAMES[j][0]);
+            if (count != expectedVal) {
+                failure("Unexpected number of occurencies of the stack frame: " + FRAMES[j][0] +
+                    " for thread " + threadId +
+                    "\n\t Expected number of occurence: " + expectedVal +", got : " + count);
+                if (count > 0) {
+                    found = grep.findFirst(FRAMES[j][0]);
+                    if (found.indexOf(FRAMES[j][1]) < 0) {
+                        failure("Unexpected location in the stack frame: " + FRAMES[j][0] +
+                            " for thread " + threadId +
+                            "\n\t Expected location: " + FRAMES[j][1] + ", got :\n\t" + found);
+                    }
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/where/where006/where006a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.where.where006;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class where006a {
+    public static void main(String args[]) {
+        where006a _where006a = new where006a();
+        System.exit(where006.JCK_STATUS_BASE + _where006a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static int numThreads = 5;   // number of threads. one lock per thread.
+
+    static Object lock = new Object();
+    static Object waitnotify = new Object();
+
+    public int runIt(String args[], PrintStream out) {
+        JdbArgumentHandler argumentHandler = new JdbArgumentHandler(args);
+        Log log = new Log(out, argumentHandler);
+
+        Thread holder [] = new Thread[numThreads];
+        Lock locks[] = new Lock[numThreads];
+
+        for (int i = 0; i < numThreads ; i++) {
+           locks[i] = new Lock();
+           holder[i] = new MyThread(locks[i],"MyThread-" + i);
+        }
+
+        // lock monitor to prevent threads from finishing after they started
+        synchronized (lock) {
+           synchronized (waitnotify) {
+              for (int i = 0; i < numThreads ; i++) {
+                 holder[i].start();
+                 try {
+                     waitnotify.wait();
+                 } catch ( Exception e ) {
+                     System.err.println("TEST ERROR: caught Exception while waiting: " + e);
+                     e.printStackTrace();
+                 }
+              }
+           }
+           lastBreak();   // dummy breakpoint
+        }
+
+        for (int i = 0; i < numThreads ; i++) {
+            if (holder[i].isAlive()) {
+                try {
+                    holder[i].join(argumentHandler.getWaitTime() * 60000);
+                } catch (InterruptedException e) {
+                    throw new Failure("Unexpected InterruptedException catched while waiting for join of: " + holder[i]);
+                }
+            }
+        }
+
+        log.display("Debuggee PASSED");
+        return where006.PASSED;
+    }
+
+}
+
+class Lock {
+   boolean lockSet;
+
+   synchronized void setLock() throws InterruptedException {
+      while (lockSet == true )
+         wait();
+      lockSet = true;
+   }
+
+   synchronized void releaseLock() {
+      if (lockSet == true) {
+        lockSet = false;
+        notify();
+      }
+   }
+}
+
+class MyThread extends Thread {
+   Lock lock;
+   String name;
+   MyThread(Lock l, String n) {this.lock = l; name = n;}
+
+   public void run() {
+      // Concatenate strings in advance to avoid lambda calculations later
+      final String ThreadFinished = "Thread finished: " + this.name;
+      int square = func1(10);
+      lock.releaseLock();
+      System.out.println(ThreadFinished);
+   }
+
+   public int func1(int i) {
+      return func2(i);
+   }
+
+   public int func2(int i) {
+      return func3(i);
+   }
+
+   public int func3(int i) {
+      return func4(i);
+   }
+
+   public int func4(int i) {
+      return func5(i);
+   }
+
+   public int func5(int i) {
+      synchronized (where006a.waitnotify) {
+         where006a.waitnotify.notify();
+      }
+      // prevent thread for early finish
+      synchronized (where006a.lock) {}
+      return i*i;
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/wherei/wherei001/wherei001.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ *
+ * @summary converted from VM Testbase nsk/jdb/wherei/wherei001.
+ * VM Testbase keywords: [jpda, jdb]
+ * VM Testbase readme:
+ * DECSRIPTION
+ * A positive test case for the 'wherei <thread id>' command.
+ * The test checks if jdb correctly reports stack trace for
+ * every checked thread id.
+ * COMMENTS
+ *
+ * @library /vmTestbase
+ *          /test/lib
+ * @run driver jdk.test.lib.FileInstaller . .
+ * @build nsk.jdb.wherei.wherei001.wherei001
+ *        nsk.jdb.wherei.wherei001.wherei001a
+ * @run main/othervm PropertyResolvingWrapper nsk.jdb.wherei.wherei001.wherei001
+ *      -arch=${os.family}-${os.simpleArch}
+ *      -waittime=5
+ *      -debugee.vmkind=java
+ *      -transport.address=dynamic
+ *      -jdb=${test.jdk}/bin/jdb
+ *      -java.options="${test.vm.opts} ${test.java.opts}"
+ *      -workdir=.
+ *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
+ */
+
+package nsk.jdb.wherei.wherei001;
+
+import nsk.share.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+import java.util.*;
+
+public class wherei001 extends JdbTest {
+
+    public static void main (String argv[]) {
+        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
+    }
+
+    public static int run(String argv[], PrintStream out) {
+        debuggeeClass =  DEBUGGEE_CLASS;
+        firstBreak = FIRST_BREAK;
+        lastBreak = LAST_BREAK;
+        return new wherei001().runTest(argv, out);
+    }
+
+    static final String PACKAGE_NAME    = "nsk.jdb.wherei.wherei001";
+    static final String TEST_CLASS      = PACKAGE_NAME + ".wherei001";
+    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
+    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
+    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
+    static final String DEBUGGEE_THREAD = PACKAGE_NAME + ".MyThread";
+
+    protected void runCases() {
+        String[] reply;
+        Paragrep grep;
+        int count;
+        Vector v;
+        String found;
+        String[] threads;
+
+        jdb.setBreakpointInMethod(LAST_BREAK);
+        reply = jdb.receiveReplyFor(JdbCommand.cont);
+
+        threads = jdb.getThreadIds(DEBUGGEE_THREAD);
+
+        if (threads.length != 5) {
+            log.complain("jdb should report 5 instance of " + DEBUGGEE_THREAD);
+            log.complain("Found: " + threads.length);
+            success = false;
+        }
+
+        for (int i = 0; i < threads.length; i++) {
+            if (!checkStack(threads[i])) {
+                success = false;
+            }
+        }
+
+        jdb.contToExit(1);
+    }
+
+    private boolean checkStack (String threadId) {
+        Paragrep grep;
+        String[] reply;
+        String found;
+        int count;
+        Vector v;
+        boolean result = true;
+        String[] func = { "func5", "func4", "func3", "func2", "func1", "run" };
+
+        reply = jdb.receiveReplyFor(JdbCommand.wherei + threadId);
+
+        grep = new Paragrep(reply);
+        for (int i = 0; i < func.length; i++) {
+            count = grep.find(DEBUGGEE_THREAD + "." + func[i]);
+            if (count != 1) {
+                log.complain("Contents of stack trace is incorrect for thread " + threadId);
+                log.complain("Searched for: " + DEBUGGEE_THREAD + "." + func[i]);
+                log.complain("Count : " + count);
+                result= false;
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/wherei/wherei001/wherei001a.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.jdb.wherei.wherei001;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdb.*;
+
+import java.io.*;
+
+/* This is debuggee aplication */
+public class wherei001a {
+    public static void main(String args[]) {
+       wherei001a _wherei001a = new wherei001a();
+       System.exit(wherei001.JCK_STATUS_BASE + _wherei001a.runIt(args, System.out));
+    }
+
+    static void lastBreak () {}
+
+    static int numThreads = 5;   // number of threads. one lock per thread.
+    static Object lock = new Object();
+    static Object waitnotify = new Object();
+
+    static JdbArgumentHandler argumentHandler;
+    static Log log;
+
+    public int runIt(String args[], PrintStream out) {
+
+        argumentHandler = new JdbArgumentHandler(args);
+        log = new Log(out, argumentHandler);
+
+        int i;
+        Thread holder [] = new Thread[numThreads];
+        Lock locks[] = new Lock[numThreads];
+
+        for (i = 0; i < numThreads ; i++) {
+            locks[i] = new Lock();
+            holder[i] = new MyThread(locks[i],"MyThread-" + i);
+        }
+
+        // lock monitor to prevent threads from finishing after they started
+        synchronized (lock) {
+            synchronized (waitnotify) {
+                for (i = 0; i < numThreads ; i++) {
+                    holder[i].start();
+                    try {
+                        waitnotify.wait();
+                    } catch ( Exception e ) {
+                        log.complain("TEST ERROR: caught Exception while waiting: " + e);
+                        e.printStackTrace();
+                    }
+                }
+            }
+            lastBreak();
+        }
+
+        log.display("Debuggee PASSED");
+        return wherei001.PASSED;
+    }
+}
+
+
+class MyThread extends Thread {
+    Lock lock;
+    String name;
+    // Concatenate strings in advance to avoid lambda calculations later
+    final String ThreadFinished = "Thread finished: " + this.name;
+
+    public MyThread (Lock l, String n) {
+        this.lock = l;
+        name = n;
+    }
+
+    public void run() {
+        int square = func1(100);
+        wherei001a.log.display(name + " returns " + square);
+        lock.releaseLock();
+    }
+
+    public int func1(int i) {
+        char x1 = 'x';
+        String s1 = "hello world";
+        return func2(i);
+    }
+
+    public int func2(int i) {
+        char x2 = 'x';
+        String s2 = "hello world";
+        return func3(i);
+    }
+
+    public int func3(int i) {
+        char x3 = 'x';
+        String s3 = "hello world";
+        return func4(i);
+    }
+
+    public int func4(int i) {
+        char x4 = 'x';
+        String s4 = "hello world";
+        return func5(i);
+    }
+
+    public int func5(int i) {
+        char x5 = 'x';
+        String s5 = "hello world";
+        synchronized (wherei001a.waitnotify) {
+            wherei001a.waitnotify.notify();
+        }
+        // prevent thread for early finish
+        synchronized (wherei001a.lock) {
+            wherei001a.log.display(ThreadFinished);
+        }
+        return i*i;
+    }
+}
+
+class Lock {
+    boolean lockSet;
+
+    synchronized void setLock() throws InterruptedException {
+        while (lockSet == true ) {
+            wait();
+        }
+        lockSet = true;
+    }
+
+    synchronized void releaseLock() {
+        if (lockSet == true) {
+            lockSet = false;
+            notify();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/classload/ClassLoadUtils.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.classload;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.FileInputStream;
+
+import java.util.Arrays;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.Files;
+
+public class ClassLoadUtils {
+    private ClassLoadUtils() {
+    }
+
+    /**
+     * Get filename of class file from classpath for given class name.
+     *
+     * @param className class name
+     * @return filename or null if not found
+     */
+    public static String getClassPath(String className) {
+        String fileName = className.replace(".", File.separator) + ".class";
+        String[] classPath = System.getProperty("java.class.path").split(File.pathSeparator);
+        File target = null;
+        int i;
+        for (i = 0; i < classPath.length; ++i) {
+            target = new File(classPath[i] + File.separator + fileName);
+            System.out.println("Try: " + target);
+            if (target.exists()) {
+                break;
+            }
+        }
+        if (i != classPath.length) {
+            return classPath[i];
+        }
+        return null;
+    }
+
+    /**
+     * Get filename of class file from classpath for given class name.
+     *
+     * @param className class name
+     * @return filename or null if not found
+     */
+    public static String getClassPathFileName(String className) {
+        String fileName = className.replace(".", File.separator) + ".class";
+        String[] classPath = System.getProperty("java.class.path").split(File.pathSeparator);
+        File target = null;
+        int i;
+        for (i = 0; i < classPath.length; ++i) {
+            target = new File(classPath[i] + File.separator + fileName);
+            System.out.println("Try: " + target);
+            if (target.exists()) {
+                break;
+            }
+        }
+        if (i != classPath.length) {
+            try {
+                return target.getCanonicalPath();
+            } catch (IOException e) {
+                return null;
+            }
+        }
+        return null;
+    }
+
+    public static String getRedefineClassFileName(String dir, String className) {
+        String fileName = className.replace(".", File.separator) + ".class";
+        return Arrays.stream(System.getProperty("java.class.path").split(File.pathSeparator))
+                     .map(Paths::get)
+                     .map(p -> p.resolve(dir))
+                     .map(p -> p.resolve(fileName))
+                     .filter(p -> Files.exists(p))
+                     .map(Path::toAbsolutePath)
+                     .map(Path::toString)
+                     .findAny()
+                     .orElse(null);
+    }
+
+    /**
+     * Get filename of class file which is to be redefined.
+     */
+    public static String getRedefineClassFileName(String className) {
+            return getRedefineClassFileName("newclass", className);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdi.ArgumentHandler;
+
+import java.io.*;
+
+/**
+ * Interface defining methods to control mirror of debuggee (i.e. debugged VM).
+ */
+public interface Debuggee {
+
+    /** Default prefix for log messages. */
+    public static final String LOG_PREFIX = "debuggee> ";
+    public static final String DEBUGEE_STDOUT_LOG_PREFIX = "debuggee.stdout> ";
+    public static final String DEBUGEE_STDERR_LOG_PREFIX = "debuggee.stderr> ";
+
+    /**
+     * Launch debuggee.
+     *
+     * @throws IOException
+     */
+    public void launch (String[] args) throws IOException;
+
+    /** Return exit status. */
+    public int getStatus ();
+
+    /** Check whether the process has been terminated. */
+    public boolean terminated();
+
+    /** Kill the debuggee VM. */
+    public void killDebuggee ();
+
+    /** Wait until the debuggee VM shutdown or crash. */
+    public int waitForDebuggee () throws InterruptedException;
+
+    /** Get a pipe to write to the debuggee's stdin stream. */
+    public OutputStream getInPipe ();
+
+    /** Get a pipe to read the debuggee's stdout stream. */
+    public InputStream getOutPipe ();
+
+    /** Get a pipe to read the debuggee's stderr stream. */
+    public InputStream getErrPipe ();
+
+    /** Redirect stdout stream to <code>Log</code> */
+    public void redirectStdout(Log log, String prefix);
+
+    /** Redirect stderr stream to <code>Log</code> */
+    public void redirectStderr(Log log, String prefix);
+}
+
+/**
+ * Mirror of locally launched debuggee.
+ */
+final class LocalLaunchedDebuggee extends LocalProcess implements Debuggee {
+
+    private IORedirector stdoutRedirector = null;
+    private IORedirector stderrRedirector = null;
+    private IORedirector stdinRedirector = null;
+
+    /** Messages prefix. */
+    protected String prefix = LOG_PREFIX;
+
+    /** Launcher that creates this debuggee. */
+    private Launcher launcher = null;
+
+    /** Enwrap the existing <code>VM</code> mirror. */
+    LocalLaunchedDebuggee (Launcher launcher) {
+        super();
+        this.launcher = launcher;
+    }
+
+    /**
+     * Launch debuggee on local host.
+     */
+    public void launch(String[] args) throws IOException {
+        launcher.display("Starting local debuggee.");
+
+        super.launch(args);
+        redirectStdout(launcher.getLog(), DEBUGEE_STDOUT_LOG_PREFIX );
+        redirectStderr(launcher.getLog(), DEBUGEE_STDERR_LOG_PREFIX);
+    }
+
+    /** Kill the debuggee VM. */
+    public void killDebuggee () {
+        super.kill();
+        if (stdinRedirector != null) {
+           stdinRedirector.cancel();
+        }
+        if (stdoutRedirector != null) {
+           stdoutRedirector.cancel();
+        }
+        if (stderrRedirector != null) {
+           stderrRedirector.cancel();
+        }
+    }
+
+
+    /**
+     * Wait until the debuggee VM shutdown or crash,
+     * and let finish its stdout, stderr, and stdin
+     * redirectors (if any).
+     *
+     * @return  Debuggee process exit code.
+     */
+    public int waitForDebuggee () throws InterruptedException {
+        int timeout = launcher.getJdbArgumentHandler().getWaitTime() * 60 * 1000;
+        int exitCode;
+        try {
+            exitCode = super.waitFor();
+            if (stdinRedirector != null) {
+                if (stdinRedirector.isAlive()) {
+                    stdinRedirector.join(timeout);
+                    if (stdinRedirector.isAlive()) {
+                        launcher.complain("Timeout for waiting STDIN redirector exceeded");
+                        stdinRedirector.interrupt();
+                    }
+                }
+                stdinRedirector = null;
+            };
+            if (stdoutRedirector != null) {
+                if (stdoutRedirector.isAlive()) {
+                    stdoutRedirector.join(timeout);
+                    if (stdoutRedirector.isAlive()) {
+                        launcher.complain("Timeout for waiting STDOUT redirector exceeded");
+                        stdoutRedirector.interrupt();
+                    }
+                }
+                stdoutRedirector = null;
+            };
+            if (stderrRedirector != null) {
+                if (stderrRedirector.isAlive()) {
+                    stderrRedirector.join(timeout);
+                    if (stderrRedirector.isAlive()) {
+                        launcher.complain("Timeout for waiting STDERR redirector exceeded");
+                        stderrRedirector.interrupt();
+                    }
+                }
+                stderrRedirector = null;
+            };
+        } catch (InterruptedException ie) {
+            ie.printStackTrace(launcher.getLog().getOutStream());
+            throw new Failure("Caught exception while waiting for LocalProcess termination: \n\t" + ie);
+        }
+        return exitCode;
+    }
+
+    /**
+     * Get a pipe to write to the debuggee's stdin stream,
+     * or throw TestBug exception is redirected.
+     */
+    public OutputStream getInPipe () {
+        if (stdinRedirector != null)
+            throw new TestBug("debuggee's stdin is redirected");
+        return getStdin();
+    }
+
+    /**
+     * Get a pipe to read the debuggee's stdout stream,
+     * or throw TestBug exception is redirected.
+     */
+    public InputStream getOutPipe () {
+        if (stdoutRedirector != null)
+            throw new TestBug("debuggee's stdout is redirected");
+        return getStdout();
+    }
+
+    /**
+     * Get a pipe to read the debuggee's stderr stream,
+     * or throw TestBug exception is redirected.
+     */
+    public InputStream getErrPipe () {
+        if (stderrRedirector != null)
+            throw new TestBug("debuggee's stderr is redirected");
+        return getStderr();
+    }
+
+    // --------------------------------------------------- //
+
+    /**
+     * Start thread redirecting the debuggee's stdout to the
+     * given <code>Log</code>. If the debuggee's stdout
+     * was already redirected, the TestBug exception is thrown.
+     *
+     * @throws nsk.share.TestBug
+     */
+    public void redirectStdout(Log log, String prefix) {
+        if (stdoutRedirector != null) {
+            throw new TestBug("Debuggee's stdout already redirected.");
+        }
+        stdoutRedirector = new IORedirector(new BufferedReader(new InputStreamReader(getStdout())), log, prefix);
+        stdoutRedirector.start();
+    }
+
+
+    /**
+     * Start thread redirecting the debuggee's stderr to the
+     * given <code>Log</code>. If the debuggee's stderr
+     * was already redirected, the TestBug exception is thrown.
+     *
+     * @throws nsk.share.TestBug
+     */
+    public void redirectStderr(Log log, String prefix) {
+        if (stderrRedirector != null) {
+            throw new TestBug("Debuggee's stdout already redirected.");
+        }
+        stderrRedirector = new IORedirector(new BufferedReader(new InputStreamReader(getStderr())), log, prefix);
+        stderrRedirector.start();
+    }
+}
+
+
+/**
+ * Mirror of remotely launched debuggee.
+ */
+final class RemoteLaunchedDebuggee implements Debuggee {
+
+    /** Launcher that creates this debuggee. */
+    private Launcher launcher = null;
+
+    /** Enwrap the existing <code>VM</code> mirror. */
+    RemoteLaunchedDebuggee (Launcher launcher) {
+        super();
+        this.launcher = launcher;
+    }
+
+    /**
+     * Launch debugee on remote host via <code>Launcher</code> object.
+     */
+    public void launch(String[] args) throws IOException {
+        String cmdLine = ArgumentHandler.joinArguments(args, "\"");
+        launcher.display("Starting remote java process:\n" + cmdLine);
+        launcher.launchRemoteProcess(args);
+    }
+
+    /** Return exit status of the debuggee VM. */
+    public int getStatus () {
+        return launcher.getRemoteProcessStatus();
+    }
+
+    /** Check whether the debuggee VM has been terminated. */
+    public boolean terminated () {
+        return launcher.isRemoteProcessTerminated();
+    }
+
+    // ---------------------------------------------- //
+
+    /** Kill the debuggee VM. */
+    public void killDebuggee () {
+        launcher.killRemoteProcess();
+    }
+
+    /** Wait until the debuggee VM shutdown or crash. */
+    public int waitForDebuggee () {
+        return launcher.waitForRemoteProcess();
+    }
+
+    /** Get a pipe to write to the debuggee's stdin stream. */
+    public OutputStream getInPipe () {
+        return null;
+    }
+
+    /** Get a pipe to read the debuggee's stdout stream. */
+    public InputStream getOutPipe () {
+        return null;
+    }
+
+    /** Get a pipe to read the debuggee's stderr stream. */
+    public InputStream getErrPipe () {
+        return null;
+    }
+
+    public void redirectStdout(Log log, String prefix) {
+    }
+
+    public void redirectStderr(Log log, String prefix) {
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/DebuggeeUncaughtException.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package nsk.share.jdb;
+
+/**
+ * Exception which is thrown when we wait for JDB prompt
+ * but uncaught debuggee exception is occurred
+ */
+class DebuggeeUncaughtException extends Error {
+    public DebuggeeUncaughtException(String message) {
+        super(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,1175 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+
+import java.util.*;
+import java.io.*;
+
+import java.util.regex.*;
+
+/**
+ * Wrapper of <i>jdb</i>.s
+ * This class provides abilities to launch it, to send command,
+ * to read reply on the command, to set breakpoint on entry in debugggee's method.
+ */
+public class Jdb extends LocalProcess implements Finalizable {
+    /** File to log <i>stdout</i> stream */
+    static final String JDB_STDOUT_FILE = "jdb.stdout";
+    /** File to log <i>stderr</i> stream */
+    static final String JDB_STDERR_FILE = "jdb.stderr";
+    /** File to log input jdb's commands */
+    static final String JDB_COMMANDS_FILE = "jdb.commands";
+
+    /** File to log emulated <i>jdb</i> session composed from commands and <i>jdb</i> replies on them  */
+    static final String JDB_SESSION_FILE = "jdb.session";
+
+    /** Pattern for message of listening at address. */
+    public static final String LISTENING_AT_ADDRESS = "Listening at address:";
+
+    /** Pattern for message of a breakpoint hit. */
+    public static final String BREAKPOINT_HIT = "Breakpoint hit:";
+
+    /** Pattern for message of an application exit. */
+    public static final String APPLICATION_EXIT = "The application exited";
+
+    /** Pattern for message of an application disconnect. */
+    public static final String APPLICATION_DISCONNECTED = "The application has been disconnected";
+
+    /** Pattern for message of connector name in the supported connectors list. */
+    public static final String SUPPORTED_CONNECTOR_NAME = "Connector:";
+
+    /** Pattern for message of transport name in the supported connectors list. */
+    public static final String SUPPORTED_TRANSPORT_NAME = "Transport: ";
+
+    /** This is jdb's prompt when debuggee is not started nor suspended after breakpoint */
+    public static final String SIMPLE_PROMPT = "> ";
+
+    public static final String lineSeparator = System.getProperty("line.separator");
+
+    /** Internal streams handlers */
+    private static PrintStream     jdbStdinWriter;
+    private static JdbStdoutReader jdbStdoutReader;
+    private static JdbStderrReader jdbStderrReader;
+
+    private static PrintStream fout;
+    private static PrintStream flog;
+    private static PrintStream fin;
+
+    /** Particular ident in a compound prompt, or null if any. */
+    private String compoundPromptIdent = null;
+
+    /** <i>Launcher</i> that creates this <i>Jdb</i> object. */
+    private static Launcher launcher = null;
+
+    /** Internal buffer to save all not-null string from <i>jdb</i> stdout */
+    volatile private static StringBuffer stdoutBuffer = new StringBuffer();
+
+    volatile private Object startNotify = new Object();
+
+    /** Returns <i>Launcher</i> that created this <i>Jdb</i> object. */
+    public static Launcher getLauncher() {
+        return launcher;
+    }
+
+    public void finalizeAtExit() throws Throwable {
+        finalize();
+    }
+
+    public void finalize() throws Throwable {
+        if (fout != null) {
+//            fout.flush();
+            fout.close();
+        }
+        if (flog != null) {
+            flog.close();
+        }
+        if (fin != null) {
+            fin.close();
+        }
+        if (jdbStdoutReader != null) {
+            jdbStdoutReader.close();
+        }
+        if (jdbStderrReader != null) {
+            jdbStderrReader.close();
+        }
+        super.finalize();
+    }
+
+    /** Create <i>Jdb</i> object. */
+    public Jdb (Launcher launcher) {
+        super();
+        this.launcher = launcher;
+    }
+
+    /** Set particular ident for compound prompt; or null for any ident. */
+    void setCompoundPromptIdent(String ident) {
+        compoundPromptIdent = ident;
+    }
+
+    /**
+     * Launch <i>jdb</i> with options defined in <i>launchCmdArgs</i>.
+     * Full path to <i>jdb</i> must be defined as first element in <i>launchCmdArgs</i>.
+     */
+    public void launch(String[] launchCmdArgs) throws IOException {
+        super.launch(launchCmdArgs);
+        redirectStreams();
+    }
+
+    /**
+     * Launch <i>jdb</i> with options defined in <i>launchCmdLine</i>.
+     * Full path to <i>jdb</i> must be defined as first token in <i>launchCmdLine</i>.
+     */
+    public void launch(String launchCmdLine) throws IOException {
+        super.launch(launchCmdLine);
+        redirectStreams();
+    }
+
+    /**
+     * Gets <i>stdin, stdout, stderr</i> streams of the <i>jdb's</i> process and
+     * redirects them to special streams handlers.
+     */
+    private void redirectStreams() {
+        OutputStream jdbStdin = this.getStdin();
+        if (jdbStdin == null) {
+            throw new Failure("jdb stdin after launching is null");
+        }
+        jdbStdinWriter = new PrintStream(jdbStdin, true);
+
+        String fileStdout = getLauncher().getJdbArgumentHandler().getWorkDir() + File.separator + JDB_STDOUT_FILE;
+        InputStream jdbStdout = this.getStdout();
+        if (jdbStdout == null) {
+            throw new Failure("jdb stdout after launching is null");
+        }
+
+        launcher.getLog().display("Creating file for jdb stdout stream: " + fileStdout);
+        try {
+            fout = new PrintStream(new BufferedOutputStream(new FileOutputStream(fileStdout)));
+        } catch (Exception e) {
+            e.printStackTrace(getLauncher().getLog().getOutStream());
+            throw new Failure("Caught unexpected exception while creating file for jdb stdout stream: " + e);
+        }
+
+        String fileCommands = getLauncher().getJdbArgumentHandler().getWorkDir() + File.separator + JDB_COMMANDS_FILE;
+        try {
+            fin = new PrintStream(new BufferedOutputStream(new FileOutputStream(fileCommands)));
+        } catch (Exception e) {
+            e.printStackTrace(getLauncher().getLog().getOutStream());
+            throw new Failure("Caught unexpected exception while creating file for jdb input commands: " + e);
+        }
+
+        String fileSession = getLauncher().getJdbArgumentHandler().getWorkDir() + File.separator + JDB_SESSION_FILE;
+        launcher.getLog().display("Creating file for jdb session: " + fileSession);
+        try {
+            flog = new PrintStream(new BufferedOutputStream(new FileOutputStream(fileSession)));
+        } catch (Exception e) {
+            e.printStackTrace(getLauncher().getLog().getOutStream());
+            throw new Failure("Caught unexpected exception while creating file for jdb session: " + e);
+        }
+
+        String fileStderr = getLauncher().getJdbArgumentHandler().getWorkDir() + File.separator + JDB_STDERR_FILE;
+        InputStream jdbStderr = this.getStderr();
+        if (jdbStderr == null) {
+            throw new Failure("jdb stderr after launching is null");
+        }
+
+        jdbStdoutReader = new JdbStdoutReader(this);
+        startReader(jdbStdoutReader);
+
+        jdbStderrReader = new JdbStderrReader(this, fileStderr);
+        startReader(jdbStderrReader);
+    }
+
+    /** Starts reading threads for jdb streams. */
+    private void startReader (Thread reader) {
+        long max = getLauncher().getJdbArgumentHandler().getWaitTime() * 60 * 1000;  // maximum time to wait.
+        boolean notified = false;
+        synchronized (startNotify) {
+            reader.start();
+            try {
+                startNotify.wait(max);
+                notified = true;
+            } catch (InterruptedException ie) {
+                ie.printStackTrace(getLauncher().getLog().getOutStream());
+                throw new Failure("Caught InterruptedException while waiting for start of : " + reader, ie);
+            }
+        }
+        if (!notified) {
+            throw new Failure("Main thread was not notified during " + max + " milliseconds" +
+                "\n\t waiting for start of : " + reader);
+        }
+    }
+
+    /**
+     * Waits for given stream reader of the <i>jdb's</i> process to finish
+     * or interrupts after given timeout.
+     */
+    private void waitForReader(Thread reader, long timeMillisec) {
+        if (reader != null) {
+            try {
+                reader.join(timeMillisec);
+            } catch (InterruptedException ie) {
+                ie.printStackTrace(getLauncher().getLog().getOutStream());
+                throw new Failure("Caught interrupted exception while waiting for reader finished:\n\t" + ie);
+            }
+            if (reader.isAlive()) {
+                getLauncher().getLog().display("Interrupting reader not finished for timeout: " + timeMillisec + " millisec");
+                reader.interrupt();
+            }
+        }
+    }
+
+    /**
+     * Waits for all readers of redirected streams of the <i>jdb's</i> process
+     * to finish.
+     */
+    private void waitForAllReaders(long timeMillisec) {
+        waitForReader(jdbStdoutReader, timeMillisec);
+        waitForReader(jdbStderrReader, timeMillisec);
+    }
+
+    /**
+      * Wait until the jdb process shutdown or crash
+      * and all redirected stream readers finished.
+      */
+    public int waitFor() throws InterruptedException {
+        int exitCode = super.waitFor();
+        waitForAllReaders(0);
+        return exitCode;
+    }
+
+    /**
+     * Wait until the process shutdown or crash for given timeout in milliseconds,
+     * and all redirected stream readers finished.
+     * Returns <code>LocalProcess.PROCESS_IS_ALIVE</code> if process is not terminated
+     * after timeout.
+     */
+    public int waitFor(long timeMillisec) throws InterruptedException {
+        int exitCode = super.waitFor(timeMillisec);
+        if (exitCode != LocalProcess.PROCESS_IS_ALIVE) {
+            waitForAllReaders(timeMillisec);
+        }
+        return exitCode;
+    }
+
+    /**
+     * Writes <i>jdbCommand</i> to <i>jdb's</i> input stream.
+     */
+    public synchronized void sendCommand(String jdbCommand) {
+
+        if (terminated()) {
+            throw new Failure("Attempt to send command :" + jdbCommand + "\t to terminated jdb.");
+        }
+
+        if (jdbCommand != null) {
+            String logCmd;
+            if (!jdbCommand.endsWith(lineSeparator)) {
+                logCmd = jdbCommand;
+                jdbCommand += lineSeparator;
+            } else {
+                // we don't want to log the line separator
+                logCmd = jdbCommand.substring(0, jdbCommand.length() - 1);
+            }
+            launcher.getLog().display("Sending command: " + logCmd);
+
+            jdbStdinWriter.print(jdbCommand);
+            jdbStdinWriter.flush();
+
+            synchronized(flog) {
+                flog.print(/*LOG_COMMAND_PREFIX +*/ jdbCommand);
+                flog.flush();
+            }
+
+            fin.print(jdbCommand);
+            fin.flush();
+
+            if (jdbStdinWriter.checkError()) {
+                throw new Failure("Unexpected IO error while writing command <" + jdbCommand + "> to jdb stdin stream");
+            }
+        }
+    }
+
+    /**
+     * Sends command to <i>jdb's</i> input stream, waits for compound promt received,
+     * and then returns reply from <i>jdb's</i> output stream.
+     *
+     * @param command string representing full command with all arguments if any.
+     */
+    public String[] receiveReplyFor(String command) {
+        return receiveReplyFor(command, true);
+    }
+
+    /**
+     * Sends command to <i>jdb's</i> input stream, waits for promt received,
+     * and then returns reply from <i>jdb's</i> output stream.
+     *
+     * @param command string representing full command with all arguments if any.
+     * @param compoundPromptOnly read <i>output</i> until compound prompt is found.
+     */
+    public String[] receiveReplyFor(String command, boolean compoundPromptOnly) {
+        return receiveReplyFor(command, compoundPromptOnly, 1);
+    }
+
+    /**
+     * Sends command to <i>jdb's</i> input stream, waits for given number of promts received,
+     * and then returns reply from <i>jdb's</i> output stream.
+     *
+     * @param command string representing full command with all arguments if any.
+     * @param compoundPromptOnly read <i>output</i> until compound prompt is found.
+     * @param count number of prompt instances to found.
+     */
+    public String[] receiveReplyFor(String command, boolean compoundPromptOnly, int count) {
+        if (command == null) {
+           return null;
+        }
+
+        int startPos = stdoutBuffer.length();
+        sendCommand(command);
+        return receiveReply(startPos, compoundPromptOnly, count);
+    }
+
+    /**
+     * Sends command to <i>jdb's</i> input stream, waits for specified message to be received,
+     * and then returns reply from <i>jdb's</i> output stream.
+     *
+     * @param command string representing full command with all arguments if any.
+     * @param waitMsg string representing the message that must be sent back before returing.
+     */
+    public String[] receiveReplyForWithMessageWait(String command, String waitMsg) {
+        if (command == null) {
+           return null;
+        }
+
+        int startPos = stdoutBuffer.length();
+        sendCommand(command);
+        waitForMessage(startPos, waitMsg);
+        return receiveReply(startPos, true, 1);
+    }
+
+    /**
+     * Waits for compound prompt and returns reply from <i>jdb</i> stdout
+     * beginning from <i>startPos</i> in the <i>stdoutBuffer</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     */
+    public String[] receiveReply(int startPos) {
+        return receiveReply(startPos, true);
+    }
+
+    /**
+     * Waits for particular prompt and returns reply from <i>jdb</i> stdout
+     * beginning from <i>startPos</i> in the <i>stdoutBuffer</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @param compoundPromptOnly waits for compound prompt only.
+     */
+    public String[] receiveReply(int startPos, boolean compoundPromptOnly) {
+        return receiveReply(startPos, compoundPromptOnly, 1);
+    }
+
+    /**
+     * Waits for <i>count</i> number of prompts and returns reply from <i>jdb</i> stdout
+     * beginning from <i>startPos</i> in the <i>stdoutBuffer</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @param compoundPromptOnly waits for compound prompt only.
+     * @param count number of prompt instances to wait for.
+     */
+    public String[] receiveReply(int startPos, boolean compoundPromptOnly, int count) {
+
+        int found = waitForPrompt(startPos, compoundPromptOnly, count);
+
+        String reply = stdoutBuffer.substring(startPos, stdoutBuffer.length());
+        String[] replyArr = toStringArray(reply);
+
+        // Send reply to the logfile. This complements sendCommand(), which does the same.
+        for (int i = 0; i < replyArr.length; i++) {
+            launcher.getLog().display("reply[" + i + "]: " + replyArr[i]);
+        }
+
+        return replyArr;
+    }
+
+    /**
+     * Reads <i>JDB_STDOUT_FILE</i> file until prompt is found in the <i>stdoutBuffer</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @param compoundPromptOnly search for compound prompt only.
+     * @throws Failure if prompt is not encountered during <i>WaitTime</i>.
+     * @return number of prompt instances really found.
+     */
+    public int waitForPrompt(int startPos, boolean compoundPromptOnly) {
+        return waitForPrompt(startPos, compoundPromptOnly, 1);
+    }
+
+    /**
+     * Reads <i>JDB_STDOUT_FILE</i> file until prompt is found in the <i>stdoutBuffer</i>
+     * <i>count</i> times.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @param compoundPromptOnly search for compound prompt only.
+     * @throws Failure if prompt is not encountered <i>count</i> times during <i>WaitTime</i>.
+     * @return number of prompt instances actually found
+     *
+     * @see #setCompoundPromptIdent(String)
+     */
+    public int waitForPrompt(int startPos, boolean compoundPromptOnly, int count) {
+
+        long delta = 200; // time in milliseconds to wait at every iteration.
+        long total = 0;    // total time has waited.
+        long max = getLauncher().getJdbArgumentHandler().getWaitTime() * 60 * 1000;  // maximum time to wait.
+
+        if (count <= 0) {
+            throw new TestBug("Wrong number of promts count in Jdb.waitForPrompt(): " + count);
+        }
+
+        Object dummy = new Object();
+        while ((total += delta) <= max) {
+            int found = 0;
+
+            // check if compound prompt is found
+            {
+                found = findPrompt(stdoutBuffer, true, startPos);
+                if (found >= count) {
+                    return found;
+                }
+            }
+
+            // check also if simple prompt is found
+            if (!compoundPromptOnly) {
+                found += findPrompt(stdoutBuffer, false, startPos);
+                if (found >= count) {
+                    return found;
+                }
+            }
+
+            // exit loop when a debugged application exited
+            if (stdoutBuffer.indexOf(APPLICATION_EXIT) >= 0 || stdoutBuffer.indexOf(APPLICATION_DISCONNECTED) >= 0) {
+                return found;
+            } else if (startPos > 0 && !jdbStdoutReader.isAlive()) {
+                return found;
+            }
+
+            // sleep for awhile
+            synchronized(dummy) {
+                try {
+                    dummy.wait(delta);
+                } catch (InterruptedException ie) {
+                    ie.printStackTrace(getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught interrupted exception while waiting for jdb prompt:\n\t" + ie);
+                }
+            }
+        }
+
+        Pattern debuggeeExceptionPattern = Pattern.compile("Exception occurred: (?<DebuggeeException>\\S+) \\(uncaught\\)");
+        String buf = stdoutBuffer.toString();
+        Matcher m = debuggeeExceptionPattern.matcher(buf);
+
+        if (m.find(startPos)) {
+            throw new DebuggeeUncaughtException(m.group("DebuggeeException"));
+        }
+
+        String times = (count > 1 ? count + " times " : "");
+        throw new Failure("Prompt is not received " + times + "during " + total + " milliseconds.");
+    }
+
+    /**
+     * Reads <i>JDB_STDOUT_FILE</i> file until expected message is found in the <i>stdoutBuffer</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @throws Failure if expected message is not encountered during <i>WaitTime</i>.
+     * @return number of messages actually found
+     */
+    public int waitForMessage(int startPos, String message) {
+
+        long delta = 200; // time in milliseconds to wait at every iteration.
+        long total = 0;    // total time has waited.
+        long max = getLauncher().getJdbArgumentHandler().getWaitTime() * 60 * 1000;  // maximum time to wait.
+
+        Object dummy = new Object();
+        while ((total += delta) <= max) {
+            int found = 0;
+
+            // search for message
+            {
+                found = findMessage(startPos, message);
+                if (found > 0) {
+                    return found;
+                }
+            }
+
+            // exit loop when a debugged application exited.
+            if (stdoutBuffer.indexOf(APPLICATION_EXIT) >= 0 || stdoutBuffer.indexOf(APPLICATION_DISCONNECTED) >= 0) {
+                return found;
+            } else if (startPos > 0 && !jdbStdoutReader.isAlive()) {
+                return found;
+            }
+
+            // spleep for awhile
+            synchronized(dummy) {
+                try {
+                    dummy.wait(delta);
+                } catch (InterruptedException ie) {
+                    ie.printStackTrace(getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught interrupted exception while waiting for jdb reply:\n\t" + ie);
+                }
+            }
+
+        }
+
+        // If we never recieved the expected reply, display a warning, and also
+        // display what we did recieve. This is accomplished by calling receiveReply().
+        Log log = getLauncher().getLog();
+        log.display("WARNING: message not recieved: " + message);
+        log.display("Remaining debugger output follows:");
+        receiveReply(startPos);
+        throw new Failure("Expected message not received during " + total + " milliseconds:"
+                            + "\n\t" + message);
+    }
+
+    /**
+     * Find message in <i>JDB_STDOUT_FILE</i> file starting from <i>startPos</i>.
+     *
+     * @param startPos start position for search in <i>stdoutBuffer</i>.
+     * @return number of messages actually found
+     */
+    public int findMessage(int startPos, String message) {
+        int bufLength = stdoutBuffer.length();
+        int msgLength = message.length();
+        int found = 0;
+
+        for (int pos = startPos; pos < bufLength; ) {
+            pos = stdoutBuffer.indexOf(message, pos);
+            if (pos < 0) break;
+            found++;
+            pos += msgLength;
+        }
+        return found;
+    }
+
+    /**
+     * Searches input lines for <i>jdb</i> prompt of particular kind.
+     * starting from <code>startPos</code>.
+     * The possible prompt kinds are simple prompt "> " and compound prompt,
+     * that looks like '.*\[[0-9]*\] ' regexp on a single line.
+     * For example, 'main[1] ' (see setCompoundPromptIdent(String)).
+     * <p>
+     * In order to make compatible with jdk prior to 1.4.0 avoid using
+     * java.util.regex classes.
+     *
+     * @return number of prompt instances found
+     *
+     * @see #setCompoundPromptIdent(String)
+     */
+    int findPrompt(StringBuffer lines, boolean compoundPromptOnly, int startPos) {
+
+        final String nameDelimiters = "-_";
+
+        int noPrompt = -1; // prompt is not found;
+        int simplePrompt = 1;
+        int complexPrompt = 2;
+
+        int length = lines.length();
+        int found = 0;
+
+        // search for simple prompt
+        if (!compoundPromptOnly) {
+            int promptLength = SIMPLE_PROMPT.length();
+            for (int pos = startPos; pos < length; ) {
+                pos = lines.indexOf(SIMPLE_PROMPT, pos);
+                if (pos < 0) break;
+                found++;
+                pos += promptLength;
+            }
+            return found;
+        }
+
+        // search for compound prompt
+        StringBuffer prompt = new StringBuffer(100);
+        searching:
+        for (int pos = startPos; pos < length; ) {
+
+            // skip each simbol not suitable for prompt begin
+            if (!Character.isLetterOrDigit(lines.charAt(pos))) {
+                pos++;
+                continue searching;
+            }
+
+            // check for compound prompt
+            prompt.setLength(0);
+
+            // read name (letters or digits or delimiters)
+            while (nameDelimiters.indexOf(lines.charAt(pos)) > 0
+                        || Character.isLetterOrDigit(lines.charAt(pos))
+                        || lines.charAt(pos) == '-'
+                        || lines.charAt(pos) == '_') {
+                prompt.append(lines.charAt(pos++));
+                if (pos >= length) {
+                    break searching;
+                }
+            }
+
+            // read opening '['
+            if (lines.charAt(pos) != '[') {
+                continue searching;
+            }
+            prompt.append(lines.charAt(pos++));
+            if (pos >= length) {
+                break searching;
+            }
+
+            // read number (digits)
+            if (!Character.isDigit(lines.charAt(pos))){
+                continue searching;
+            }
+            while (Character.isDigit(lines.charAt(pos))) {
+                prompt.append(lines.charAt(pos++));
+                if (pos >= length) {
+                    break searching;
+                }
+            }
+
+            // read closing ']'
+            if (lines.charAt(pos) != ']') {
+                continue searching;
+            }
+            prompt.append(lines.charAt(pos++));
+            if (pos >= length) {
+                break searching;
+            }
+
+            // read last ' '
+            if (lines.charAt(pos) != ' ') {
+                continue searching;
+            }
+            prompt.append(lines.charAt(pos++));
+
+            // check if not particular ident found
+            if (compoundPromptIdent != null
+                    && !prompt.toString().startsWith(compoundPromptIdent + "[")) {
+                continue searching;
+            }
+
+            // compound prompt found
+            found++;
+        }
+
+        return found;
+    }
+
+    /**
+     * Splits string which may include line separators to string array.
+     *
+     */
+    public static String[] toStringArray (String string) {
+        Vector<String> v = new Vector<String>();
+        int ind;
+        for (ind = 0; ind < string.length(); ) {
+            int i = string.indexOf(lineSeparator, ind);
+            if (i >= 0) {
+                v.add(string.substring(ind, i));
+                ind = i + 1;
+            } else {
+                v.add(string.substring(ind));
+                break;
+            }
+        }
+        String[] result = new String [v.size()];
+        v.toArray(result);
+        return result;
+    }
+
+    /**
+     * Set breakpoint for debuggee on method invocation.
+     */
+    public void setBreakpointInMethod(String methodName) {
+        String nextCommand = JdbCommand.stop_in + methodName;
+        String[] reply = receiveReplyFor(nextCommand);
+
+        Paragrep grep = new Paragrep(reply);
+        if (grep.find("Unable to set") > 0) {
+            throw new Failure("jdb failed to set breakpoint in method: " + methodName);
+        }
+        if (grep.find("Set breakpoint") <= 0 && grep.find("Deferring breakpoint") <= 0) {
+            throw new Failure("jdb did not set breakpoint in method: " + methodName);
+        }
+    }
+
+    /**
+     * Set deferred breakpoint for debuggee on method invocation.
+     * This method must be used before <run> command.
+     */
+    public void setDeferredBreakpointInMethod(String methodName) {
+        String nextCommand = JdbCommand.stop_in + methodName;
+        String[] reply = receiveReplyFor(nextCommand, false);
+
+        Paragrep grep = new Paragrep(reply);
+        if (grep.find("Unable to set") > 0) {
+            throw new Failure("jdb failed to set deffered breakpoint in method: " + methodName);
+        }
+        if (grep.find("Set breakpoint") <= 0 && grep.find("Deferring breakpoint") <= 0) {
+            throw new Failure("jdb did not set deffered breakpoint in method: " + methodName);
+        }
+    }
+
+    /**
+     * Returns true if reply contains breakpoint message.
+     */
+    public boolean isAtBreakpoint(String[] reply) {
+        return isAtBreakpoint(reply, "", "");
+    }
+
+    /**
+     * Returns true if reply contains breakpoint message in certain method.
+     */
+    public boolean isAtBreakpoint(String[] reply, String method) {
+        return isAtBreakpoint(reply, method, "");
+    }
+
+    /**
+     * Returns true if reply contains breakpoint message in certain method
+     * and in certain thread id.
+     */
+    public boolean isAtBreakpoint(String[] reply, String method, String thread) {
+        boolean result = false;
+        Vector<String> v = new Vector<String>();
+        Paragrep grep = new Paragrep(reply);
+
+        v.add(BREAKPOINT_HIT);
+        if (method.length() > 0) {
+            v.add(method);
+        }
+        if (thread.length() > 0) {
+            v.add(thread);
+        }
+        if (grep.find(v) > 0) {
+            result = true;
+        }
+        return result;
+    }
+
+    /**
+     * Load and start execution of given debuggee's class with arguments.
+     */
+    public void startDebuggeeClass(String classWithArgs) {
+        String[] reply = receiveReplyFor(JdbCommand.run + " " + classWithArgs);
+
+        // give one more chance to reach breakpoint
+        if (!isAtBreakpoint(getTotalReply(), "main")) {
+            waitForMessage(0, BREAKPOINT_HIT);
+        }
+    }
+
+    /**
+     * Start execution of pre-loaded debuggee's class.
+     */
+    public void startDebuggeeClass() {
+        String[] reply = receiveReplyFor(JdbCommand.run);
+
+        // give one more chance to reach breakpoint
+        if (!isAtBreakpoint(getTotalReply(), "main")) {
+            waitForMessage(0, BREAKPOINT_HIT);
+        }
+    }
+
+    /**
+     * Returns as string array all id's for a given <i>threadName</i>.
+     */
+    public String[] getThreadIds(String threadName) {
+
+        if (!threadName.startsWith("(")) {
+            threadName = "(" + threadName;
+        }
+        if (!threadName.endsWith(")")) {
+            threadName = threadName + ")";
+        }
+
+        Vector<String> v = new Vector<String>();
+        String[] reply = receiveReplyFor(JdbCommand.threads);
+        Paragrep grep = new Paragrep(reply);
+
+        String[] found = grep.findStrings(threadName);
+        for (int i = 0; i < found.length; i++) {
+            String string = found[i];
+            int j = string.indexOf(threadName);
+            if (j >= 0) {
+               j += threadName.length();
+               String threadId = string.substring(j, string.indexOf(" ", j));
+               v.add(threadId);
+            }
+        }
+
+        String[] result = new String [v.size()];
+        v.toArray(result);
+        return result;
+    }
+
+    /**
+     * Quit <i>jdb</i> using "quit" command.
+     */
+    public void quit() {
+        if (!terminated()) {
+            sendCommand(JdbCommand.quit);
+        }
+    }
+
+    /**
+     * Sends "cont" command up to maxTimes until debuggee exit.
+     */
+    public void contToExit (int maxTimes) {
+        boolean exited = false;
+        for (int i = 0; i < maxTimes; i++) {
+            if (!terminated()) {
+                String [] reply = receiveReplyFor(JdbCommand.cont);
+                Paragrep grep = new Paragrep(reply);
+                if (grep.find(APPLICATION_EXIT) > 0) {
+                    exited = true;
+                    break;
+                }
+            } else {
+                exited = true;
+                break;
+            }
+        }
+        if (!exited) {
+            if (terminated()) {
+                exited = true;
+            } else {
+                quit();
+                throw new Failure("Debuggee did not exit after " + maxTimes + " <cont> commands");
+            }
+        }
+    }
+
+    /**
+     * Returns string array containing all strings from <i>jdb</i> stdout.
+     */
+    public String[] getTotalReply() {
+        return toStringArray(stdoutBuffer.toString());
+    }
+
+    /**
+     * Prints given message to log files and adds to <i>stdoutBuffer</i>.
+     */
+    public void logToFile(String s) {
+        synchronized(fout) {
+            fout.print(s);
+            fout.flush();
+        }
+        synchronized(stdoutBuffer) {
+            stdoutBuffer.append(s);
+        }
+        synchronized(flog) {
+            flog.print(s);
+            flog.flush();
+        }
+    }
+
+
+    /**
+     *  Starts jdb with attaching connector. Makes several tries during <i>waitTime</i>
+     *  until success. Unsuccessful launches are caused that the debuggee is not yet
+     *  ready to accept debugger.
+     */
+    public static Jdb startAttachingJdb (Launcher launcher, String[] jdbCmdArgs, String message)
+            throws IOException  {
+        Jdb jdb = null;
+
+        long delta = Launcher.DEBUGGEE_START_DELAY; // time in milliseconds to wait at every iteration.
+        long max = getLauncher().getJdbArgumentHandler().getWaitTime() * 60 * 1000;  // maximum time to wait.
+
+        int result = -1;
+        boolean found = false;
+
+        long start = System.currentTimeMillis();
+
+        while (!found && (System.currentTimeMillis() - start)<= max) {
+
+            jdb = new Jdb(launcher);
+            jdb.launch(jdbCmdArgs);
+
+            while (!found && (System.currentTimeMillis() - start)<= max) {
+
+                try {
+                    Thread.currentThread().sleep(delta);
+                } catch (InterruptedException ie) {
+                    ie.printStackTrace(getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught unexpected InterruptedException while sleep in waiting for debuggee's start:\n\t"
+                       + ie);
+                }
+
+                if (jdb.terminated() ||
+                    !jdbStdoutReader.isAlive() ||
+                    stdoutBuffer.indexOf(APPLICATION_EXIT) >= 0 ||
+                    stdoutBuffer.indexOf(APPLICATION_DISCONNECTED) >= 0) {
+
+                    System.out.println("Unsuccessful launch of attaching jdb. Next try...");
+                    try {
+                        jdb.finalize();
+                    } catch (Throwable t) {
+                        t.printStackTrace(getLauncher().getLog().getOutStream());
+                        throw new Failure("Caught unexpected error while finalizing jdb: " + t);
+                    }
+                    break;
+
+                } else if (stdoutBuffer.length() > 0) {
+                    result = stdoutBuffer.indexOf(message);
+                    if (result >= 0) {
+                        found = true; // exit loop
+                    }
+                }
+            }
+
+        }
+
+        if (result < 0) {
+            throw new Failure("Launched jdb could not attach to debuggee during " + max + " milliseconds.");
+        }
+
+        return jdb;
+    }
+
+    /**
+     *  Waits for jdb to print message about listening at address for connection,
+     *  and returns this address string.
+     */
+    public String waitForListeningJdb() {
+
+        waitForMessage(0, LISTENING_AT_ADDRESS);
+        int msgStart = stdoutBuffer.indexOf(LISTENING_AT_ADDRESS);
+        int msgEnd = stdoutBuffer.indexOf("\n", msgStart);
+        int promptLen = LISTENING_AT_ADDRESS.length();
+
+        /*
+         * The LISTENING_AT_ADDRESS string and the terminating "\n"
+         * may or may not be included in the same read so we allow
+         * this message to be terminated by "\n" or NULL.
+         */
+        if (msgEnd < 0) {
+            msgEnd = stdoutBuffer.length();
+        }
+
+        if (msgEnd <= 0 || msgEnd - msgStart <= promptLen) {
+            throw new Failure("Unknown format of message: " + LISTENING_AT_ADDRESS);
+        }
+
+        int addrStart = msgStart + promptLen;
+        String address = stdoutBuffer.substring(addrStart, msgEnd).trim();
+
+        if (address.length() <= 0) {
+            throw new Failure("Empty address in message: " + LISTENING_AT_ADDRESS);
+        }
+
+        return address;
+    }
+
+    // ---------------------------------------------- //
+
+    class JdbStdoutReader extends Thread {
+        private Jdb jdb = null;
+        private InputStream in = null;
+
+        volatile boolean stop = false;
+
+        public JdbStdoutReader (Jdb jdb) {
+            super("jdb stdout reader");
+            this.jdb = jdb;
+            this.in = jdb.getStdout();
+            if (in == null) {
+                throw new Failure("Can not get jdb stdout stream");
+            }
+            this.setDaemon(true);
+        }
+
+        public String toString() {
+            return getClass().getName() + '@' + Integer.toHexString(hashCode());
+        }
+
+        public void run() {
+            synchronized(jdb.startNotify) {
+                jdb.startNotify.notifyAll();
+            }
+
+            long delta = 10; // time in milliseconds to wait at every iteration.
+            boolean jdbWasTerminated = false;
+            while (!stop) {
+                if(jdb.terminated())
+                        jdbWasTerminated = true;
+                try {
+                    int size = in.available();
+                    if (size > 0) {
+                        byte[] buffer = new byte [size];
+                        int result = in.read(buffer, 0, size);
+                        if (result < 0) {
+                            throw new Failure("No bytes read from jdb's output stream ");
+                        } else if (result < size) {
+                            throw new Failure("Number bytes read from jdb's output stream are less than available " +
+                                 "\n\t available : " + size + ", read : " + result);
+                        }
+                        logToFile(new String(buffer, 0, result));
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught unexpected exception while reading jdb's stdout stream: " + e);
+                }
+                if(jdbWasTerminated)
+                        break;
+                try {
+                    sleep(delta);
+                } catch (InterruptedException ie) {
+                    ie.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught interrupted exception while waiting for jdb reply:\n\t" + ie);
+                }
+            }
+        }
+
+        public void close() {
+            stop = true;
+            try {
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ioe) {
+                ioe.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                throw new Failure("Caught unexpected IOException while closing jdb stdout stream: " + ioe);
+            }
+        }
+    }
+
+    /** Handler for <i>jdb</i> stderr stream. */
+    class JdbStderrReader extends Thread {
+
+        private Jdb jdb = null;
+        private volatile boolean cancelled = false;
+        private boolean empty = true;
+
+        private BufferedReader bin;
+        private PrintStream fout;
+        private String fileName;
+
+        JdbStderrReader (Jdb jdb, String jdbStderrFile) {
+            super("jdb stderr reader");
+            this.jdb = jdb;
+            InputStream in = jdb.getStderr();
+            if (in == null) {
+                throw new Failure("Can not get jdb stderr stream");
+            }
+            this.bin = new BufferedReader(new InputStreamReader(in));
+            this.setDaemon(true);
+
+            this.fileName = jdbStderrFile;
+
+            launcher.getLog().display("Creating file for jdb stderr stream: " + fileName);
+            try {
+                this.fout = new PrintStream(new BufferedOutputStream(new FileOutputStream(fileName)));
+            } catch (Exception e) {
+                e.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                throw new Failure("Caught unexpected exception while creating file for jdb stderr stream: " + e);
+            }
+        }
+
+        public void run () {
+            synchronized(jdb.startNotify) {
+                jdb.startNotify.notifyAll();
+            }
+
+            long delta = 10; // time in milliseconds to wait at every iteration.
+
+            while (!cancelled) {
+                String line = null;
+                try {
+                    line = bin.readLine();
+                    if (line == null)
+                        break; //EOF
+                } catch (IOException ioe) {
+                    ioe.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                    throw new Failure("Caught unexpected IOException while reading from jdb stderr: " + ioe);
+                }
+
+                if (line != null) {
+                   empty = false;
+                   logToFile(line);
+                }
+
+                try {
+                    sleep(delta);
+                } catch (InterruptedException ie) {
+                    throw new Failure("Caught interrupted exception while waiting for jdb reply:\n\t" + ie);
+                }
+            }
+            close();
+        }
+
+        /**
+         * Signal to <i>run()</i> method that it should terminate,
+         * and wait until it is finished.
+         */
+        public void cancel () {
+            cancelled = true;
+            while (this.isAlive()) {
+                try {
+                    this.join();
+                } catch (InterruptedException ie) {
+                    close();
+                    throw new Failure("Caught InterruptedException while waiting for JdbStderrReader termination " + ie);
+                }
+            }
+            close();
+        }
+
+        public void close() {
+            if (fout != null) {
+                synchronized (fout) {
+                    fout.close();
+                }
+            }
+
+            try {
+                if (bin != null) {
+                    bin.close();
+                }
+            } catch (IOException ioe) {
+                ioe.printStackTrace(jdb.getLauncher().getLog().getOutStream());
+                throw new Failure("Caught unexpected IOException while closing jdb stderr stream: " + ioe);
+            }
+            if (!empty) {
+                 // Should not throw exception here because of non-empty stderr in case of unsuccessful launch of attaching jdb.
+                jdb.getLauncher().getLog().display("JdbStderrReader: jdb's stderr is not empty. Check jdb.stderr file");
+            }
+        }
+
+        public String getFileName () {
+            return this.fileName;
+        }
+
+        public void logToFile(String line) {
+            synchronized (fout) {
+                fout.println(line);
+                fout.flush();
+            }
+        }
+    } // end of JdbStderrReader
+}  // end of Jdb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbArgumentHandler.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdi.ArgumentHandler;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Parser for <code>jdb</code> test's specific command-line arguments.
+ * This class also parses JDI specific command-line arguments.
+ * <p>
+ * <code>JdbArgumentHandler</code> handles <code>jdb</code> test's specific
+ * arguments related to launching of <code>jdb</code> to debugged VM
+ * in addition to general arguments recognized by <code>ArgumentHandler</code>,
+ * <code>DebugeeArgumentHandler</code> and <code>ArgumentParser</code>.
+ * <p>
+ * Following is the list of specific options recognized by <code>AgrumentHandler</code>:
+ * <ul>
+ * <li> <code>-jdb=JAVA_SDK_HOME_PATH/bin/$JDB</code> -                                        <br>
+ *   full path to <code>jdb</code> binaries. There is no default value.                        <br>
+ * <li> <code>-workdir=CURRENT_TEST_DIRECTORY_PATH</code> -
+ *   full path to current test directory. There is no default value.
+ * <li> <code>-jdb.option=JDB_COMMAND_LINE_OPTIONS</code> -
+ *   jdb options (see <code>jdb -help</code>) except these ones:
+ *   <ul>
+ *      <li><code>-attach [address] </code></li>
+ *      <li><code>-listen [address] </code></li>
+ *      <li><code>-connect [connector-name]:[name1]=[value1],... </code></li>
+ *   </ul>
+ * </ul>
+ * <p>
+ * See also list of arguments recognized by the base <code>ArgumentHandler</code>,
+ * <code>DebugeeArgumentHandler</code> and <code>ArgumentParser</code> classes.
+ * <p>
+ * See also description of <code>ArgumentParser</code> how to work with
+ * command line arguments and options.
+ *
+ * @see nsk.share.ArgumentParser
+ * @see nsk.share.jpda.DebugeeArgumentHandler
+ * @see nsk.share.jdi.ArgumentHandler
+ */
+public class JdbArgumentHandler extends nsk.share.jdi.ArgumentHandler {
+
+    /**
+     * Keep a copy of raw command-line arguments and parse them;
+     * but throw an exception on parsing error.
+     *
+     * @param  args  Array of the raw command-line arguments.
+     *
+     * @throws  NullPointerException  If <code>args==null</code>.
+     * @throws  IllegalArgumentException  If Binder or Log options
+     *                                    are set incorrectly.
+     *
+     * @see #setRawArguments(String[])
+     */
+    public JdbArgumentHandler(String args[]) {
+        super(args);
+    }
+
+
+    /**
+     * Checks if an option is admissible and has proper value.
+     * This method is invoked by <code>parseArguments()</code>
+     *
+     * @param option option name
+     * @param value string representation of value (could be an empty string)
+     *              null if this option has no value
+     * @return <i>true</i> if option is admissible and has proper value
+     *         <i>false</i> if option is not admissible
+     *
+     * @throws <i>BadOption</i> if option has illegal value
+     *
+     * @see #parseArguments()
+     */
+    protected boolean checkOption(String option, String value) {
+
+        if (option.equals("jdb")) {
+            if (value == null) {
+                throw new BadOption(option + ": value must be not null");
+            }
+            return true;
+        }
+
+        if (option.equals("workdir")) {
+            if (value == null) {
+                throw new BadOption(option + ": value must be not null");
+            }
+            return true;
+        }
+
+        if (option.equals("java.options")) {
+            return true;
+        }
+
+        if (option.equals("jdb.option")) {
+            if (value != null) {
+                if (value.indexOf("-attach") > 0) {
+                    throw new BadOption("jdb option -attach is not admissible: " + value);
+                }
+                if (value.indexOf("-listen") > 0) {
+                    throw new BadOption("jdb option -listen is not admissible: "  + value);
+                }
+                if (value.indexOf("-connect") > 0) {
+                    throw new BadOption("jdb option -connect is not admissible: " + value);
+                }
+                if (value.indexOf("-help") > 0) {
+                    throw new BadOption("jdb option -help is not admissible: " + value);
+                }
+                if (value.indexOf("-listenany") > 0) {
+                    throw new BadOption("jdb option -listenany is not admissible: " + value);
+                }
+                if (value.indexOf("-launch") > 0) {
+                    throw new BadOption("jdb option -launch is not admissible: " + value);
+                }
+                if (value.indexOf("-tclient") > 0) {
+                    throw new BadOption("jdb option -tclient is not admissible: " + value);
+                }
+                if (value.indexOf("-tserver") > 0) {
+                    throw new BadOption("jdb option -tserver is not admissible: " + value);
+                }
+            }
+            return true;
+        }
+
+        return super.checkOption(option, value);
+    }
+
+    /**
+     * Checks options against inconcistence.
+     * This method is invoked by <code>parseArguments()</code>
+     *
+     * @see #parseArguments()
+     */
+    protected void checkOptions() {
+
+        super.checkOptions();
+    }
+
+    /**
+     * Returns the path to current test directory.
+     */
+
+    public String getWorkDir() {
+        return options.getProperty("workdir", "");
+    }
+
+    /**
+     * Return sfull path to jdb executable.
+     *
+     */
+    public String getJdbExecPath() {
+        return options.getProperty("jdb");
+    }
+
+    /**
+     * Returns command line options <code>jdb</code> was launched with.
+     */
+    public String getJdbOptions() {
+        return options.getProperty("jdb.option", "");
+    }
+
+    /**
+     * Adds "<code>-J</code>" prefix to each Java option, so that
+     * <code>jdb</code> could apply them to the target Java VM.
+     */
+    public static List<String> enwrapJavaOptions(String javaOptions) {
+        List<String> result = new ArrayList<String>();
+        for (String option : javaOptions.split("\\s+"))
+            if (option.length() > 0)
+                result.add("-J" + option);
+        return result;
+    }
+
+    /**
+     * Returns adjusted additional options for debuggee VM with launching connector.
+     */
+    public String getDebuggeeOptions() {
+        StringBuilder sb = new StringBuilder();
+        String value = options.getProperty("debugee.vmkeys", "").trim();
+        if (value.length() > 1 && value.startsWith("\"") && value.endsWith("\"")) {
+            value = value.substring(1, value.length() - 1).trim();
+        }
+        for (String option : value.split("\\s+")) {
+            if (option.length() > 0) {
+                sb.append(checkAndQuote(option, ","));
+                sb.append(" ");
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns options for debugger VM.
+     */
+    public String getJavaOptions() {
+        String value = options.getProperty("java.options", "").trim();
+        if (value.length() > 1 && value.startsWith("\"") && value.endsWith("\"")) {
+            value = value.substring(1, value.length() - 1).trim();
+        }
+        return value;
+    }
+
+    /**
+     * Remove "<code>-server</code>" or "<code>-client</code>" from options string,
+     * if anything of them are presented.
+     */
+    public static String removeVMFlavorOption(String javaOptions) {
+        StringBuffer result = new StringBuffer();
+        StringTokenizer tokenizer = new StringTokenizer(javaOptions);
+        while (tokenizer.hasMoreTokens()) {
+            String option = tokenizer.nextToken();
+            if (!option.equals("-server") && !option.equals("-client")) {
+                result.append( (result.length() > 0 ? " " : "") + option);
+            }
+        };
+        return result.toString();
+    }
+
+    /**
+     * @return "<code>-tserver</code>" if "<code>-server</code>" is presented in options string.
+     * @return "<code>-tclient</code>" if "<code>-client</code>" is presented in options string.
+     * @return empty string otherwise.
+     */
+    public static String stripVMFlavorOption(String javaOptions) {
+        String result = "";
+        StringTokenizer tokenizer = new StringTokenizer(javaOptions);
+        while (tokenizer.hasMoreTokens()) {
+            String option = tokenizer.nextToken();
+            if (option.equals("-server")) {
+                result = "-tserver";
+                break;
+            } else if (option.equals("-client")) {
+                result = "-tclient";
+                break;
+            }
+        };
+        return result;
+    }
+
+    // check if target substring exists and quote value if needed
+    // ex for subString == "," and value == disk=true,dumponexit=true
+    // return 'disk=true,dumponexit=true'
+    private static String checkAndQuote(String value, String subString) {
+        if (NO_SUBSTR_MATCH == value.indexOf(subString)) {
+            // return as-is
+            return value;
+        }
+        // already single quoted 'value' ?
+        if (isEnclosed(value, "'")) {
+            return value;
+        }
+        // already double quoted "value" ?
+        if (isEnclosed(value, "\"")) {
+            // change to 'value'
+            return value.replaceAll("\"", "'");
+        }
+        // else single quote the value
+        return "'" + value + "'";
+    }
+
+    private static boolean isEnclosed(String value,
+                                      String enclosingChar) {
+        int firstEnclosePos = value.indexOf(enclosingChar);
+        if (0 == firstEnclosePos) {
+            int lastEnclosePos = value.lastIndexOf(enclosingChar);
+            if (lastEnclosePos > firstEnclosePos && lastEnclosePos == value.length() - 1) {
+                //already quoted
+                return true;
+            }
+            //only a single quote? subString outside quotes? Wrongly quoted, needs fix
+            throw new BadOption(value +  " not correctly quoted");
+        }
+        return false;
+    }
+
+    private static final int NO_SUBSTR_MATCH = -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbCommand.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+/**
+ * Represents list of commands of <code>jdb</code> from JDK1.4:
+ *
+ *   run [class [args]]        -- start execution of application's main class
+ *
+ *   threads [threadgroup]     -- list threads
+ *   thread <thread id>        -- set default thread
+ *   suspend [thread id(s)]    -- suspend threads (default: all)
+ *   resume [thread id(s)]     -- resume threads (default: all)
+ *   where [thread id] | all   -- dump a thread's stack
+ *   wherei [thread id] | all  -- dump a thread's stack, with pc info
+ *   up [n frames]             -- move up a thread's stack
+ *   down [n frames]           -- move down a thread's stack
+ *   kill <thread> <expr>      -- kill a thread with the given exception object
+ *   interrupt <thread>        -- interrupt a thread
+ *
+ *   print <expr>              -- print value of expression
+ *   dump <expr>               -- print all object information
+ *   eval <expr>               -- evaluate expression (same as print)
+ *   set <lvalue> = <expr>     -- assign new value to field/variable/array element
+ *   locals                    -- print all local variables in current stack frame
+ *
+ *   classes                   -- list currently known classes
+ *   class <class id>          -- show details of named class
+ *   methods <class id>        -- list a class's methods
+ *   fields <class id>         -- list a class's fields
+ *
+ *   threadgroups              -- list threadgroups
+ *   threadgroup <name>        -- set current threadgroup
+ *
+ *   stop in <class id>.<method>[(argument_type,...)]
+ *                             -- set a breakpoint in a method
+ *   stop at <class id>:<line> -- set a breakpoint at a line
+ *   clear <class id>.<method>[(argument_type,...)]
+ *                             -- clear a breakpoint in a method
+ *   clear <class id>:<line>   -- clear a breakpoint at a line
+ *   clear                     -- list breakpoints
+ *   catch <class id>          -- break when specified exception thrown
+ *   ignore <class id>         -- cancel 'catch'  for the specified exception
+ *   watch [access|all] <class id>.<field name>
+ *                             -- watch access/modifications to a field
+ *   unwatch [access|all] <class id>.<field name>
+ *                             -- discontinue watching access/modifications to a field
+ *   trace methods [thread]    -- trace method entry and exit
+ *   untrace methods [thread]  -- stop tracing method entry and exit
+ *   step                      -- execute current line
+ *   step up                   -- execute until the current method returns to its caller
+ *   stepi                     -- execute current instruction
+ *   next                      -- step one line (step OVER calls)
+ *   cont                      -- continue execution from breakpoint
+ *
+ *   list [line number|method] -- print source code
+ *   use (or sourcepath) [source file path]
+ *                             -- display or change the source path
+ *   exclude [class id ... | "none"]
+ *                             -- do not report step or method events for specified classes
+ *   classpath                 -- print classpath info from target VM
+ *
+ *   monitor <command>         -- execute command each time the program stops
+ *   monitor                   -- list monitors
+ *   unmonitor <monitor#>      -- delete a monitor
+ *   read <filename>           -- read and execute a command file
+ *
+ *   lock <expr>               -- print lock info for an object
+ *   threadlocks [thread id]   -- print lock info for a thread
+ *
+ *   pop                       -- pop the stack through and including the current frame
+ *   reenter                   -- same as pop, but current frame is reentered
+ *   redefine <class id> <class file name>
+ *                             -- redefine the code for a class
+ *
+ *   disablegc <expr>          -- prevent garbage collection of an object
+ *   enablegc <expr>           -- permit garbage collection of an object
+ *
+ *   !!                        -- repeat last command
+ *   <n> <command>             -- repeat command n times
+ *   help (or ?)               -- list commands
+ *   version                   -- print version information
+ *   exit (or quit)            -- exit debugger
+ *
+ *   <class id>: full class name with package qualifiers or a
+ *   pattern with a leading or trailing wildcard ('*').
+ *   <thread id>: thread number as reported in the 'threads' command
+ *   <expr>: a Java(tm) Programming Language expression.
+ *   Most common syntax is supported.
+ *
+ *   Startup commands can be placed in either "jdb.ini" or ".jdbrc"
+ *   in user.home or user.dir
+ */
+public class JdbCommand {
+    public static final String ls = System.getProperty("line.separator");
+
+    public static final String _catch       = "catch ";
+    public static final String _class       = "class ";
+    public static final String classes      = "classes" + ls;
+    public static final String classpath    = "classpath" + ls;
+    public static final String clear        = "clear ";
+    public static final String cont         = "cont" + ls;
+    public static final String disablegc    = "disablegc ";
+    public static final String down         = "down ";
+    public static final String dump         = "dump ";
+    public static final String enablegc     = "enablegc";
+    public static final String eval         = "eval ";
+    public static final String exit         = "exit" + ls;
+    public static final String exclude      = "exclude ";
+    public static final String fields       = "fields ";
+    public static final String help         = "help" + ls;
+    public static final String ignore       = "ignore ";
+    public static final String interrupt    = "interrupt ";
+    public static final String kill         = "kill ";
+    public static final String list         = "list ";
+    public static final String locals       = "locals" + ls;
+    public static final String lock         = "lock ";
+    public static final String methods      = "methods ";
+    public static final String monitor      = "monitor ";
+    public static final String next         = "next" + ls;
+    public static final String pop          = "pop" + ls;
+    public static final String print        = "print ";
+    public static final String quit         = "quit" + ls;
+    public static final String read         = "read ";
+    public static final String redefine     = "redefine ";
+    public static final String reenter      = "reenter" + ls;
+    public static final String resume       = "resume ";
+    public static final String run          = "run ";
+    public static final String set          = "set ";
+    public static final String step         = "step" + ls;
+    public static final String stepi        = "stepi" + ls;
+    public static final String step_up      = "step up" + ls;
+    public static final String stop_in      = "stop in ";
+    public static final String stop_at      = "stop at ";
+    public static final String suspend      = "suspend ";
+    public static final String thread       = "thread ";
+    public static final String threads      = "threads ";
+    public static final String threadgroup  = "threadgroup ";
+    public static final String threadgroups = "threadgroups" + ls;
+    public static final String threadlocks  = "threadlocks ";
+    public static final String trace        = "trace ";
+    public static final String watch        = "watch ";
+    public static final String where        = "where ";
+    public static final String where_all    = "where all" + ls;
+    public static final String wherei       = "wherei ";
+    public static final String wherei_all   = "wherei all" + ls;
+    public static final String unmonitor    = "unmonitor ";
+    public static final String untrace      = "untrace ";
+    public static final String unwatch      = "unwatch ";
+    public static final String up           = "up ";
+    public static final String use          = "use ";
+    public static final String version      = "version" + ls;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+
+import java.io.*;
+import java.util.*;
+
+public abstract class JdbTest {
+    public static final int PASSED = 0;            // Exit code for passed test
+    public static final int FAILED = 2;            // Exit code for failed test
+    public static final int JCK_STATUS_BASE = 95;  // Standard JCK-compatible exit code bias
+
+    /* Flag if the test passes */
+    protected boolean success = true;
+
+    /* Flag if debuggee should fail in a test */
+    protected static boolean debuggeeShouldFail = false;
+
+    /* Handler of command line arguments. */
+    protected static JdbArgumentHandler argumentHandler = null;
+
+    /* Log class to print log messages. */
+    protected static Log log = null;
+
+    protected static Jdb jdb = null;
+    protected static Debuggee debuggee = null;
+    protected static Launcher launcher = null;
+    protected static String debuggeeClass = "";
+    protected static String firstBreak = "";
+    protected static String lastBreak = "";
+    protected static String compoundPromptIdent = null;
+
+    /* Constructors */
+    protected JdbTest (boolean debuggeeShouldFail) {
+        this.debuggeeShouldFail = debuggeeShouldFail;
+    }
+
+    protected JdbTest () {
+        this.debuggeeShouldFail = false;
+    }
+
+    abstract protected void runCases();
+
+    protected boolean shouldPass() {
+        return false;
+    }
+
+    protected void failure(String errMessage) {
+        success = false;
+        log.complain(errMessage);
+    }
+
+    protected void display(String message) {
+        log.display(message);
+    }
+
+    protected void launchJdbAndDebuggee(String debuggeeClass) throws Exception {
+        launcher = new Launcher(argumentHandler, log);
+        launcher.launchJdbAndDebuggee(debuggeeClass);
+        jdb = launcher.getJdb();
+
+        if (jdb == null) {
+           throw new Failure("jdb object points to null");
+        }
+        if (debuggeeClass != null) {
+            if (jdb.terminated()) {
+                throw new Failure("jdb exited before testing with code " + jdb.waitFor());
+            }
+
+            if (argumentHandler.isAttachingConnector() || argumentHandler.isListeningConnector()) {
+                debuggee = launcher.getDebuggee();
+
+                if (debuggee.terminated()) {
+                   throw new Failure("Debuggee exited before testing");
+                }
+            }
+        }
+    }
+
+    protected void initJdb() {
+        String[] reply;
+
+        jdb.setCompoundPromptIdent(compoundPromptIdent);
+
+        // wait for prompts after connection established
+        if (argumentHandler.isAttachingConnector() || argumentHandler.isListeningConnector()) {
+            // wait for two prompts (after connection established and VM_INIT received)
+            jdb.waitForPrompt(0, false, 2);
+        } else if (argumentHandler.isLaunchingConnector()) {
+            // wait for one prompt (after connection established)
+            jdb.waitForPrompt(0, false);
+        } else {
+            throw new TestBug("Unexpected connector kind: " + argumentHandler.getConnectorType());
+        }
+
+        display("Setting first breakpoint");
+        jdb.setDeferredBreakpointInMethod(firstBreak);
+
+        display("Starting debuggee class");
+        jdb.startDebuggeeClass();
+    }
+
+    protected void afterJdbExit() {
+    }
+
+    protected int runTest(String argv[], PrintStream out) {
+        try {
+            argumentHandler = new JdbArgumentHandler(argv);
+            log = new Log(out, argumentHandler);
+
+            if (shouldPass()) {
+                log.println("TEST PASSED");
+                return PASSED;
+            }
+
+            try {
+                launchJdbAndDebuggee(debuggeeClass);
+
+                try {
+                    initJdb();
+
+                    /* START OF TEST CASES */
+                    display("Test cases starts.");
+
+                    runCases();
+
+                    display("Test cases ends.");
+                    /* END OF TEST CASES */
+
+                } catch (DebuggeeUncaughtException ex) {
+                    jdb.quit();
+                    throw new TestFailure(ex);
+                } catch (Exception e) {
+                    failure("Caught unexpected exception while executing the test: " + e);
+                    e.printStackTrace(log.getOutStream());
+                } finally {
+                    display("Waiting for jdb exits");
+                    int code = jdb.waitFor(argumentHandler.getWaitTime() * 60 * 1000);
+                    if (code == PASSED) {
+                        display("jdb normally exited");
+                        afterJdbExit();
+                    } else if (code == LocalProcess.PROCESS_IS_ALIVE) {
+                        failure("jdb did not exit after timeout.");
+                        if (!jdb.terminated()) {
+                           display("Sending quit command to jdb.");
+                           jdb.quit();
+                        } else {
+                           throw new TestBug("code PROCESS_IS_ALIVE is returned for terminated jdb");
+                        }
+                    } else {
+                        failure("jdb abnormally exited with code: " + code);
+                    }
+                    jdb = null;
+
+                    if (debuggee != null
+                            && (argumentHandler.isAttachingConnector()
+                                    || argumentHandler.isListeningConnector())) {
+                        display("Waiting for debuggee exits");
+                        code = debuggee.waitForDebuggee();
+                        if (debuggeeShouldFail) {
+                            if (code == JCK_STATUS_BASE + PASSED) {
+                                failure("Debuggee PASSED with exit code: " + code + " but should fail");
+                            } else {
+                                display("Debuggee FAILED as expected with exit code: " + code);
+                            }
+                        } else {
+                            if (code == JCK_STATUS_BASE + PASSED) {
+                                display("Debuggee PASSED with exit code: " + code);
+                            } else {
+                                failure("Debuggee FAILED with exit code: " + code);
+                            }
+                        }
+//                        debuggee = null;
+                    }
+                }
+
+            } catch (Exception e) {
+                failure("Caught unexpected exception: " + e);
+                e.printStackTrace(out);
+
+                if (jdb != null) {
+                    try {
+                        jdb.finalize();
+                    } catch (Throwable ex) {
+                        failure("Caught exception/error while finalization of jdb:\n\t" + ex);
+                        ex.printStackTrace(log.getOutStream());
+                    }
+                } else {
+                    log.complain("jdb reference is null, cannot run jdb.finalize() method");
+                }
+
+                if (debuggee != null) {
+                    debuggee.killDebuggee();
+                } else {
+                    log.complain("debuggee reference is null, cannot run debuggee.finalize() method");
+                }
+
+            }
+
+            if (!success) {
+                log.complain("TEST FAILED");
+                return FAILED;
+            }
+
+        } catch (Exception e) {
+            out.println("Caught unexpected exception while starting the test: " + e);
+            e.printStackTrace(out);
+            out.println("TEST FAILED");
+            return FAILED;
+        }
+        out.println("TEST PASSED");
+        return PASSED;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java	Tue May 22 10:08:04 2018 -0700
@@ -0,0 +1,386 @@
+/*
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package nsk.share.jdb;
+
+import nsk.share.*;
+import nsk.share.jpda.*;
+import nsk.share.jdi.ArgumentHandler;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * This class provides launching of <code>jdb</code> and debuggee in local
+ * or remote mode according to test command line options.
+ */
+
+public class Launcher extends DebugeeBinder {
+
+    /* Delay in milliseconds after launching jdb.*/
+    static final long DEBUGGEE_START_DELAY = 5 * 1000;
+
+    protected static Jdb jdb;
+
+    protected static Debuggee debuggee;
+
+    /** Pattern for message of jdb has started. */
+    protected static String JDB_STARTED = "Initializing jdb";
+
+    /**
+     * Get version string.
+     */
+    public static String getVersion () {
+        return "@(#)Launcher.java %I% %E%";
+    }
+
+    // -------------------------------------------------- //
+
+    /**
+     * Handler of command line arguments.
+     */
+    protected static JdbArgumentHandler argumentHandler = null;
+
+    /**
+     * Return <code>argumentHandler</code> of this binder.
+     */
+    public static JdbArgumentHandler getJdbArgumentHandler() {
+        return argumentHandler;
+    }
+
+    /**
+     * Return <code>jdb</code> mirror of this binder.
+     */
+    public static Jdb getJdb() {
+        return jdb;
+    }
+
+    /**
+     * Return debuggee mirror of this binder.
+     */
+    public static Debuggee getDebuggee() {
+        return debuggee;
+    }
+
+    /**
+     * Incarnate new Launcher obeying the given
+     * <code>argumentHandler</code>; and assign the given
+     * <code>log</code>.
+     */
+    public Launcher (JdbArgumentHandler argumentHandler, Log log) {
+        super(argumentHandler, log);
+        setLogPrefix("launcher > ");
+        this.argumentHandler = argumentHandler;
+    }
+
+    /**
+     * Defines mode (local or remote) and type of connector (default, launching,
+     * raw launching, attaching or listening) according to options
+     * parsed by <code>JdbArgumentHandler</code>. And then launches <code>jdb</code>
+     * and debuggee in defined mode.
+     */
+    public void launchJdbAndDebuggee (String classToExecute) throws IOException {
+
+        String[] jdbCmdArgs = makeJdbCmdLine(classToExecute);
+
+        if (argumentHandler.isLaunchedLocally()) {
+
+            if (argumentHandler.isDefaultConnector()) {
+
+                localDefaultLaunch(jdbCmdArgs, classToExecute);
+
+            } else if (argumentHandler.isRawLaunchingConnector()) {
+
+                localRawLaunch(jdbCmdArgs, classToExecute);
+
+            } else if (argumentHandler.isLaunchingConnector()) {
+
+                localLaunch(jdbCmdArgs, classToExecute);
+
+            } else if (argumentHandler.isAttachingConnector()) {
+
+                localLaunchAndAttach(jdbCmdArgs, classToExecute);
+
+            } else if (argumentHandler.isListeningConnector()) {
+
+                localLaunchAndListen(jdbCmdArgs, classToExecute);
+
+            } else {
+                throw new TestBug("Unexpected connector type for local launch mode"
+                                  + argumentHandler.getConnectorType());
+            }
+
+        } else if (argumentHandler.isLaunchedRemotely()) {
+
+            connectToBindServer(classToExecute);
+
+            if (argumentHandler.isAttachingConnector()) {
+
+                remoteLaunchAndAttach(jdbCmdArgs, classToExecute);
+
+            } else if (argumentHandler.isListeningConnector()) {
+
+                remoteLaunchAndListen(jdbCmdArgs, classToExecute);
+
+            } else {
+                throw new TestBug("Unexpected connector type for remote launch mode"
+                                  + argumentHandler.getConnectorType());
+            }
+        } else {
+            throw new Failure("Unexpected launching mode: " + argumentHandler.getLaunchMode());
+        }
+    }
+
+    /**
+     * Creates String array to launch <code>jdb</code> according to options
+     * parsed by <code>JdbArgumentHandler</code>.
+     */
+    private String[] makeJdbCmdLine (String classToExecute) {
+
+        Vector<String> args = new Vector<String>();
+
+        String jdbExecPath = argumentHandler.getJdbExecPath();
+        args.add(jdbExecPath.trim());
+        args.addAll(argumentHandler.enwrapJavaOptions(argumentHandler.getJavaOptions()));
+
+        String jdbOptions = argumentHandler.getJdbOptions();
+        if (jdbOptions.trim().length() > 0) {
+            StringTokenizer tokenizer = new StringTokenizer(jdbOptions);
+            while (tokenizer.hasMoreTokens()) {
+                String option = tokenizer.nextToken();
+                args.add(option);
+            }
+        }
+        if (classToExecute == null)
+            return args.toArray(new String[args.size()]);
+        args.add("-connect");
+        StringBuffer connect = new StringBuffer();
+
+        if (argumentHandler.isLaunchingConnector()) {
+
+// Do not need to use quote symbol.
+//            String quote = '\"';
+//            connect.append(quote + argumentHandler.getConnectorName() + ":");
+            connect.append(argumentHandler.getConnectorName() + ":");
+
+            String connectorAddress;
+            String vmAddress = makeTransportAddress();;
+
+            if (argumentHandler.isRawLaunchingConnector()) {
+
+                if (argumentHandler.isSocketTransport()) {
+                    if (argumentHandler.isLaunchedLocally()) {
+                        connectorAddress = argumentHandler.getTransportPort();
+                    } else {
+                        connectorAddress = argumentHandler.getDebugeeHost() + ":" + argumentHandler.getTransportPort();
+                    }
+                } else if (argumentHandler.isShmemTransport() ) {
+                    connectorAddress = argumentHandler.getTransportSharedName();
+                } else {
+                    throw new TestBug("Launcher: Undefined transport type for RawLaunchingConnector");
+                }
+
+                connect.append("address=" + connectorAddress.trim());
+                connect.append(",command=" + makeCommandLineString(classToExecute, vmAddress, " ").trim());
+
+            } else /* LaunchingConnector or DefaultConnector */ {
+
+                connect.append("vmexec=" + argumentHandler.getLaunchExecName().trim());
+                String debuggeeOpts = argumentHandler.getDebuggeeOptions();
+                if (debuggeeOpts.trim().length() > 0) {
+                    //connect.append(",options=" + debuggeeOpts.trim());
+                    connect.append(",options=");
+                    for (String arg : debuggeeOpts.split("\\s+")) {
+                       connect.append(" \"");
+                       connect.append(arg);
+                       connect.append("\"");
+                    }
+                }
+                String cmdline = classToExecute + " " + ArgumentHandler.joinArguments(argumentHandler.getArguments(), " ");
+                connect.append(",main=" + cmdline.trim());
+
+            }
+
+//            connect.append(quote);
+
+        } else {
+
+            connect.append(argumentHandler.getConnectorName() + ":");
+
+            if (argumentHandler.isAttachingConnector()) {
+
+                if (argumentHandler.isSocketTransport()) {
+                    connect.append("port=" + argumentHandler.getTransportPort().trim());
+                    if (argumentHandler.isLaunchedRemotely())
+                        connect.append(",hostname=" + argumentHandler.getDebugeeHost().trim());
+                } else if (argumentHandler.isShmemTransport()) {
+                    connect.append("name=" + argumentHandler.getTransportSharedName().trim());
+                } else {
+                    throw new TestBug("Launcher: Undefined transport type for AttachingConnector");
+                }
+
+
+            } else if (argumentHandler.isListeningConnector()) {
+
+                if (!argumentHandler.isTransportAddressDynamic()) {
+                    if (argumentHandler.isSocketTransport()) {
+                        connect.append("port=" + argumentHandler.getTransportPort().trim());
+                    } else if (argumentHandler.isShmemTransport()) {
+                        connect.append("name=" + argumentHandler.getTransportSharedName().trim());
+                    } else {
+                        throw new TestBug("Launcher: Undefined transport type for AttachingConnector");
+                    }
+                }
+
+            } else {
+                throw new TestBug("Launcher: Undefined connector type");
+            }
+
+        }
+
+        args.add(connect.toString().trim());
+
+        String[] argsArray = new String[args.size()];
+        for (int i = 0; i < args.size(); i++) {
+            argsArray[i] = (String) args.elementAt(i);
+        }
+
+        return argsArray;
+    }
+
+    // ---------------------------------------------- //
+
+    /**
+     * Run test in local mode using default connector.
+     */
+    private void localDefaultLaunch
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+        localLaunch(jdbCmdArgs, classToExecute);
+    }
+
+    /**
+     * Run test in local mode using raw launching connector.
+     */
+    private void localRawLaunch
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+        localLaunch(jdbCmdArgs, classToExecute);
+    }
+
+    /**
+     * Run test in local mode using launching connector.
+     */
+    private void localLaunch
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+
+        jdb = new Jdb(this);
+        display("Starting jdb launching local debuggee");
+        jdb.launch(jdbCmdArgs);
+
+        if (classToExecute != null)
+            jdb.waitForMessage(0, JDB_STARTED);
+//        jdb.waitForPrompt(0, false);
+
+    }
+
+    /**
+     * Run test in local mode using attaching connector.
+     */
+    private void localLaunchAndAttach
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+
+        debuggee = new LocalLaunchedDebuggee(this);
+        String address = makeTransportAddress();
+        String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address);
+        debuggee.launch(javaCmdArgs);
+
+        display("Start jdb attaching to local debuggee");
+        jdb = Jdb.startAttachingJdb (this, jdbCmdArgs, JDB_STARTED);
+//        jdb.waitForPrompt(0, false);
+    }
+
+    /**
+     * Run test in local mode using listening connector.
+     */
+    private void localLaunchAndListen
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+
+        jdb = new Jdb(this);
+        display("Starting jdb listening to local debuggee");
+        jdb.launch(jdbCmdArgs);
+        String address = jdb.waitForListeningJdb();
+        display("Listening address found: " + address);
+
+        debuggee = new LocalLaunchedDebuggee(this);
+        String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address);
+        debuggee.launch(javaCmdArgs);
+
+//        jdb.waitForPrompt(0, false);
+    }
+
+    /**
+     * Run test in remote mode using attaching connector.
+     */
+    private void remoteLaunchAndAttach
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+
+        debuggee = new RemoteLaunchedDebuggee(this);
+        String address = makeTransportAddress();
+        String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address);
+        try {
+            debuggee.launch(javaCmdArgs);
+        } catch (IOException e) {
+            throw new Failure("Caught exception while launching debuggee VM process:\n\t"
+                            + e);
+        };
+
+        display("Start jdb attaching to remote debuggee");
+        jdb = Jdb.startAttachingJdb (this, jdbCmdArgs, JDB_STARTED);
+//        jdb.waitForPrompt(0, false);
+    }
+
+    /**
+     * Run test in remote mode using listening connector.
+     */
+    private void remoteLaunchAndListen
+       (String[] jdbCmdArgs, String classToExecute) throws IOException {
+
+        jdb = new Jdb(this);
+        display("Starting jdb listening to remote debuggee");
+        jdb.launch(jdbCmdArgs);
+        String address = jdb.waitForListeningJdb();
+        display("Listening address found: " + address);
+
+        debuggee = new RemoteLaunchedDebuggee(this);
+        String[] javaCmdArgs = makeCommandLineArgs(classToExecute);
+        try {
+            debuggee.launch(javaCmdArgs);
+        } catch (IOException e) {
+            throw new Failure("Caught exception while launching debuggee VM process:\n\t"
+                            + e);
+        };
+
+        jdb.waitForMessage(0, JDB_STARTED);
+//        jdb.waitForPrompt(0, false);
+    }
+
+} // End of Launcher