1 /*
   2  * Copyright (c) 2016, 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 vm/mlvm/meth/func/jdi/breakpoint.
  29  * VM Testbase keywords: [feature_mlvm, nonconcurrent]
  30  * VM Testbase readme:
  31  * DESCRIPTION
  32  *     Using JDI set a debugger breakpoint on a method inside a method handle sequence.
  33  *     Go few steps, obtaining various information from JVM.
  34  *
  35  * @library /vmTestbase
  36  *          /test/lib
  37  * @run driver jdk.test.lib.FileInstaller . .
  38  *
  39  * @comment build debuggee class
  40  * @build vm.mlvm.share.jdi.MHDebuggee
  41  *
  42  * @comment build test class and indify classes
  43  * @build vm.mlvm.meth.func.jdi.breakpoint.Test
  44  * @run driver vm.mlvm.share.IndifiedClassesBuilder
  45  *
  46  * @run main/othervm PropertyResolvingWrapper
  47  *      vm.mlvm.meth.func.jdi.breakpoint.Test
  48  *      -verbose
  49  *      -arch=${os.family}-${os.simpleArch}
  50  *      -waittime=5
  51  *      -debugee.vmkind=java
  52  *      -transport.address=dynamic
  53  *      -debugger.debuggeeClass vm.mlvm.share.jdi.MHDebuggee
  54  */
  55 
  56 package vm.mlvm.meth.func.jdi.breakpoint;
  57 
  58 import vm.mlvm.share.jdi.ArgumentHandler;
  59 import vm.mlvm.share.jdi.BreakpointInfo;
  60 import vm.mlvm.share.jdi.JDIBreakpointTest;
  61 import vm.mlvm.share.jpda.StratumInfo;
  62 
  63 import java.util.ArrayList;
  64 import java.util.List;
  65 
  66 public class Test extends JDIBreakpointTest {
  67     // invokeMH:S100,invokePlain:S100,mhTarget,plainTarget,stop
  68     @Override
  69     protected List<BreakpointInfo> getBreakpoints(String debuggeeClassName) {
  70         List<BreakpointInfo> result = new ArrayList<>();
  71         {
  72             BreakpointInfo info = new BreakpointInfo("invokeMH");
  73             info.stepsToTrace = 100;
  74             result.add(info);
  75         }
  76         {
  77             BreakpointInfo info = new BreakpointInfo("invokePlain");
  78             info.stepsToTrace = 100;
  79             result.add(info);
  80         }
  81         result.add(new BreakpointInfo("mhTarget"));
  82         result.add(new BreakpointInfo("plainTarget"));
  83         result.add(new BreakpointInfo("stop"));
  84 
  85         return result;
  86     }
  87 
  88 
  89     public static void main(String[] args) {
  90         launch(new ArgumentHandler(args));
  91     }
  92 }