|
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.next.next001; |
|
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 next001a { |
|
34 public static void main(String args[]) { |
|
35 next001a _next001a = new next001a(); |
|
36 System.exit(next001.JCK_STATUS_BASE + _next001a.runIt(args, System.out)); |
|
37 } |
|
38 |
|
39 static void lastBreak () {} |
|
40 |
|
41 static final String MYTHREAD = "MyThread"; |
|
42 static final int numThreads = 2; // number of threads. |
|
43 |
|
44 static JdbArgumentHandler argumentHandler; |
|
45 static Log log; |
|
46 |
|
47 static Object waitnotify = new Object(); |
|
48 |
|
49 public int runIt(String args[], PrintStream out) { |
|
50 |
|
51 argumentHandler = new JdbArgumentHandler(args); |
|
52 log = new Log(out, argumentHandler); |
|
53 |
|
54 Thread holder [] = new Thread[numThreads]; |
|
55 |
|
56 for (int i = 0; i < numThreads ; i++) { |
|
57 holder[i] = new MyThread(); |
|
58 holder[i].start(); |
|
59 try { |
|
60 holder[i].join(); |
|
61 } catch (InterruptedException e) { |
|
62 log.complain("Main thread was interrupted while waiting for finish of " + MYTHREAD + "-" + i); |
|
63 return next001.FAILED; |
|
64 } |
|
65 } |
|
66 |
|
67 log.display("Debuggee PASSED"); |
|
68 return next001.PASSED; |
|
69 } |
|
70 } |
|
71 |
|
72 |
|
73 class MyThread extends Thread { |
|
74 public void run() { |
|
75 int runLocal = func1(100); |
|
76 } |
|
77 |
|
78 public int func1(int i) { |
|
79 return func2(i); |
|
80 } |
|
81 |
|
82 public int func2(int i) { |
|
83 next001a.lastBreak(); |
|
84 int int2 = func3(i); // this is the line before 'next' command |
|
85 return int2; // this is the line after 'next' command |
|
86 } |
|
87 |
|
88 public int func3(int i) { |
|
89 return i*i; |
|
90 } |
|
91 } |