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/singlethrd/tc03x002. 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: TC2 36 * Description: Class breakpoint 37 * Steps: 1.Add class breakpoint: singlethread.Class1 38 * 2.Debug Main 39 * X. Stops on line 13 in Class1.java 40 * The description was drown up according to steps under JBuilder. 41 * Of course, the test has own line numbers and method/class names and 42 * works as follow: 43 * When the test is starting debugee, debugger creates MethodEntryRequest. 44 * After MethodEntryEvent arrived, debugger checks line number of one's 45 * location. It should be 73th line, that is constructor of tc02x001aClass1 46 * class. Every thread must generate MethodEntryEvent. 47 * In case, when at least one event doesn't arrive during waittime 48 * interval or line number of event is wrong, test fails. 49 * COMMENTS: 50 * There are a doublness of the "class breakpoint" understanding. 51 * Here is that JBuilder help says: 52 * 1. "A class breakpoint causes the debugger to stop when any method 53 * from the specified class is called or when the specified class 54 * is instantiated." 55 * So, a class breakpoint is MethodEntryRequest with filtering 56 * the specified class. 57 * 2. "A class breakpoint causes the debugger to stop at the location 58 * when the specified class is loaded or when any method from the 59 * specified class is called." 60 * In this case, a class breakpoint is MethodEntryRequest and 61 * ClassPrepareRequest with filtering the specified class. 62 * Test was fixed according to test bug: 63 * 4778296 TEST_BUG: debuggee VM intemittently hangs after resuming 64 * - handling VMStartEvent was removed from the debugger part of the test 65 * - quit on VMDeathEvent was added to the event handling loop 66 * Test fixed according to test bug: 67 * 4804095 TEST_BUG: potential race condition with loading classes in JDI tests 68 * - launching debuggee by prepareDebugee() replaced with bindToDebugee() 69 * to exclude first IOPipe communication 70 * - making ClassPrepareRequest moved to begin (right after debuggee started) 71 * - making MethodEntryRequest moved to handling ClassPrepareEvent 72 * - handling events moved to a separate thread 73 * - removed extra IOPipe communication points to make algorithm more clear 74 * 75 * @library /vmTestbase 76 * /test/lib 77 * @run driver jdk.test.lib.FileInstaller . . 78 * @build nsk.jdi.BScenarios.singlethrd.tc03x002 79 * nsk.jdi.BScenarios.singlethrd.tc03x002a 80 * @run main/othervm PropertyResolvingWrapper 81 * nsk.jdi.BScenarios.singlethrd.tc03x002 82 * -verbose 83 * -arch=${os.family}-${os.simpleArch} 84 * -waittime=5 85 * -debugee.vmkind=java 86 * -transport.address=dynamic 87 * "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}" 88 */ 89 90