8209605: com/sun/jdi/BreakpointWithFullGC.java fails with ZGC

Reviewed-by: sspitsyn, dholmes
This commit is contained in:
Alex Menkov 2018-08-22 10:28:34 -07:00
parent f1553a5f0f
commit 1b39447545
4 changed files with 30 additions and 28 deletions

@ -836,8 +836,6 @@ tools/pack200/CommandLineTests.java 8059906 generic-
com/sun/jdi/BasicJDWPConnectionTest.java 8195703 generic-all
com/sun/jdi/BreakpointWithFullGC.java 8209605 generic-all
com/sun/jdi/RedefineImplementor.sh 8004127 generic-all
com/sun/jdi/JdbExprTest.sh 8203393 solaris-all

@ -72,9 +72,8 @@ public class BreakpointWithFullGC extends JdbTest {
}
private static final String DEBUGGEE_CLASS = BreakpointWithFullGCTarg.class.getName();
// Hijacking the mode parameter to make sure we use a small amount
// of memory and can see what GC is doing.
private static final String[] DEBUGGEE_OPTIONS = {"-Xmx32m", "-verbose:gc"};
// We don't specify "-Xmx" for debuggee as we have full GCs with any value.
private static final String[] DEBUGGEE_OPTIONS = {"-verbose:gc"};
@Override
protected void runCases() {
@ -99,9 +98,6 @@ public class BreakpointWithFullGC extends JdbTest {
// make sure we hit the last breakpoint
.stdoutShouldMatch("System\\..*end of test");
new OutputAnalyzer(jdb.getDebuggeeOutput())
// make sure we had at least one full GC
// Prior to JDK9-B95, the pattern was 'Full GC'
.stdoutShouldContain("Pause Full (System.gc())")
// check for error message due to thread ID change
.stderrShouldNotContain("Exception in thread \"event-handler\" java.lang.NullPointerException");
}

@ -104,26 +104,31 @@ public class Jdb {
}
// launch jdb
ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
pb.command().add("-connect");
pb.command().add("com.sun.jdi.SocketAttach:port=" + debuggeeListen[1]);
System.out.println("Launching jdb:" + pb.command().stream().collect(Collectors.joining(" ")));
try {
jdb = pb.start();
} catch (IOException ex) {
throw new RuntimeException("failed to launch pdb", ex);
ProcessBuilder pb = new ProcessBuilder(JDKToolFinder.getTestJDKTool("jdb"));
pb.command().add("-connect");
pb.command().add("com.sun.jdi.SocketAttach:port=" + debuggeeListen[1]);
System.out.println("Launching jdb:" + pb.command().stream().collect(Collectors.joining(" ")));
try {
jdb = pb.start();
} catch (IOException ex) {
throw new RuntimeException("failed to launch pdb", ex);
}
StreamPumper stdout = new StreamPumper(jdb.getInputStream());
StreamPumper stderr = new StreamPumper(jdb.getErrorStream());
stdout.addPump(new StreamPumper.StreamPump(outputHandler));
stderr.addPump(new StreamPumper.StreamPump(outputHandler));
stdout.process();
stderr.process();
inputWriter = new PrintWriter(jdb.getOutputStream(), true);
} catch (Throwable ex) {
// terminate debuggee if something went wrong
debuggee.destroy();
throw ex;
}
StreamPumper stdout = new StreamPumper(jdb.getInputStream());
StreamPumper stderr = new StreamPumper(jdb.getErrorStream());
stdout.addPump(new StreamPumper.StreamPump(outputHandler));
stderr.addPump(new StreamPumper.StreamPump(outputHandler));
stdout.process();
stderr.process();
inputWriter = new PrintWriter(jdb.getOutputStream(), true);
}
private final Process jdb;
@ -357,7 +362,8 @@ public class Jdb {
// returned data becomes invalid after {@reset}.
public synchronized List<String> get() {
if (updated()) {
String[] newLines = outStream.toString().split(lineSeparator);
// we don't want to discard empty lines
String[] newLines = outStream.toString().split("\\R", -1);
if (!cachedData.isEmpty()) {
// concat the last line if previous data had no EOL
newLines[0] = cachedData.remove(cachedData.size()-1) + newLines[0];

@ -63,7 +63,9 @@ public abstract class JdbTest {
protected abstract void runCases();
protected void shutdown() {
jdb.shutdown();
if (jdb != null) {
jdb.shutdown();
}
}
protected static final String lineSeparator = System.getProperty("line.separator");