8251848: JMap.histo() and JMap.dump() should parse sub-arguments similarly

Update JMap histo/dump parsing code

Reviewed-by: sspitsyn, phh
This commit is contained in:
Lin Zang 2020-08-24 13:47:33 -07:00
parent 8ce2053723
commit 58a3e40a5c

View File

@ -181,7 +181,7 @@ public class JMap {
} else if (subopt.startsWith("file=")) {
filename = parseFileName(subopt);
if (filename == null) {
System.err.println("Fail: invalid option or no file name '" + subopt +"'");
System.err.println("Fail: invalid option or no file name '" + subopt + "'");
usage(1);
}
} else if (subopt.startsWith("parallel=")) {
@ -218,6 +218,10 @@ public class JMap {
liveopt = "-live";
} else if (subopt.startsWith("file=")) {
filename = parseFileName(subopt);
if (filename == null) {
System.err.println("Fail: invalid option or no file name '" + subopt + "'");
usage(1);
}
} else if (subopt.equals("format=b")) {
// ignore format (not needed at this time)
} else {
@ -231,6 +235,8 @@ public class JMap {
usage(1);
}
System.out.flush();
// dumpHeap is not the same as jcmd GC.heap_dump
executeCommandForPid(pid, "dumpheap", filename, liveopt);
}