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  */
23 
24 package nsk.jdi.WatchpointEvent._itself_;
25 
26 import nsk.share.*;
27 import nsk.share.jpda.*;
28 import nsk.share.jdi.*;
29 
30 /**
31  * This class is used as debuggee application for the wevent001 JDI test.
32  */
33 
34 public class wevent001a {
35 
36     //----------------------------------------------------- templete section
37 
38     static final int PASSED = 0;
39     static final int FAILED = 2;
40     static final int PASS_BASE = 95;
41 
42     static ArgumentHandler argHandler;
43     static Log log;
44 
45     //--------------------------------------------------   log procedures
46 
log1(String message)47     private static void log1(String message) {
48         log.display("**> debuggee: " + message);
49     }
50 
logErr(String message)51     private static void logErr(String message) {
52         log.complain("**> debuggee: " + message);
53     }
54 
55     //====================================================== test program
56     //------------------------------------------------------ common section
57 
58     static int exitCode = PASSED;
59 
60     static int instruction = 1;
61     static int end         = 0;
62                                    //    static int quit        = 0;
63                                    //    static int continue    = 2;
64     static int maxInstr    = 1;    // 2;
65 
66     static int lineForComm = 2;
67 
methodForCommunication()68     private static void methodForCommunication() {
69         int i1 = instruction;
70         int i2 = i1;
71         int i3 = i2;
72     }
73     //----------------------------------------------------   main method
74 
main(String argv[])75     public static void main (String argv[]) {
76 
77         argHandler = new ArgumentHandler(argv);
78         log = argHandler.createDebugeeLog();
79 
80         log1("debuggee started!");
81 
82         label0:
83             for (int i = 0; ; i++) {
84 
85                 if (instruction > maxInstr) {
86                     logErr("ERROR: unexpected instruction: " + instruction);
87                     exitCode = FAILED;
88                     break ;
89                 }
90 
91                 switch (i) {
92 
93     //------------------------------------------------------  section tested
94 
95                     case 0:
96                                 CheckedClass foo = new CheckedClass();
97 //                                foo.run();
98                                 methodForCommunication();
99                                 foo.run();
100 
101     //-------------------------------------------------    standard end section
102 
103                     default:
104                                 instruction = end;
105                                 methodForCommunication();
106                                 break label0;
107                 }
108             }
109 
110         log1("debuggee exits");
111         System.exit(exitCode + PASS_BASE);
112     }
113 }
114 
115 class CheckedClass {
116 
117     boolean z0, z1[], z2[][];
118     byte    b0, b1[], b2[][];
119     char    c0, c1[], c2[][];
120     double  d0, d1[], d2[][];
121     float   f0, f1[], f2[][];
122     int     i0, i1[], i2[][];
123     long    l0, l1[], l2[][];
124     short   s0, s1[], s2[][];
125 
126     static    long lS0, lS1[], lS2[][];
127     private   long lP0, lP1[], lP2[][];
128     public    long lU0, lU1[], lU2[][];
129     protected long lR0, lR1[], lR2[][];
130     transient long lT0, lT1[], lT2[][];
131     volatile  long lV0, lV1[], lV2[][];
132 
133     Boolean   Z0, Z1[], Z2[][];
134     Byte      B0, B1[], B2[][];
135     Character C0, C1[], C2[][];
136     Double    D0, D1[], D2[][];
137     Float     F0, F1[], F2[][];
138     Integer   I0, I1[], I2[][];
139     Long      L0, L1[], L2[][];
140     String    W0, W1[], W2[][];
141     Short     S0, S1[], S2[][];
142     Object    O0, O1[], O2[][];
143 
144     static    Long LS0, LS1[], LS2[][];
145     private   Long LP0, LP1[], LP2[][];
146     public    Long LU0, LU1[], LU2[][];
147     protected Long LR0, LR1[], LR2[][];
148     transient Long LT0, LT1[], LT2[][];
149     volatile  Long LV0, LV1[], LV2[][];
150 
151     interface Inter {}
152     class Class implements Inter {}
153     Class     X0, X1[], X2[][];
154     Inter     E0, E1[], E2[][];
155     static    Inter ES0, ES1[], ES2[][];
156     private   Inter EP0, EP1[], EP2[][];
157     public    Inter EU0, EU1[], EU2[][];
158     protected Inter ER0, ER1[], ER2[][];
159     transient Inter ET0, ET1[], ET2[][];
160     volatile  Inter EV0, EV1[], EV2[][];
161 
run()162     void run() {
163 
164         z0 = true;
165         b0 = 0;
166         c0 = 0;
167         d0 = 0;
168         f0 = 0;
169         i0 = 0;
170         l0 = 0;
171         s0 = 0;
172 
173         lS0 = 0;
174         lP0 = 0;
175         lU0 = 0;
176         lR0 = 0;
177         lT0 = 0;
178         lV0 = 0;
179 
180         z1  = new boolean[]   {z0};
181         z2  = new boolean[][] {z1};
182         b1  = new byte[]      {b0};
183         b2  = new byte[][]    {b1};
184         c1  = new char[]      {c0};
185         c2  = new char[][]    {c1};
186         d1  = new double[]    {d0};
187         d2  = new double[][]  {d1};
188         f1  = new float[]     {f0};
189         f2  = new float[][]   {f1};
190         i1  = new int[]       {i0};
191         i2  = new int[][]     {i1};
192         l1  = new long[]      {l0};
193         l2  = new long[][]    {l1};
194         s1  = new short[]     {s0};
195         s2  = new short[][]   {s1};
196 
197         lS1 = new long[]      {lS0};
198         lS2 = new long[][]    {lS1};
199         lP1 = new long[]      {lP0};
200         lP2 = new long[][]    {lP1};
201         lU1 = new long[]      {lU0};
202         lU2 = new long[][]    {lU1};
203         lR1 = new long[]      {lR0};
204         lR2 = new long[][]    {lR1};
205         lT1 = new long[]      {lT0};
206         lT2 = new long[][]    {lT1};
207         lV1 = new long[]      {lV0};
208         lV2 = new long[][]    {lV1};
209 
210         X0  = new Class();
211         X1  = new Class[]     {X0};
212         X2  = new Class[][]   {X1};
213         Z0  = new Boolean(true);
214         Z1  = new Boolean[]   {Z0};
215         Z2  = new Boolean[][] {Z1};
216         B0  = new Byte(java.lang.Byte.MIN_VALUE);
217         B1  = new Byte[]      {B0};
218         B2  = new Byte[][]    {B1};
219         C0  = new Character(java.lang.Character.MIN_VALUE);
220         C1  = new Character[] {C0};
221         C2  = new Character[][]{C1};
222         D0  = new Double(java.lang.Double.MIN_VALUE);
223         D1  = new Double[]    {D0};
224         D2  = new Double[][]  {D1};
225         F0  = new Float(java.lang.Float.MIN_VALUE);
226         F1  = new Float[]     {F0};
227         F2  = new Float[][]   {F1};
228         I0  = new Integer(java.lang.Integer.MIN_VALUE);
229         I1  = new Integer[]   {I0};
230         I2  = new Integer[][] {I1};
231         L0  = new Long(java.lang.Long.MIN_VALUE);
232         L1  = new Long[]      {L0};
233         L2  = new Long[][]    {L1};
234         S0  = new Short(java.lang.Short.MIN_VALUE);
235         S1  = new Short[]     {S0};
236         S2  = new Short[][]   {S1};
237         W0  = new String();
238         W1  = new String[]    {W0};
239         W2  = new String[][]  {W1};
240         O0  = new Object();
241         O1  = new Object[]    {O0};
242         O2  = new Object[][]  {O1};
243 
244         LS0 = new Long(java.lang.Long.MAX_VALUE);
245         LS1 = new Long[]      {LS0};
246         LS2 = new Long[][]    {LS1};
247         LP0 = new Long(java.lang.Long.MAX_VALUE);
248         LP1 = new Long[]      {LP0};
249         LP2 = new Long[][]    {LP1};
250         LU0 = new Long(java.lang.Long.MAX_VALUE);
251         LU1 = new Long[]      {LU0};
252         LU2 = new Long[][]    {LU1};
253         LR0 = new Long(java.lang.Long.MAX_VALUE);
254         LR1 = new Long[]      {LR0};
255         LR2 = new Long[][]    {LR1};
256         LT0 = new Long(java.lang.Long.MAX_VALUE);
257         LT1 = new Long[]      {LT0};
258         LT2 = new Long[][]    {LT1};
259         LV0 = new Long(java.lang.Long.MAX_VALUE);
260         LV1 = new Long[]      {LV0};
261         LV2 = new Long[][]    {LV1};
262 
263         E0  = new Class();
264         E1  = new Inter[]     {E0};
265         E2  = new Inter[][]   {E1};
266         ES0 = new Class();
267         ES1 = new Inter[]     {ES0};
268         ES2 = new Inter[][]   {ES1};
269         EP0 = new Class();
270         EP1 = new Inter[]     {EP0};
271         EP2 = new Inter[][]   {EP1};
272         EU0 = new Class();
273         EU1 = new Inter[]     {EU0};
274         EU2 = new Inter[][]   {EU1};
275         ER0 = new Class();
276         ER1 = new Inter[]     {ER0};
277         ER2 = new Inter[][]   {ER1};
278         ET0 = new Class();
279         ET1 = new Inter[]     {ET0};
280         ET2 = new Inter[][]   {ET1};
281         EV0 = new Class();
282         EV1 = new Inter[]     {EV0};
283         EV2 = new Inter[][]   {EV1};
284 
285        m(z2); m(b2); m(c2); m(d2); m(f2); m(i2); m(l2); m(s2);
286 
287        m(lS2); m(lP2); m(lU2); m(lR2); m(lT2); m(lV2);
288 
289        m(X2); m(Z2); m(B2); m(C2); m(D2); m(F2); m(I2); m(S2); m(W2); m(O2);
290 
291        m(LS2); m(LP2); m(LU2); m(LR2); m(LT2); m(LV2);
292 
293        m(X2); m(E2); m(ES2); m(EP2); m(EU2); m(ER2); m(ET2); m(EV2);
294 
295     }
296 
m(Object obj)297     void m(Object obj) {
298         return;
299     }
300 }
301