< prev index next >

test/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  */


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




 783         final BreakpointRequest request =
 784             requestManager.createBreakpointRequest(loc);
 785         request.addCountFilter(1);



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


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




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


   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  */


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


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


< prev index next >