Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import org.jackhuang.hmcl.java.JavaInfo;
import org.jackhuang.hmcl.util.logging.Logger;
import org.jackhuang.hmcl.util.StringUtils;
import org.jackhuang.hmcl.util.platform.OperatingSystem;
Expand Down Expand Up @@ -128,7 +129,20 @@ public static void writeDumpHeadKeyValueTo(String key, String value, Writer writ
}

private static void writeDumpBodyTo(VirtualMachine vm, Writer writer) throws IOException {
execute(vm, "Thread.print -e -l", writer);
int vmVersion = -1;

try {
if (vm.getSystemProperties().get("java.version") instanceof String javaVersion)
vmVersion = JavaInfo.parseVersion(javaVersion);
} catch (Throwable e) {
LOG.warning("Failed to get VM system properties", e);
}

if (vmVersion >= 11)
execute(vm, "Thread.print -e -l", writer);
else
execute(vm, "Thread.print -l", writer);

}

private static VirtualMachine attachVM(String lvmid, Writer writer) throws IOException, InterruptedException {
Expand Down
Loading