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/multithrd/tc03x001.
29  * VM Testbase keywords: [quick, jpda, jdi]
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 2 - Breakpoints (multiple threads)
35  *         Test case:      TC3
36  *         Description:    Exception breakpoint
37  *         Steps:          1.Set caught exception breakpoint on class
38  *                           javax.sound.midi.MidiUnavailableException
39  *                         2.Debug Main
40  *                           X. Stops on line 42 in Main.java
41  *     The description was drown up according to steps under JBuilder.
42  *     Of course, the test has own line numbers and method/class names and
43  *     works as follow:
44  *     When the test is starting debugee, debugger creates ExceptionRequest.
45  *     After ExceptionEvent arrived, debugger checks line number of one's
46  *     location. It should be 74th line, that is throwing tc03x001aException.
47  *     Every thread must generate ExceptionEvent.
48  *     In case, when at least one event doesn't arrive during waittime
49  *     interval or line number of event is wrong, test fails.
50  * COMMENTS:
51  *     Test was fixed according to test bug:
52  *     4778296 TEST_BUG: debuggee VM intemittently hangs after resuming
53  *     - handling VMStartEvent was removed from the debugger part of the test
54  *     - quit on VMDeathEvent was added to the event handling loop
55  *     Test fixed according to test bug:
56  *     4804095 TEST_BUG: potential race condition with loading classes in JDI tests
57  *     - launching debuggee by prepareDebugee() replaced with bindToDebugee()
58  *       to exclude first IOPipe communication
59  *     - making ClassPrepareRequest moved to begin (right after debuggee started)
60  *     - making ExceptionRequest moved to handling ClassPrepareEvent
61  *     - handling events moved to a separate thread
62  *     - removed extra IOPipe communication points to make algorithm more clear
63  *
64  * @library /vmTestbase
65  *          /test/lib
66  * @run driver jdk.test.lib.FileInstaller . .
67  * @build nsk.jdi.BScenarios.multithrd.tc03x001
68  *        nsk.jdi.BScenarios.multithrd.tc03x001a
69  * @run main/othervm PropertyResolvingWrapper
70  *      nsk.jdi.BScenarios.multithrd.tc03x001
71  *      -verbose
72  *      -arch=${os.family}-${os.simpleArch}
73  *      -waittime=5
74  *      -debugee.vmkind=java
75  *      -transport.address=dynamic
76  *      "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
77  */
78 
79