equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
25 * @test |
25 * @test |
26 * @bug 4334008 |
26 * @bug 4334008 |
27 * @summary RepStep detects missed step events due to lack of |
27 * @summary RepStep detects missed step events due to lack of |
28 * frame pop events (in back-end). |
28 * frame pop events (in back-end). |
29 * @author Robert Field |
29 * @author Robert Field |
|
30 * @library /test/lib |
30 * |
31 * |
31 * @run compile -g RepStepTarg.java |
32 * @run compile -g RepStepTarg.java |
32 * @run build VMConnection RepStep |
33 * @run build VMConnection RepStep |
33 * |
34 * |
34 * @run driver RepStep |
35 * @run driver RepStep |
35 */ |
36 */ |
36 import com.sun.jdi.*; |
37 import com.sun.jdi.*; |
37 import com.sun.jdi.event.*; |
38 import com.sun.jdi.event.*; |
38 import com.sun.jdi.request.*; |
39 import com.sun.jdi.request.*; |
39 import com.sun.jdi.connect.*; |
40 import com.sun.jdi.connect.*; |
|
41 import jdk.test.lib.process.StreamPumper; |
40 |
42 |
41 import java.util.*; |
43 import java.util.*; |
42 |
44 |
43 public class RepStep { |
45 public class RepStep { |
44 static final String TARGET = "RepStepTarg"; |
46 static final String TARGET = "RepStepTarg"; |
88 EventQueue queue = vm.eventQueue(); |
90 EventQueue queue = vm.eventQueue(); |
89 while (true) { |
91 while (true) { |
90 EventSet set = queue.remove(); |
92 EventSet set = queue.remove(); |
91 for (EventIterator it = set.eventIterator(); it.hasNext(); ) { |
93 for (EventIterator it = set.eventIterator(); it.hasNext(); ) { |
92 Event event = it.nextEvent(); |
94 Event event = it.nextEvent(); |
|
95 System.out.println("event: " + String.valueOf(event)); |
93 if (event instanceof VMStartEvent) { |
96 if (event instanceof VMStartEvent) { |
94 // get thread for setting step later |
97 // get thread for setting step later |
95 thread = ((VMStartEvent)event).thread(); |
98 thread = ((VMStartEvent)event).thread(); |
96 ClassPrepareRequest cpReq |
99 ClassPrepareRequest cpReq |
97 = requestManager.createClassPrepareRequest(); |
100 = requestManager.createClassPrepareRequest(); |
163 Connector.Argument optionsArg = |
166 Connector.Argument optionsArg = |
164 (Connector.Argument)connectorArgs.get("options"); |
167 (Connector.Argument)connectorArgs.get("options"); |
165 optionsArg.setValue(VMConnection.getDebuggeeVMOptions()); |
168 optionsArg.setValue(VMConnection.getDebuggeeVMOptions()); |
166 |
169 |
167 vm = launcher.launch(connectorArgs); |
170 vm = launcher.launch(connectorArgs); |
|
171 // redirect stdout/stderr |
|
172 new StreamPumper(vm.process().getInputStream()) |
|
173 .addPump(new StreamPumper.LinePump() { |
|
174 @Override |
|
175 protected void processLine(String line) { |
|
176 System.out.println("[debugee_stdout] " + line); |
|
177 } |
|
178 }) |
|
179 .process(); |
|
180 new StreamPumper(vm.process().getErrorStream()) |
|
181 .addPump(new StreamPumper.LinePump() { |
|
182 @Override |
|
183 protected void processLine(String line) { |
|
184 System.err.println("[debugee_stderr] " + line); |
|
185 } |
|
186 }) |
|
187 .process(); |
168 System.out.println("launched: " + TARGET); |
188 System.out.println("launched: " + TARGET); |
169 } |
189 } |
170 |
190 |
171 private void attachTarget(String portNum) throws Exception { |
191 private void attachTarget(String portNum) throws Exception { |
172 AttachingConnector conn = |
192 AttachingConnector conn = |