1 /*
2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 /*
26  * @test
27  *
28  * @summary converted from VM Testbase nsk/jdi/BScenarios/hotswap/tc07x001.
29  * VM Testbase keywords: [quick, jpda, jdi, redefine]
30  * VM Testbase readme:
31  * DESCRIPTION:
32  *     This test is from the group of so-called Borland's scenarios and
33  *     implements the following test case:
34  *         Suite 3 - Hot Swap
35  *         Test case:      TC7
36  *         Description:    After point of execution, different method - stepping
37  *         Steps:          1.Set breakpoint at line 24 (call from a()
38  *                            to b())
39  *                         2.Debug Main
40  *                         3.Insert as first line in b():
41  *                            System.err.println("foo");
42  *                         4.Smart Swap
43  *                         5.F7 to step into
44  *                            X. Steps into b()
45  *                         6.F7 to step into
46  *                            X. Prints "foo"
47  *                         7.F7 to step into
48  *                            X. Steps on to line that prints "1"
49  *     The description was drown up according to steps under JBuilder.
50  *     Of course, the test has own line numbers and method/class names and
51  *     works as follow:
52  *     When the test is starting debugee, debugger sets breakpoint at
53  *     the 38th line (method method_A).
54  *     After the breakpoint is reached, debugger redefines debugee inserting
55  *     first line into method_B, creates StepRequest and resumes debugee.
56  *     When the location of the current StepEvent is in method_C, created
57  *     StepRequest is disabled.
58  *     The test checks up location of every step event and that new code
59  *     becomes actual.
60  * COMMENTS:
61  *     Test was fixed according to test bug:
62  *     4778296 TEST_BUG: debuggee VM intemittently hangs after resuming
63  *     - handling VMStartEvent was removed from the debugger part of the test
64  *     - quit on VMDeathEvent was added to the event handling loop
65  *     Test updated to wait for debugee VM exit:
66  *     - standard method Debugee.endDebugee() is used instead of final Debugee.resume()
67  *
68  * @library /vmTestbase
69  *          /test/lib
70  * @run driver jdk.test.lib.FileInstaller . .
71  * @build nsk.jdi.BScenarios.hotswap.tc07x001
72  *        nsk.jdi.BScenarios.hotswap.tc07x001a
73  *
74  * @comment compile newclassXX to bin/newclassXX
75  *          with full debug info
76  * @run driver nsk.share.ExtraClassesBuilder
77  *      -g:lines,source,vars
78  *      newclass
79  *
80  * @run main/othervm PropertyResolvingWrapper
81  *      nsk.jdi.BScenarios.hotswap.tc07x001
82  *      ./bin
83  *      -verbose
84  *      -arch=${os.family}-${os.simpleArch}
85  *      -waittime=5
86  *      -debugee.vmkind=java
87  *      -transport.address=dynamic
88  *      "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
89  */
90 
91