8237250: pmap and pstack should do a better of making it clear that they are not supported on Mac OS X

Reviewed-by: amenkov, sspitsyn
This commit is contained in:
Chris Plummer 2020-04-13 16:30:11 -07:00
parent a46f4bfa95
commit 4a09f31eff
4 changed files with 26 additions and 9 deletions
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools
test/hotspot/jtreg/serviceability/sa

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -28,6 +28,7 @@ import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.debugger.cdbg.*;
import sun.jvm.hotspot.utilities.PlatformInfo;
public class PMap extends Tool {
@ -53,6 +54,11 @@ public class PMap extends Tool {
}
public void run(PrintStream out, Debugger dbg) {
if (PlatformInfo.getOS().equals("darwin")) {
out.println("Not available on Mac OS X");
return;
}
CDebugger cdbg = dbg.getCDebugger();
if (cdbg != null) {
List l = cdbg.getLoadObjectList();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -60,7 +60,7 @@ public class PStack extends Tool {
public void run(PrintStream out, Debugger dbg) {
if (PlatformInfo.getOS().equals("darwin")) {
out.println("Not available on Darwin");
out.println("Not available on Mac OS X");
return;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, 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
@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
/**
@ -34,7 +35,6 @@ import jtreg.SkippedException;
* @summary Test clhsdb pmap command
* @requires vm.hasSA
* @library /test/lib
* @requires os.family != "mac"
* @run main/othervm ClhsdbPmap
*/
@ -52,8 +52,13 @@ public class ClhsdbPmap {
List<String> cmds = List.of("pmap");
Map<String, List<String>> expStrMap = new HashMap<>();
expStrMap.put("pmap",
if (Platform.isOSX()) {
expStrMap.put("pmap",
List.of("Not available on Mac OS X"));
} else {
expStrMap.put("pmap",
List.of("jvm", "java", "net", "nio", "jimage", "zip"));
}
test.run(theApp.getPid(), cmds, expStrMap, null);
} catch (SkippedException se) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, 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
@ -26,13 +26,14 @@ import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jtreg.SkippedException;
/**
* @test
* @bug 8190198
* @summary Test clhsdb pstack command
* @requires vm.hasSA & os.family != "mac"
* @requires vm.hasSA
* @library /test/lib
* @run main/othervm ClhsdbPstack
*/
@ -51,11 +52,16 @@ public class ClhsdbPstack {
List<String> cmds = List.of("pstack -v");
Map<String, List<String>> expStrMap = new HashMap<>();
expStrMap.put("pstack -v", List.of(
if (Platform.isOSX()) {
expStrMap.put("pstack -v", List.of(
"Not available on Mac OS X"));
} else {
expStrMap.put("pstack -v", List.of(
"No deadlocks found", "Common-Cleaner",
"Signal Dispatcher", "CompilerThread",
"Sweeper thread", "Service Thread",
"Reference Handler", "Finalizer", "main"));
}
test.run(theApp.getPid(), cmds, expStrMap, null);
} catch (SkippedException se) {