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.Method.locationsOfLine_ssi;
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 locationsofline_ssi001 JDI test.
32  */
33 
34 public class locationsofline_ssi001a {
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     //--------------------------------------------------   log procedures
43 
44     static boolean verbMode = false;
45 
log1(String message)46     private static void log1(String message) {
47         if (verbMode)
48             System.err.println("**>  debuggee: " + message);
49     }
50 
logErr(String message)51     private static void logErr(String message) {
52         if (verbMode)
53             System.err.println("!!**>  debuggee: " + message);
54     }
55 
56     //====================================================== test program
57 
58     static TestClass obj = new TestClass();
59 
60     //----------------------------------------------------   main method
61 
main(String argv[])62     public static void main (String argv[]) {
63 
64         for (int i=0; i<argv.length; i++) {
65             if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {
66                 verbMode = true;
67                 break;
68             }
69         }
70         log1("debuggee started!");
71 
72         // informing a debugger of readyness
73         ArgumentHandler argHandler = new ArgumentHandler(argv);
74         IOPipe pipe = argHandler.createDebugeeIOPipe();
75         pipe.println("ready");
76 
77 
78         int exitCode = PASSED;
79         for (int i = 0; ; i++) {
80 
81             String instruction;
82 
83             log1("waiting for an instruction from the debugger ...");
84             instruction = pipe.readln();
85             if (instruction.equals("quit")) {
86                 log1("'quit' recieved");
87                 break ;
88 
89             } else if (instruction.equals("newcheck")) {
90                 switch (i) {
91 
92     //------------------------------------------------------  section tested
93 
94                 case 0:
95                                 pipe.println("checkready");
96                                 break ;
97 
98     //-------------------------------------------------    standard end section
99 
100                 default:
101                                 pipe.println("checkend");
102                                 break ;
103                 }
104 
105             } else {
106                 logErr("ERRROR: unexpected instruction: " + instruction);
107                 exitCode = FAILED;
108                 break ;
109             }
110         }
111 
112         System.exit(exitCode + PASS_BASE);
113     }
114 }
115 
116 class TestClass {
117 
bl()118     public boolean bl () { return false; }
bt()119     public byte    bt () { return 0;     }
ch()120     public char    ch () { return 0;     }
db()121     public double  db () { return 0.0d;  }
fl()122     public float   fl () { return 0.0f;  }
in()123     public int     in () { return 0;     }
ln()124     public long    ln () { return 0;     }
sh()125     public short   sh () { return 0;     }
126 
vd()127     public void vd () { return ; }
128 
129 
130 
primitiveargsmethod( boolean bl, byte bt )131    public void primitiveargsmethod ( boolean bl,  byte bt ) {
132        boolean bl1 = bl;
133        byte    bt1 = bt;
134        return ;
135    }
136 }
137