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.WatchpointRequest.addClassExclusionFilter; 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 filter003 JDI test. 32 */ 33 34 public class filter003a { 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 public 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 57 static filter003aTestClass10 obj10 = new filter003aTestClass10(); 58 static filter003aTestClass11 obj11 = new filter003aTestClass11(); 59 60 //------------------------------------------------------ common section 61 62 static int exitCode = PASSED; 63 64 static int instruction = 1; 65 static int end = 0; 66 // static int quit = 0; 67 // static int continue = 2; 68 static int maxInstr = 1; // 2; 69 70 static int lineForComm = 2; 71 methodForCommunication()72 private static void methodForCommunication() { 73 int i1 = instruction; 74 int i2 = i1; 75 int i3 = i2; 76 } 77 //---------------------------------------------------- main method 78 main(String argv[])79 public static void main (String argv[]) { 80 81 argHandler = new ArgumentHandler(argv); 82 log = argHandler.createDebugeeLog(); 83 84 log1("debuggee started!"); 85 86 label0: 87 for (int i = 0; ; i++) { 88 89 log1("methodForCommunication();"); 90 methodForCommunication(); 91 if (instruction == end) 92 break; 93 94 if (instruction > maxInstr) { 95 logErr("ERROR: unexpected instruction: " + instruction); 96 exitCode = FAILED; 97 break ; 98 } 99 100 switch (i) { 101 102 //------------------------------------------------------ section tested 103 104 case 0: 105 // break; 106 107 //------------------------------------------------- standard end section 108 109 default: 110 instruction = end; 111 break; 112 } 113 } 114 115 log1("debuggee exits"); 116 System.exit(exitCode + PASS_BASE); 117 } 118 /* 119 static Object waitnotifyObj = new Object(); 120 121 static int threadStart(Thread t) { 122 synchronized (waitnotifyObj) { 123 t.start(); 124 try { 125 waitnotifyObj.wait(); 126 } catch ( Exception e) { 127 exitCode = FAILED; 128 logErr(" Exception : " + e ); 129 return FAILED; 130 } 131 } 132 return PASSED; 133 } 134 135 public void run1(Thread t) { 136 t.start(); 137 try { 138 t.join(); 139 } catch ( InterruptedException e ) { 140 } 141 } 142 */ 143 } 144 145 class filter003aTestClass10 { 146 static int var101 = 0; 147 static int var102 = 0; 148 static int var103 = 0; 149 method()150 static void method () { 151 var101 = 1; 152 var103 = var101; 153 var102 = var103; 154 } 155 } 156 class filter003aTestClass11 extends filter003aTestClass10 { 157 158 static int var111 = 0; 159 static int var112 = 0; 160 static int var113 = 0; 161 method()162 static void method () { 163 var101 = 1; 164 var103 = var101; 165 var102 = var103; 166 167 var111 = 1; 168 var113 = var111; 169 var112 = var113; 170 // filter003aTestClass10.method(); 171 } 172 } 173