This commit is contained in:
Jesper Wilhelmsson 2022-12-25 01:56:28 +00:00
commit 19373b2ff0
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ public class TestJVMCrash {
public static void main(String... args) throws Exception {
int id = 1;
while (true) {
try (TestProcess process = new TestProcess("crash-application-" + id++)) {
try (TestProcess process = new TestProcess("crash-application-" + id++, false /* createCore */)) {
AtomicInteger eventCounter = new AtomicInteger();
try (EventStream es = EventStream.openRepository(process.getRepository())) {
// Start from first event in repository

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -54,11 +54,16 @@ public final class TestProcess implements AutoCloseable {
private final Path path;
public TestProcess(String name) throws IOException {
this(name, true /* createCore */);
}
public TestProcess(String name, boolean createCore) throws IOException {
this.path = Paths.get("action-" + System.currentTimeMillis()).toAbsolutePath();
String[] args = {
"--add-exports",
"java.base/jdk.internal.misc=ALL-UNNAMED",
"-XX:StartFlightRecording:settings=none",
"-XX:" + (createCore ? "+" : "-") + "CreateCoredumpOnCrash",
TestProcess.class.getName(), path.toString()
};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);