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.valueCurrent;
25 
26 import nsk.share.*;
27 import nsk.share.jpda.*;
28 import nsk.share.jdi.*;
29 
30 
31 // This class is the debugged application in the test
32 
33 class valuecur001a {
34 
35     static final int PASSED = 0;
36     static final int FAILED = 2;
37     static final int JCK_STATUS_BASE = 95;
38 
39     static final String COMMAND_READY = "ready";
40     static final String COMMAND_QUIT  = "quit";
41     static final String COMMAND_GO    = "go";
42     static final String COMMAND_DONE  = "done";
43 
main(String args[])44     public static void main(String args[]) {
45         System.exit(JCK_STATUS_BASE + run(args));
46     }
47 
run(String args[])48     static int run(String args[]) {
49         ArgumentHandler argHandler = new ArgumentHandler(args);
50         IOPipe pipe = argHandler.createDebugeeIOPipe();
51 
52         // create instance of checked class
53         CheckedClass foo = new CheckedClass();
54         foo.run();
55 
56         // notify debuggeer that debuggee started
57         pipe.println(COMMAND_READY);
58 
59         // wait for command GO from debugger
60         String command = pipe.readln();
61         if (command.equals(COMMAND_QUIT)) {
62              return PASSED;
63         }
64         if (!command.equals(COMMAND_GO)) {
65              System.err.println("TEST BUG: unknown command: " + command);
66              return FAILED;
67         }
68 
69         // perform actions
70         foo.run();
71 
72         // notify debugger that the command done
73         pipe.println(COMMAND_DONE);
74 
75         // wait for command QUIT from debugger and exit
76         command = pipe.readln();
77         if (!command.equals(COMMAND_QUIT)) {
78              System.err.println("TEST BUG: unknown command: " + command);
79              return FAILED;
80         }
81         return PASSED;
82     }
83 }
84 
85 // class for checking
86 class CheckedClass {
87 
88     boolean z0, z1[], z2[][];
89     byte    b0, b1[], b2[][];
90     char    c0, c1[], c2[][];
91     double  d0, d1[], d2[][];
92     float   f0, f1[], f2[][];
93     int     i0, i1[], i2[][];
94     long    l0, l1[], l2[][];
95     short   s0, s1[], s2[][];
96 
97     static    long lS0, lS1[], lS2[][];
98     private   long lP0, lP1[], lP2[][];
99     public    long lU0, lU1[], lU2[][];
100     protected long lR0, lR1[], lR2[][];
101     transient long lT0, lT1[], lT2[][];
102     volatile  long lV0, lV1[], lV2[][];
103 
104     Boolean   Z0, Z1[], Z2[][];
105     Byte      B0, B1[], B2[][];
106     Character C0, C1[], C2[][];
107     Double    D0, D1[], D2[][];
108     Float     F0, F1[], F2[][];
109     Integer   I0, I1[], I2[][];
110     Long      L0, L1[], L2[][];
111     String    W0, W1[], W2[][];
112     Short     S0, S1[], S2[][];
113     Object    O0, O1[], O2[][];
114 
115     static    Long LS0, LS1[], LS2[][];
116     private   Long LP0, LP1[], LP2[][];
117     public    Long LU0, LU1[], LU2[][];
118     protected Long LR0, LR1[], LR2[][];
119     transient Long LT0, LT1[], LT2[][];
120     volatile  Long LV0, LV1[], LV2[][];
121 
122     interface Inter {}
123     class Class implements Inter {}
124     Class     X0, X1[], X2[][];
125     Inter     E0, E1[], E2[][];
126     static    Inter ES0, ES1[], ES2[][];
127     private   Inter EP0, EP1[], EP2[][];
128     public    Inter EU0, EU1[], EU2[][];
129     protected Inter ER0, ER1[], ER2[][];
130     transient Inter ET0, ET1[], ET2[][];
131     volatile  Inter EV0, EV1[], EV2[][];
132 
run()133     void run() {
134 
135         z0 = true;
136         b0 = 0;
137         c0 = 0;
138         d0 = 0;
139         f0 = 0;
140         i0 = 0;
141         l0 = 0;
142         s0 = 0;
143 
144         lS0 = 0;
145         lP0 = 0;
146         lU0 = 0;
147         lR0 = 0;
148         lT0 = 0;
149         lV0 = 0;
150 
151         z1  = new boolean[]   {z0};
152         z2  = new boolean[][] {z1};
153         b1  = new byte[]      {b0};
154         b2  = new byte[][]    {b1};
155         c1  = new char[]      {c0};
156         c2  = new char[][]    {c1};
157         d1  = new double[]    {d0};
158         d2  = new double[][]  {d1};
159         f1  = new float[]     {f0};
160         f2  = new float[][]   {f1};
161         i1  = new int[]       {i0};
162         i2  = new int[][]     {i1};
163         l1  = new long[]      {l0};
164         l2  = new long[][]    {l1};
165         s1  = new short[]     {s0};
166         s2  = new short[][]   {s1};
167 
168         lS1 = new long[]      {lS0};
169         lS2 = new long[][]    {lS1};
170         lP1 = new long[]      {lP0};
171         lP2 = new long[][]    {lP1};
172         lU1 = new long[]      {lU0};
173         lU2 = new long[][]    {lU1};
174         lR1 = new long[]      {lR0};
175         lR2 = new long[][]    {lR1};
176         lT1 = new long[]      {lT0};
177         lT2 = new long[][]    {lT1};
178         lV1 = new long[]      {lV0};
179         lV2 = new long[][]    {lV1};
180 
181         X0  = new Class();
182         X1  = new Class[]     {X0};
183         X2  = new Class[][]   {X1};
184         Z0  = new Boolean(true);
185         Z1  = new Boolean[]   {Z0};
186         Z2  = new Boolean[][] {Z1};
187         B0  = new Byte(java.lang.Byte.MIN_VALUE);
188         B1  = new Byte[]      {B0};
189         B2  = new Byte[][]    {B1};
190         C0  = new Character(java.lang.Character.MIN_VALUE);
191         C1  = new Character[] {C0};
192         C2  = new Character[][]{C1};
193         D0  = new Double(java.lang.Double.MIN_VALUE);
194         D1  = new Double[]    {D0};
195         D2  = new Double[][]  {D1};
196         F0  = new Float(java.lang.Float.MIN_VALUE);
197         F1  = new Float[]     {F0};
198         F2  = new Float[][]   {F1};
199         I0  = new Integer(java.lang.Integer.MIN_VALUE);
200         I1  = new Integer[]   {I0};
201         I2  = new Integer[][] {I1};
202         L0  = new Long(java.lang.Long.MIN_VALUE);
203         L1  = new Long[]      {L0};
204         L2  = new Long[][]    {L1};
205         S0  = new Short(java.lang.Short.MIN_VALUE);
206         S1  = new Short[]     {S0};
207         S2  = new Short[][]   {S1};
208         W0  = new String();
209         W1  = new String[]    {W0};
210         W2  = new String[][]  {W1};
211         O0  = new Object();
212         O1  = new Object[]    {O0};
213         O2  = new Object[][]  {O1};
214 
215         LS0 = new Long(java.lang.Long.MAX_VALUE);
216         LS1 = new Long[]      {LS0};
217         LS2 = new Long[][]    {LS1};
218         LP0 = new Long(java.lang.Long.MAX_VALUE);
219         LP1 = new Long[]      {LP0};
220         LP2 = new Long[][]    {LP1};
221         LU0 = new Long(java.lang.Long.MAX_VALUE);
222         LU1 = new Long[]      {LU0};
223         LU2 = new Long[][]    {LU1};
224         LR0 = new Long(java.lang.Long.MAX_VALUE);
225         LR1 = new Long[]      {LR0};
226         LR2 = new Long[][]    {LR1};
227         LT0 = new Long(java.lang.Long.MAX_VALUE);
228         LT1 = new Long[]      {LT0};
229         LT2 = new Long[][]    {LT1};
230         LV0 = new Long(java.lang.Long.MAX_VALUE);
231         LV1 = new Long[]      {LV0};
232         LV2 = new Long[][]    {LV1};
233 
234         E0  = new Class();
235         E1  = new Inter[]     {E0};
236         E2  = new Inter[][]   {E1};
237         ES0 = new Class();
238         ES1 = new Inter[]     {ES0};
239         ES2 = new Inter[][]   {ES1};
240         EP0 = new Class();
241         EP1 = new Inter[]     {EP0};
242         EP2 = new Inter[][]   {EP1};
243         EU0 = new Class();
244         EU1 = new Inter[]     {EU0};
245         EU2 = new Inter[][]   {EU1};
246         ER0 = new Class();
247         ER1 = new Inter[]     {ER0};
248         ER2 = new Inter[][]   {ER1};
249         ET0 = new Class();
250         ET1 = new Inter[]     {ET0};
251         ET2 = new Inter[][]   {ET1};
252         EV0 = new Class();
253         EV1 = new Inter[]     {EV0};
254         EV2 = new Inter[][]   {EV1};
255 
256        m(z2); m(b2); m(c2); m(d2); m(f2); m(i2); m(l2); m(s2);
257 
258        m(lS2); m(lP2); m(lU2); m(lR2); m(lT2); m(lV2);
259 
260        m(X2); m(Z2); m(B2); m(C2); m(D2); m(F2); m(I2); m(S2); m(W2); m(O2);
261 
262        m(LS2); m(LP2); m(LU2); m(LR2); m(LT2); m(LV2);
263 
264        m(X2); m(E2); m(ES2); m(EP2); m(EU2); m(ER2); m(ET2); m(EV2);
265 
266     }
267 
m(Object obj)268     void m(Object obj) {
269         return;
270     }
271 }
272