test/hotspot/jtreg/vmTestbase/nsk/jdb/pop/pop001/pop001a.java
changeset 50220 31361382634b
equal deleted inserted replaced
50219:4ab066d71956 50220:31361382634b
       
     1 /*
       
     2  * Copyright (c) 2002, 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 package nsk.jdb.pop.pop001;
       
    25 
       
    26 import nsk.share.*;
       
    27 import nsk.share.jpda.*;
       
    28 import nsk.share.jdb.*;
       
    29 
       
    30 import java.io.*;
       
    31 
       
    32 /* This is debuggee aplication */
       
    33 public class pop001a {
       
    34 
       
    35     static final String MYTHREAD  = "MyThread";
       
    36 
       
    37     static JdbArgumentHandler argumentHandler;
       
    38     static Log log;
       
    39 
       
    40     static pop001a _pop001a = new pop001a();
       
    41 
       
    42     public static void main(String args[]) {
       
    43        System.exit(pop001.JCK_STATUS_BASE + _pop001a.runIt(args, System.out));
       
    44     }
       
    45 
       
    46     static void lastBreak () {}
       
    47 
       
    48     public int runIt(String args[], PrintStream out) {
       
    49         argumentHandler = new JdbArgumentHandler(args);
       
    50         log = new Log(out, argumentHandler);
       
    51 
       
    52         MyThread myThread = new MyThread(MYTHREAD);
       
    53         myThread.start();
       
    54 
       
    55         if (myThread.isAlive()) {
       
    56             try {
       
    57                 myThread.join();
       
    58             } catch (InterruptedException e) {
       
    59                 log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD);
       
    60                 return pop001.FAILED;
       
    61             }
       
    62         }
       
    63 
       
    64         log.display("Debuggee PASSED");
       
    65         return pop001.PASSED;
       
    66     }
       
    67 }
       
    68 
       
    69 class MyThread extends Thread {
       
    70 
       
    71     public MyThread (String name) {
       
    72         super(name);
       
    73     }
       
    74 
       
    75     public void run() {
       
    76         pop001a.log.display("run() started");
       
    77         int runLocal;
       
    78         int j = func1(0);
       
    79         pop001a.log.display("run() finished");
       
    80     }
       
    81 
       
    82     public int func1(int intParam) {
       
    83         pop001a.log.display("func1() started");
       
    84         int func1Local;
       
    85         intParam++;
       
    86         return func2(intParam);
       
    87     }
       
    88 
       
    89     public int func2(int intParam) {
       
    90         pop001a.log.display("func2() started");
       
    91         int func2Local;
       
    92         intParam++;
       
    93         return func3(intParam);
       
    94     }
       
    95 
       
    96     public int func3(int intParam) {
       
    97         pop001a.log.display("func3() started");
       
    98         int func3Local;
       
    99         intParam++;
       
   100         return func4(intParam);
       
   101     }
       
   102 
       
   103     public int func4(int intParam) {
       
   104         pop001a.log.display("func4() started");
       
   105         int func4Local;
       
   106         intParam++;
       
   107         return func5(intParam);
       
   108     }
       
   109 
       
   110     public int func5(int intParam) {
       
   111         pop001a.log.display("func5() started");
       
   112         int func5Local;
       
   113         intParam++;
       
   114         pop001a.lastBreak();
       
   115         return intParam;
       
   116     }
       
   117 }