< prev index next >

test/jdk/com/sun/jdi/TestScaffold.java

Print this page


   1 /*
   2  * Copyright (c) 2001, 2013, 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  */


 767         return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);
 768     }
 769 
 770     public StepEvent stepIntoLine(ThreadReference thread) {
 771         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
 772     }
 773 
 774     public StepEvent stepOverInstruction(ThreadReference thread) {
 775         return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER);
 776     }
 777 
 778     public StepEvent stepOverLine(ThreadReference thread) {
 779         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
 780     }
 781 
 782     public StepEvent stepOut(ThreadReference thread) {
 783         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);
 784     }
 785 
 786     public BreakpointEvent resumeTo(Location loc) {




 787         final BreakpointRequest request =
 788             requestManager.createBreakpointRequest(loc);
 789         request.addCountFilter(1);



 790         request.enable();
 791         return (BreakpointEvent)waitForRequestedEvent(request);
 792     }
 793 
 794     public ReferenceType findReferenceType(String name) {
 795         List rts = vm.classesByName(name);
 796         Iterator iter = rts.iterator();
 797         while (iter.hasNext()) {
 798             ReferenceType rt = (ReferenceType)iter.next();
 799             if (rt.name().equals(name)) {
 800                 return rt;
 801             }
 802         }
 803         return null;
 804     }
 805 
 806     public Method findMethod(ReferenceType rt, String name, String signature) {
 807         List methods = rt.methods();
 808         Iterator iter = methods.iterator();
 809         while (iter.hasNext()) {
 810             Method method = (Method)iter.next();
 811             if (method.name().equals(name) &&


 828         return (Location)locs.get(0);
 829     }
 830 
 831     public BreakpointEvent resumeTo(String clsName, String methodName,
 832                                          String methodSignature) {
 833         ReferenceType rt = findReferenceType(clsName);
 834         if (rt == null) {
 835             rt = resumeToPrepareOf(clsName).referenceType();
 836         }
 837 
 838         Method method = findMethod(rt, methodName, methodSignature);
 839         if (method == null) {
 840             throw new IllegalArgumentException("Bad method name/signature: "
 841                     + clsName + "." + methodName + ":" + methodSignature);
 842         }
 843 
 844         return resumeTo(method.location());
 845     }
 846 
 847     public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException {




 848         ReferenceType rt = findReferenceType(clsName);
 849         if (rt == null) {
 850             rt = resumeToPrepareOf(clsName).referenceType();
 851         }
 852 
 853         return resumeTo(findLocation(rt, lineNumber));
 854     }
 855 
 856     public ClassPrepareEvent resumeToPrepareOf(String className) {
 857         final ClassPrepareRequest request =
 858             requestManager.createClassPrepareRequest();
 859         request.addClassFilter(className);
 860         request.addCountFilter(1);
 861         request.enable();
 862         return (ClassPrepareEvent)waitForRequestedEvent(request);
 863     }
 864 
 865     public void resumeForMsecs(long msecs) {
 866         try {
 867             addListener (this);
 868         } catch (Exception ex){
 869             ex.printStackTrace();
 870             testFailed = true;
 871             return;
 872         }
 873 


   1 /*
   2  * Copyright (c) 2001, 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  */


 767         return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_INTO);
 768     }
 769 
 770     public StepEvent stepIntoLine(ThreadReference thread) {
 771         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_INTO);
 772     }
 773 
 774     public StepEvent stepOverInstruction(ThreadReference thread) {
 775         return doStep(thread, StepRequest.STEP_MIN, StepRequest.STEP_OVER);
 776     }
 777 
 778     public StepEvent stepOverLine(ThreadReference thread) {
 779         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OVER);
 780     }
 781 
 782     public StepEvent stepOut(ThreadReference thread) {
 783         return doStep(thread, StepRequest.STEP_LINE, StepRequest.STEP_OUT);
 784     }
 785 
 786     public BreakpointEvent resumeTo(Location loc) {
 787         return resumeTo(loc, false);
 788     }
 789 
 790     public BreakpointEvent resumeTo(Location loc, boolean suspendThread) {
 791         final BreakpointRequest request =
 792                 requestManager.createBreakpointRequest(loc);
 793         request.addCountFilter(1);
 794         if (suspendThread) {
 795             request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
 796         }
 797         request.enable();
 798         return (BreakpointEvent) waitForRequestedEvent(request);
 799     }
 800 
 801     public ReferenceType findReferenceType(String name) {
 802         List rts = vm.classesByName(name);
 803         Iterator iter = rts.iterator();
 804         while (iter.hasNext()) {
 805             ReferenceType rt = (ReferenceType)iter.next();
 806             if (rt.name().equals(name)) {
 807                 return rt;
 808             }
 809         }
 810         return null;
 811     }
 812 
 813     public Method findMethod(ReferenceType rt, String name, String signature) {
 814         List methods = rt.methods();
 815         Iterator iter = methods.iterator();
 816         while (iter.hasNext()) {
 817             Method method = (Method)iter.next();
 818             if (method.name().equals(name) &&


 835         return (Location)locs.get(0);
 836     }
 837 
 838     public BreakpointEvent resumeTo(String clsName, String methodName,
 839                                          String methodSignature) {
 840         ReferenceType rt = findReferenceType(clsName);
 841         if (rt == null) {
 842             rt = resumeToPrepareOf(clsName).referenceType();
 843         }
 844 
 845         Method method = findMethod(rt, methodName, methodSignature);
 846         if (method == null) {
 847             throw new IllegalArgumentException("Bad method name/signature: "
 848                     + clsName + "." + methodName + ":" + methodSignature);
 849         }
 850 
 851         return resumeTo(method.location());
 852     }
 853 
 854     public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException {
 855         return resumeTo(clsName, lineNumber, false);
 856     }
 857 
 858     public BreakpointEvent resumeTo(String clsName, int lineNumber, boolean suspendThread) throws AbsentInformationException {
 859         ReferenceType rt = findReferenceType(clsName);
 860         if (rt == null) {
 861             rt = resumeToPrepareOf(clsName).referenceType();
 862         }
 863 
 864         return resumeTo(findLocation(rt, lineNumber), suspendThread);
 865     }
 866 
 867     public ClassPrepareEvent resumeToPrepareOf(String className) {
 868         final ClassPrepareRequest request =
 869             requestManager.createClassPrepareRequest();
 870         request.addClassFilter(className);
 871         request.addCountFilter(1);
 872         request.enable();
 873         return (ClassPrepareEvent)waitForRequestedEvent(request);
 874     }
 875 
 876     public void resumeForMsecs(long msecs) {
 877         try {
 878             addListener (this);
 879         } catch (Exception ex){
 880             ex.printStackTrace();
 881             testFailed = true;
 882             return;
 883         }
 884 


< prev index next >