Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/com/sun/jdi/DeleteEventRequestsTest.java
38855 views
/*1* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 433187226* @summary erm.deleteEventRequests(erm.breakpointRequests()) throws exception27*28* @author Robert Field29*30* @run build TestScaffold VMConnection TargetListener TargetAdapter31* @run compile -g DeleteEventRequestsTest.java32* @run main DeleteEventRequestsTest33*/34import com.sun.jdi.*;35import com.sun.jdi.event.*;36import com.sun.jdi.request.*;3738import java.util.*;3940/********** target program **********/4142class DeleteEventRequestsTarg {43public static void main(String[] args){44System.out.println("Howdy!");45System.out.println("Goodbye from DeleteEventRequestsTarg!");46}47}4849/********** test program **********/5051public class DeleteEventRequestsTest extends TestScaffold {52ReferenceType targetClass;53ThreadReference mainThread;5455DeleteEventRequestsTest (String args[]) {56super(args);57}5859public static void main(String[] args) throws Exception {60new DeleteEventRequestsTest(args).startTests();61}6263/********** event handlers **********/6465public void stepCompleted(StepEvent event) {66failure("Got StepEvent which was deleted");67}6869/********** test core **********/7071protected void runTests() throws Exception {72/*73* Get to the top of main()74* to determine targetClass and mainThread75*/76BreakpointEvent bpe = startToMain("DeleteEventRequestsTarg");77targetClass = bpe.location().declaringType();78mainThread = bpe.thread();79EventRequestManager erm = vm().eventRequestManager();8081/*82* Set event requests83*/84StepRequest request = erm.createStepRequest(mainThread,85StepRequest.STEP_LINE,86StepRequest.STEP_OVER);87request.enable();8889/*90* This should not die with ConcurrentModificationException91*/92erm.deleteEventRequests(erm.stepRequests());9394/*95* resume the target listening for events96*/97listenUntilVMDisconnect();9899/*100* deal with results of test101* if anything has called failure("foo") testFailed will be true102*/103if (!testFailed) {104println("DeleteEventRequestsTest: passed");105} else {106throw new Exception("DeleteEventRequestsTest: failed");107}108}109}110111112