author | amenkov |
Wed, 22 Aug 2018 10:28:34 -0700 | |
changeset 51493 | 6b5f3f5fd63c |
parent 51424 | 083e731da31a |
child 51596 | b8eea2a7569a |
permissions | -rw-r--r-- |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
1 |
/* |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
4 |
* |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
8 |
* |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
14 |
* |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
18 |
* |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
21 |
* questions. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
22 |
*/ |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
23 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
24 |
package lib.jdb; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
25 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
26 |
import java.io.ByteArrayOutputStream; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
27 |
import java.io.IOException; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
28 |
import java.io.OutputStream; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
29 |
import java.io.PrintWriter; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
30 |
import java.util.ArrayList; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
31 |
import java.util.Arrays; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
32 |
import java.util.Collections; |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
33 |
import java.util.LinkedList; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
34 |
import java.util.List; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
35 |
import java.util.concurrent.TimeUnit; |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
36 |
import java.util.concurrent.TimeoutException; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
37 |
import java.util.regex.Matcher; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
38 |
import java.util.regex.Pattern; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
39 |
import java.util.stream.Collectors; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
40 |
import jdk.test.lib.JDKToolFinder; |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
41 |
import jdk.test.lib.process.ProcessTools; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
42 |
import jdk.test.lib.process.StreamPumper; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
43 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
44 |
public class Jdb { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
45 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
46 |
public static class LaunchOptions { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
47 |
public final String debuggeeClass; |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
48 |
public final List<String> debuggeeOptions = new LinkedList<>(); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
49 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
50 |
public LaunchOptions(String debuggeeClass) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
51 |
this.debuggeeClass = debuggeeClass; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
52 |
} |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
53 |
public LaunchOptions addDebuggeeOption(String option) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
54 |
debuggeeOptions.add(option); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
55 |
return this; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
56 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
57 |
public LaunchOptions addDebuggeeOptions(String[] options) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
58 |
debuggeeOptions.addAll(Arrays.asList(options)); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
59 |
return this; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
60 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
61 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
62 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
63 |
public static Jdb launchLocal(LaunchOptions options) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
64 |
return new Jdb(options); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
65 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
66 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
67 |
public static Jdb launchLocal(String debuggeeClass) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
68 |
return new Jdb(new LaunchOptions(debuggeeClass)); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
69 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
70 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
71 |
public Jdb(LaunchOptions options) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
72 |
/* run debuggee as: |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
73 |
java -agentlib:jdwp=transport=dt_socket,address=0,server=n,suspend=y <debuggeeClass> |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
74 |
it reports something like : Listening for transport dt_socket at address: 60810 |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
75 |
after that connect jdb by: |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
76 |
jdb -connect com.sun.jdi.SocketAttach:port=60810 |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
77 |
*/ |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
78 |
// launch debuggee |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
79 |
List<String> debuggeeArgs = new LinkedList<>(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
80 |
// specify address=0 to automatically select free port |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
81 |
debuggeeArgs.add("-agentlib:jdwp=transport=dt_socket,address=0,server=y,suspend=y"); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
82 |
debuggeeArgs.addAll(options.debuggeeOptions); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
83 |
debuggeeArgs.add(options.debuggeeClass); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
84 |
ProcessBuilder pbDebuggee = ProcessTools.createJavaProcessBuilder(true, debuggeeArgs.toArray(new String[0])); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
85 |
|
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
86 |
// debuggeeListen[0] - transport, debuggeeListen[1] - address |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
87 |
String[] debuggeeListen = new String[2]; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
88 |
Pattern listenRegexp = Pattern.compile("Listening for transport \\b(.+)\\b at address: \\b(\\d+)\\b"); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
89 |
try { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
90 |
debuggee = ProcessTools.startProcess("debuggee", pbDebuggee, |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
91 |
s -> debuggeeOutput.add(s), // output consumer |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
92 |
s -> { // warm-up predicate |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
93 |
Matcher m = listenRegexp.matcher(s); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
94 |
if (!m.matches()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
95 |
return false; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
96 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
97 |
debuggeeListen[0] = m.group(1); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
98 |
debuggeeListen[1] = m.group(2); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
99 |
return true; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
100 |
}, |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
101 |
30, TimeUnit.SECONDS); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
102 |
} catch (IOException | InterruptedException | TimeoutException ex) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
103 |
throw new RuntimeException("failed to launch debuggee", ex); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
104 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
105 |
|
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
106 |
// launch jdb |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
107 |
try { |
51493
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
108 |
ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb")); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
109 |
pb.command().add("-connect"); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
110 |
pb.command().add("com.sun.jdi.SocketAttach:port=" + debuggeeListen[1]); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
111 |
System.out.println("Launching jdb:" + pb.command().stream().collect(Collectors.joining(" "))); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
112 |
try { |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
113 |
jdb = pb.start(); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
114 |
} catch (IOException ex) { |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
115 |
throw new RuntimeException("failed to launch pdb", ex); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
116 |
} |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
117 |
StreamPumper stdout = new StreamPumper(jdb.getInputStream()); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
118 |
StreamPumper stderr = new StreamPumper(jdb.getErrorStream()); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
119 |
|
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
120 |
stdout.addPump(new StreamPumper.StreamPump(outputHandler)); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
121 |
stderr.addPump(new StreamPumper.StreamPump(outputHandler)); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
122 |
|
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
123 |
stdout.process(); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
124 |
stderr.process(); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
125 |
|
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
126 |
inputWriter = new PrintWriter(jdb.getOutputStream(), true); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
127 |
} catch (Throwable ex) { |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
128 |
// terminate debuggee if something went wrong |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
129 |
debuggee.destroy(); |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
130 |
throw ex; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
131 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
132 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
133 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
134 |
private final Process jdb; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
135 |
private final Process debuggee; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
136 |
private final OutputHandler outputHandler = new OutputHandler(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
137 |
private final PrintWriter inputWriter; |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
138 |
// contains all jdb output (to be used by getJdbOutput()) |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
139 |
private final List<String> jdbOutput = new LinkedList<>(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
140 |
private final List<String> debuggeeOutput = new LinkedList<>(); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
141 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
142 |
private static final String lineSeparator = System.getProperty("line.separator"); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
143 |
// wait time before check jdb output (in ms) |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
144 |
private static long sleepTime = 1000; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
145 |
// max time to wait for jdb output (in ms) |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
146 |
private static long timeout = 60000; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
147 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
148 |
// jdb prompt when debuggee is not started nor suspended after breakpoint |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
149 |
public static final String SIMPLE_PROMPT = "> "; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
150 |
// pattern for message of a breakpoint hit |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
151 |
public static final String BREAKPOINT_HIT = "Breakpoint hit:"; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
152 |
// pattern for message of an application exit |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
153 |
public static final String APPLICATION_EXIT = "The application exited"; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
154 |
// pattern for message of an application disconnect |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
155 |
public static final String APPLICATION_DISCONNECTED = "The application has been disconnected"; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
156 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
157 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
158 |
// waits until the process shutdown or crash |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
159 |
public boolean waitFor(long timeout, TimeUnit unit) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
160 |
try { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
161 |
return jdb.waitFor(timeout, unit); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
162 |
} catch (InterruptedException e) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
163 |
return false; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
164 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
165 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
166 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
167 |
public void shutdown() { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
168 |
// shutdown jdb |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
169 |
if (jdb.isAlive()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
170 |
try { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
171 |
quit(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
172 |
// wait some time after the command for the process termination |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
173 |
waitFor(10, TimeUnit.SECONDS); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
174 |
} finally { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
175 |
if (jdb.isAlive()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
176 |
jdb.destroy(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
177 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
178 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
179 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
180 |
// shutdown debuggee |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
181 |
if (debuggee.isAlive()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
182 |
try { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
183 |
debuggee.waitFor(10, TimeUnit.SECONDS); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
184 |
} catch (InterruptedException e) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
185 |
// ignore |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
186 |
} finally { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
187 |
if (debuggee.isAlive()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
188 |
debuggee.destroy(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
189 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
190 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
191 |
} |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
192 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
193 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
194 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
195 |
// waits until string {@pattern} appears in the jdb output, within the last {@code lines} lines. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
196 |
/* Comment from original /test/jdk/com/sun/jdi/ShellScaffold.sh |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
197 |
# Now we have to wait for the next jdb prompt. We wait for a pattern |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
198 |
# to appear in the last line of jdb output. Normally, the prompt is |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
199 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
200 |
# 1) ^main[89] @ |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
201 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
202 |
# where ^ means start of line, and @ means end of file with no end of line |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
203 |
# and 89 is the current command counter. But we have complications e.g., |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
204 |
# the following jdb output can appear: |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
205 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
206 |
# 2) a[89] = 10 |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
207 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
208 |
# The above form is an array assignment and not a prompt. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
209 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
210 |
# 3) ^main[89] main[89] ... |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
211 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
212 |
# This occurs if the next cmd is one that causes no jdb output, e.g., |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
213 |
# 'trace methods'. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
214 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
215 |
# 4) ^main[89] [main[89]] .... > @ |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
216 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
217 |
# jdb prints a > as a prompt after something like a cont. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
218 |
# Thus, even though the above is the last 'line' in the file, it |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
219 |
# isn't the next prompt we are waiting for after the cont completes. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
220 |
# HOWEVER, sometimes we see this for a cont command: |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
221 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
222 |
# ^main[89] $ |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
223 |
# <lines output for hitting a bkpt> |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
224 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
225 |
# 5) ^main[89] > @ |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
226 |
# |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
227 |
# i.e., the > prompt comes out AFTER the prompt we we need to wait for. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
228 |
*/ |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
229 |
// compile regexp once |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
230 |
private final String promptPattern = "[a-zA-Z0-9_-][a-zA-Z0-9_-]*\\[[1-9][0-9]*\\] [ >]*$"; |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
231 |
private final Pattern promptRegexp = Pattern.compile(promptPattern); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
232 |
public List<String> waitForPrompt(int lines, boolean allowExit) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
233 |
long startTime = System.currentTimeMillis(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
234 |
while (System.currentTimeMillis() - startTime < timeout) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
235 |
try { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
236 |
Thread.sleep(sleepTime); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
237 |
} catch (InterruptedException e) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
238 |
// ignore |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
239 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
240 |
synchronized (outputHandler) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
241 |
if (!outputHandler.updated()) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
242 |
try { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
243 |
outputHandler.wait(sleepTime); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
244 |
} catch (InterruptedException e) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
245 |
// ignore |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
246 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
247 |
} else { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
248 |
// if something appeared in the jdb output, reset the timeout |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
249 |
startTime = System.currentTimeMillis(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
250 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
251 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
252 |
List<String> reply = outputHandler.get(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
253 |
for (String line: reply.subList(Math.max(0, reply.size() - lines), reply.size())) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
254 |
if (promptRegexp.matcher(line).find()) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
255 |
logJdb(reply); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
256 |
return outputHandler.reset(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
257 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
258 |
} |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
259 |
if (!jdb.isAlive()) { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
260 |
// ensure we get the whole output |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
261 |
reply = outputHandler.reset(); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
262 |
logJdb(reply); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
263 |
if (!allowExit) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
264 |
throw new RuntimeException("waitForPrompt timed out after " + (timeout/1000) |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
265 |
+ " seconds, looking for '" + promptPattern + "', in " + lines + " lines"); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
266 |
} |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
267 |
return reply; |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
268 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
269 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
270 |
// timeout |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
271 |
logJdb(outputHandler.get()); |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
272 |
throw new RuntimeException("waitForPrompt timed out after " + (timeout/1000) |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
273 |
+ " seconds, looking for '" + promptPattern + "', in " + lines + " lines"); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
274 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
275 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
276 |
public List<String> command(JdbCommand cmd) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
277 |
if (!jdb.isAlive()) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
278 |
if (cmd.allowExit) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
279 |
// return remaining output |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
280 |
return outputHandler.reset(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
281 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
282 |
throw new RuntimeException("Attempt to send command '" + cmd.cmd + "' to terminated jdb"); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
283 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
284 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
285 |
System.out.println("> " + cmd.cmd); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
286 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
287 |
inputWriter.println(cmd.cmd); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
288 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
289 |
if (inputWriter.checkError()) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
290 |
throw new RuntimeException("Unexpected IO error while writing command '" + cmd.cmd + "' to jdb stdin stream"); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
291 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
292 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
293 |
return waitForPrompt(1, cmd.allowExit); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
294 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
295 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
296 |
public List<String> command(String cmd) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
297 |
return command(new JdbCommand(cmd)); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
298 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
299 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
300 |
// sends "cont" command up to maxTimes until debuggee exit |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
301 |
public void contToExit(int maxTimes) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
302 |
boolean exited = false; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
303 |
JdbCommand cont = JdbCommand.cont().allowExit(); |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
304 |
for (int i = 0; i < maxTimes && jdb.isAlive(); i++) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
305 |
String reply = command(cont).stream().collect(Collectors.joining(lineSeparator)); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
306 |
if (reply.contains(APPLICATION_EXIT)) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
307 |
exited = true; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
308 |
break; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
309 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
310 |
} |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
311 |
if (!exited && jdb.isAlive()) { |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
312 |
throw new RuntimeException("Debuggee did not exit after " + maxTimes + " <cont> commands"); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
313 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
314 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
315 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
316 |
// quits jdb by using "quit" command |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
317 |
public void quit() { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
318 |
command(JdbCommand.quit()); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
319 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
320 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
321 |
private void log(String s) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
322 |
System.out.println(s); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
323 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
324 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
325 |
private void logJdb(List<String> reply) { |
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
326 |
jdbOutput.addAll(reply); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
327 |
reply.forEach(s -> System.out.println("[jdb] " + s)); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
328 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
329 |
|
51424
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
330 |
// returns the whole jdb output as a string |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
331 |
public String getJdbOutput() { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
332 |
return jdbOutput.stream().collect(Collectors.joining(lineSeparator)); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
333 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
334 |
|
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
335 |
// returns the whole debuggee output as a string |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
336 |
public String getDebuggeeOutput() { |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
337 |
return debuggeeOutput.stream().collect(Collectors.joining(lineSeparator)); |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
338 |
} |
083e731da31a
8209517: com/sun/jdi/BreakpointWithFullGC.java fails with timeout
amenkov
parents:
51402
diff
changeset
|
339 |
|
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
340 |
// handler for out/err of the pdb process |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
341 |
private class OutputHandler extends OutputStream { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
342 |
// there are 2 buffers: |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
343 |
// outStream - data from the process stdout/stderr after last get() call |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
344 |
// cachedData - data collected at get(), cleared by reset() |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
345 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
346 |
private final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
347 |
// if the last line in the reply had EOL, the list's last element is empty |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
348 |
private final List<String> cachedData = new ArrayList<>(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
349 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
350 |
@Override |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
351 |
public synchronized void write(int b) throws IOException { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
352 |
outStream.write((byte)(b & 0xFF)); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
353 |
notifyAll(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
354 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
355 |
@Override |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
356 |
public synchronized void write(byte b[], int off, int len) throws IOException { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
357 |
outStream.write(b, off, len); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
358 |
notifyAll(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
359 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
360 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
361 |
// gets output after the last {@ reset}. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
362 |
// returned data becomes invalid after {@reset}. |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
363 |
public synchronized List<String> get() { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
364 |
if (updated()) { |
51493
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
365 |
// we don't want to discard empty lines |
6b5f3f5fd63c
8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC
amenkov
parents:
51424
diff
changeset
|
366 |
String[] newLines = outStream.toString().split("\\R", -1); |
51402
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
367 |
if (!cachedData.isEmpty()) { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
368 |
// concat the last line if previous data had no EOL |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
369 |
newLines[0] = cachedData.remove(cachedData.size()-1) + newLines[0]; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
370 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
371 |
cachedData.addAll(Arrays.asList(newLines)); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
372 |
outStream.reset(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
373 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
374 |
return Collections.unmodifiableList(cachedData); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
375 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
376 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
377 |
// clears last replay (does not touch replyStream) |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
378 |
// returns list as the last get() |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
379 |
public synchronized List<String> reset() { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
380 |
List<String> result = new ArrayList<>(cachedData); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
381 |
cachedData.clear(); |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
382 |
return result; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
383 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
384 |
|
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
385 |
// tests if there are some new data after the last lastReply() call |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
386 |
public synchronized boolean updated() { |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
387 |
return outStream.size() > 0; |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
388 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
389 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
390 |
} |
bfdebb29b1e5
8209109: [TEST] rewrite com/sun/jdi shell tests to java version - step1
amenkov
parents:
diff
changeset
|
391 |