8155091: Remove SA related functions from tmtools
Remove options that enables support for non-cooperative mode Reviewed-by: alanb, mchung, sla
This commit is contained in:
parent
8b0b5c0fc4
commit
ae4d032d41
@ -258,7 +258,7 @@ public abstract class HotSpotVirtualMachine extends VirtualMachine {
|
|||||||
/*
|
/*
|
||||||
* Convenience method for simple commands
|
* Convenience method for simple commands
|
||||||
*/
|
*/
|
||||||
private InputStream executeCommand(String cmd, Object ... args) throws IOException {
|
public InputStream executeCommand(String cmd, Object ... args) throws IOException {
|
||||||
try {
|
try {
|
||||||
return execute(cmd, args);
|
return execute(cmd, args);
|
||||||
} catch (AgentLoadException x) {
|
} catch (AgentLoadException x) {
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package jdk.internal.vm.agent.spi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Service interface for jdk.hotspot.agent to provide the tools that
|
|
||||||
* jstack, jmap, jinfo will invoke, if present.
|
|
||||||
*/
|
|
||||||
public interface ToolProvider {
|
|
||||||
/**
|
|
||||||
* Returns the name of the tool provider
|
|
||||||
*/
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoke the tool provider with the given arguments
|
|
||||||
*/
|
|
||||||
void run(String... arguments);
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package jdk.internal.vm.agent.spi;
|
|
||||||
|
|
||||||
import java.lang.reflect.Layer;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.ServiceLoader;
|
|
||||||
|
|
||||||
public final class ToolProviderFinder {
|
|
||||||
private static final Map<String, ToolProvider> providers = init();
|
|
||||||
|
|
||||||
public static ToolProvider find(String name) {
|
|
||||||
return providers.get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map<String, ToolProvider> init() {
|
|
||||||
Map<String, ToolProvider> providers = new HashMap<>();
|
|
||||||
ServiceLoader.load(Layer.boot(), ToolProvider.class)
|
|
||||||
.forEach(p -> providers.putIfAbsent(p.getName(), p));
|
|
||||||
return providers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -26,9 +26,4 @@
|
|||||||
module jdk.jcmd {
|
module jdk.jcmd {
|
||||||
requires jdk.attach;
|
requires jdk.attach;
|
||||||
requires jdk.jvmstat;
|
requires jdk.jvmstat;
|
||||||
|
|
||||||
exports jdk.internal.vm.agent.spi to jdk.hotspot.agent;
|
|
||||||
|
|
||||||
uses jdk.internal.vm.agent.spi.ToolProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,6 @@ import java.io.InputStream;
|
|||||||
import com.sun.tools.attach.VirtualMachine;
|
import com.sun.tools.attach.VirtualMachine;
|
||||||
|
|
||||||
import sun.tools.attach.HotSpotVirtualMachine;
|
import sun.tools.attach.HotSpotVirtualMachine;
|
||||||
import jdk.internal.vm.agent.spi.ToolProvider;
|
|
||||||
import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class is the main class for the JInfo utility. It parses its arguments
|
* This class is the main class for the JInfo utility. It parses its arguments
|
||||||
@ -41,155 +39,73 @@ import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|||||||
* or an SA tool.
|
* or an SA tool.
|
||||||
*/
|
*/
|
||||||
final public class JInfo {
|
final public class JInfo {
|
||||||
private static final String SA_JINFO_TOOL_NAME = "jinfo";
|
|
||||||
private boolean useSA = false;
|
|
||||||
private String[] args = null;
|
|
||||||
|
|
||||||
private JInfo(String[] args) throws IllegalArgumentException {
|
|
||||||
if (args.length == 0) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
|
|
||||||
int argCopyIndex = 0;
|
|
||||||
// First determine if we should launch SA or not
|
|
||||||
if (args[0].equals("-F")) {
|
|
||||||
// delete the -F
|
|
||||||
argCopyIndex = 1;
|
|
||||||
useSA = true;
|
|
||||||
} else if (args[0].equals("-flags")
|
|
||||||
|| args[0].equals("-sysprops"))
|
|
||||||
{
|
|
||||||
if (args.length == 2) {
|
|
||||||
if (!isPid(args[1])) {
|
|
||||||
// If args[1] doesn't parse to a number then
|
|
||||||
// it must be the SA debug server
|
|
||||||
// (otherwise it is the pid)
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
} else if (args.length == 3) {
|
|
||||||
// arguments include an executable and a core file
|
|
||||||
useSA = true;
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
} else if (!args[0].startsWith("-")) {
|
|
||||||
if (args.length == 2) {
|
|
||||||
// the only arguments are an executable and a core file
|
|
||||||
useSA = true;
|
|
||||||
} else if (args.length == 1) {
|
|
||||||
if (!isPid(args[0])) {
|
|
||||||
// The only argument is not a PID; it must be SA debug
|
|
||||||
// server
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
} else if (args[0].equals("-h") || args[0].equals("-help")) {
|
|
||||||
if (args.length > 1) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
} else if (args[0].equals("-flag")) {
|
|
||||||
if (args.length == 3) {
|
|
||||||
if (!isPid(args[2])) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.args = Arrays.copyOfRange(args, argCopyIndex, args.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("fallthrough")
|
|
||||||
private void execute() throws Exception {
|
|
||||||
if (args[0].equals("-h")
|
|
||||||
|| args[0].equals("-help")) {
|
|
||||||
usage(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useSA) {
|
|
||||||
// SA only supports -flags or -sysprops
|
|
||||||
if (args[0].startsWith("-")) {
|
|
||||||
if (!(args[0].equals("-flags") || args[0].equals("-sysprops"))) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// invoke SA which does it's own argument parsing
|
|
||||||
runTool();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Now we can parse arguments for the non-SA case
|
|
||||||
String pid = null;
|
|
||||||
|
|
||||||
switch(args[0]) {
|
|
||||||
case "-flag":
|
|
||||||
if (args.length != 3) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
String option = args[1];
|
|
||||||
pid = args[2];
|
|
||||||
flag(pid, option);
|
|
||||||
break;
|
|
||||||
case "-flags":
|
|
||||||
if (args.length != 2) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
pid = args[1];
|
|
||||||
flags(pid);
|
|
||||||
break;
|
|
||||||
case "-sysprops":
|
|
||||||
if (args.length != 2) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
pid = args[1];
|
|
||||||
sysprops(pid);
|
|
||||||
break;
|
|
||||||
case "-help":
|
|
||||||
case "-h":
|
|
||||||
usage(0);
|
|
||||||
// Fall through
|
|
||||||
default:
|
|
||||||
if (args.length == 1) {
|
|
||||||
// no flags specified, we do -sysprops and -flags
|
|
||||||
pid = args[0];
|
|
||||||
sysprops(pid);
|
|
||||||
System.out.println();
|
|
||||||
flags(pid);
|
|
||||||
System.out.println();
|
|
||||||
commandLine(pid);
|
|
||||||
} else {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
JInfo jinfo = null;
|
if (args.length == 0) {
|
||||||
try {
|
usage(1); // no arguments
|
||||||
jinfo = new JInfo(args);
|
}
|
||||||
jinfo.execute();
|
checkForUnsupportedOptions(args);
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
usage(1);
|
boolean doFlag = false;
|
||||||
|
boolean doFlags = false;
|
||||||
|
boolean doSysprops = false;
|
||||||
|
|
||||||
|
// Parse the options (arguments starting with "-" )
|
||||||
|
int optionCount = 0;
|
||||||
|
while (optionCount < args.length) {
|
||||||
|
String arg = args[optionCount];
|
||||||
|
if (!arg.startsWith("-")) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
optionCount++;
|
||||||
|
|
||||||
|
if (arg.equals("-help") || arg.equals("-h")) {
|
||||||
|
usage(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg.equals("-flag")) {
|
||||||
|
doFlag = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg.equals("-flags")) {
|
||||||
|
doFlags = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arg.equals("-sysprops")) {
|
||||||
|
doSysprops = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPid(String arg) {
|
// Next we check the parameter count. -flag allows extra parameters
|
||||||
return arg.matches("[0-9]+");
|
int paramCount = args.length - optionCount;
|
||||||
}
|
if ((doFlag && paramCount != 2) || (paramCount != 1)) {
|
||||||
|
|
||||||
// Invoke SA tool with the given arguments
|
|
||||||
private void runTool() throws Exception {
|
|
||||||
ToolProvider tool = ToolProviderFinder.find(SA_JINFO_TOOL_NAME);
|
|
||||||
if (tool == null) {
|
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
tool.run(args);
|
|
||||||
|
if (!doFlag && !doFlags && !doSysprops) {
|
||||||
|
// Print flags and sysporps if no options given
|
||||||
|
sysprops(args[optionCount]);
|
||||||
|
System.out.println();
|
||||||
|
flags(args[optionCount]);
|
||||||
|
System.out.println();
|
||||||
|
commandLine(args[optionCount]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doFlag) {
|
||||||
|
flag(args[optionCount+1], args[optionCount]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (doFlags) {
|
||||||
|
flags(args[optionCount]);
|
||||||
|
}
|
||||||
|
else if (doSysprops) {
|
||||||
|
sysprops(args[optionCount]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void flag(String pid, String option) throws IOException {
|
private static void flag(String pid, String option) throws IOException {
|
||||||
@ -274,33 +190,39 @@ final public class JInfo {
|
|||||||
vm.detach();
|
vm.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void checkForUnsupportedOptions(String[] args) {
|
||||||
|
// Check arguments for -F, and non-numeric value
|
||||||
|
// and warn the user that SA is not supported anymore
|
||||||
|
|
||||||
|
int paramCount = 0;
|
||||||
|
|
||||||
|
for (String s : args) {
|
||||||
|
if (s.equals("-F")) {
|
||||||
|
SAOptionError("-F option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! s.startsWith("-")) {
|
||||||
|
if (! s.matches("[0-9]+")) {
|
||||||
|
SAOptionError("non PID argument");
|
||||||
|
}
|
||||||
|
paramCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paramCount > 1) {
|
||||||
|
SAOptionError("More than one non-option argument");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SAOptionError(String msg) {
|
||||||
|
System.err.println("Error: " + msg);
|
||||||
|
System.err.println("Cannot connect to core dump or remote debug server. Use jhsdb jinfo instead");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// print usage message
|
// print usage message
|
||||||
private static void usage(int exit) {
|
private static void usage(int exit) {
|
||||||
boolean usageSA = ToolProviderFinder.find(SA_JINFO_TOOL_NAME) != null;
|
|
||||||
|
|
||||||
System.err.println("Usage:");
|
System.err.println("Usage:");
|
||||||
if (usageSA) {
|
|
||||||
System.err.println(" jinfo [option] <pid>");
|
|
||||||
System.err.println(" (to connect to a running process)");
|
|
||||||
System.err.println(" jinfo -F [option] <pid>");
|
|
||||||
System.err.println(" (to connect to a hung process)");
|
|
||||||
System.err.println(" jinfo [option] <executable> <core>");
|
|
||||||
System.err.println(" (to connect to a core file)");
|
|
||||||
System.err.println(" jinfo [option] [server_id@]<remote server IP or hostname>");
|
|
||||||
System.err.println(" (to connect to remote debug server)");
|
|
||||||
System.err.println("");
|
|
||||||
System.err.println("where <option> is one of:");
|
|
||||||
System.err.println(" for running processes:");
|
|
||||||
System.err.println(" -flag <name> to print the value of the named VM flag");
|
|
||||||
System.err.println(" -flag [+|-]<name> to enable or disable the named VM flag");
|
|
||||||
System.err.println(" -flag <name>=<value> to set the named VM flag to the given value");
|
|
||||||
System.err.println(" for running or hung processes and core files:");
|
|
||||||
System.err.println(" -flags to print VM flags");
|
|
||||||
System.err.println(" -sysprops to print Java system properties");
|
|
||||||
System.err.println(" <no option> to print both VM flags and system properties");
|
|
||||||
System.err.println(" -h | -help to print this help message");
|
|
||||||
} else {
|
|
||||||
System.err.println(" jinfo <option> <pid>");
|
System.err.println(" jinfo <option> <pid>");
|
||||||
System.err.println(" (to connect to a running process)");
|
System.err.println(" (to connect to a running process)");
|
||||||
System.err.println("");
|
System.err.println("");
|
||||||
@ -312,8 +234,6 @@ final public class JInfo {
|
|||||||
System.err.println(" -sysprops to print Java system properties");
|
System.err.println(" -sysprops to print Java system properties");
|
||||||
System.err.println(" <no option> to print both VM flags and system properties");
|
System.err.println(" <no option> to print both VM flags and system properties");
|
||||||
System.err.println(" -h | -help to print this help message");
|
System.err.println(" -h | -help to print this help message");
|
||||||
}
|
|
||||||
|
|
||||||
System.exit(exit);
|
System.exit(exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,11 @@ package sun.tools.jmap;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import com.sun.tools.attach.VirtualMachine;
|
import com.sun.tools.attach.VirtualMachine;
|
||||||
import com.sun.tools.attach.AttachNotSupportedException;
|
import com.sun.tools.attach.AttachNotSupportedException;
|
||||||
import sun.tools.attach.HotSpotVirtualMachine;
|
import sun.tools.attach.HotSpotVirtualMachine;
|
||||||
import jdk.internal.vm.agent.spi.ToolProvider;
|
|
||||||
import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class is the main class for the JMap utility. It parses its arguments
|
* This class is the main class for the JMap utility. It parses its arguments
|
||||||
@ -44,34 +43,18 @@ import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|||||||
*/
|
*/
|
||||||
public class JMap {
|
public class JMap {
|
||||||
|
|
||||||
// Options handled by the attach mechanism
|
|
||||||
private static String HISTO_OPTION = "-histo";
|
|
||||||
private static String LIVE_HISTO_OPTION = "-histo:live";
|
|
||||||
private static String DUMP_OPTION_PREFIX = "-dump:";
|
|
||||||
|
|
||||||
// These options imply the use of a SA tool
|
|
||||||
private static String SA_TOOL_OPTIONS =
|
|
||||||
"-heap|-heap:format=b|-clstats|-finalizerinfo";
|
|
||||||
|
|
||||||
// The -F (force) option is currently not passed through to SA
|
|
||||||
private static String FORCE_SA_OPTION = "-F";
|
|
||||||
|
|
||||||
// Default option (if nothing provided)
|
|
||||||
private static String DEFAULT_OPTION = "-pmap";
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
usage(1); // no arguments
|
usage(1); // no arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to indicate if we should use SA
|
checkForUnsupportedOptions(args);
|
||||||
boolean useSA = false;
|
|
||||||
|
|
||||||
// the chosen option (-heap, -dump:*, ... )
|
// the chosen option
|
||||||
String option = null;
|
String option = null;
|
||||||
|
|
||||||
// First iterate over the options (arguments starting with -). There should be
|
// First iterate over the options (arguments starting with -). There should be
|
||||||
// one (but maybe two if -F is also used).
|
// one.
|
||||||
int optionCount = 0;
|
int optionCount = 0;
|
||||||
while (optionCount < args.length) {
|
while (optionCount < args.length) {
|
||||||
String arg = args[optionCount];
|
String arg = args[optionCount];
|
||||||
@ -80,8 +63,6 @@ public class JMap {
|
|||||||
}
|
}
|
||||||
if (arg.equals("-help") || arg.equals("-h")) {
|
if (arg.equals("-help") || arg.equals("-h")) {
|
||||||
usage(0);
|
usage(0);
|
||||||
} else if (arg.equals(FORCE_SA_OPTION)) {
|
|
||||||
useSA = true;
|
|
||||||
} else {
|
} else {
|
||||||
if (option != null) {
|
if (option != null) {
|
||||||
usage(1); // option already specified
|
usage(1); // option already specified
|
||||||
@ -93,211 +74,43 @@ public class JMap {
|
|||||||
|
|
||||||
// if no option provided then use default.
|
// if no option provided then use default.
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
option = DEFAULT_OPTION;
|
usage(0);
|
||||||
}
|
|
||||||
if (option.matches(SA_TOOL_OPTIONS)) {
|
|
||||||
useSA = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next we check the parameter count. For the SA tools there are
|
// Next we check the parameter count.
|
||||||
// one or two parameters. For the built-in -dump option there is
|
|
||||||
// only one parameter (the process-id)
|
|
||||||
int paramCount = args.length - optionCount;
|
int paramCount = args.length - optionCount;
|
||||||
if (paramCount == 0 || paramCount > 2) {
|
if (paramCount != 1) {
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionCount == 0 || paramCount != 1) {
|
|
||||||
useSA = true;
|
|
||||||
} else {
|
|
||||||
// the parameter for the -dump option is a process-id.
|
|
||||||
// If it doesn't parse to a number then it must be SA
|
|
||||||
// debug server
|
|
||||||
if (!args[optionCount].matches("[0-9]+")) {
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// at this point we know if we are executing an SA tool or a built-in
|
|
||||||
// option.
|
|
||||||
|
|
||||||
if (useSA) {
|
|
||||||
// parameters (<pid> or <exe> <core>)
|
|
||||||
String params[] = new String[paramCount];
|
|
||||||
for (int i=optionCount; i<args.length; i++ ){
|
|
||||||
params[i-optionCount] = args[i];
|
|
||||||
}
|
|
||||||
runTool(option, params);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
String pid = args[1];
|
String pid = args[1];
|
||||||
// Here we handle the built-in options
|
// Here we handle the built-in options
|
||||||
// As more options are added we should create an abstract tool class and
|
// As more options are added we should create an abstract tool class and
|
||||||
// have a table to map the options
|
// have a table to map the options
|
||||||
if (option.equals(HISTO_OPTION)) {
|
if (option.equals("-histo")) {
|
||||||
histo(pid, false);
|
histo(pid, "");
|
||||||
} else if (option.equals(LIVE_HISTO_OPTION)) {
|
} else if (option.startsWith("-histo:")) {
|
||||||
histo(pid, true);
|
histo(pid, option.substring("-histo:".length()));
|
||||||
} else if (option.startsWith(DUMP_OPTION_PREFIX)) {
|
} else if (option.startsWith("-dump:")) {
|
||||||
dump(pid, option);
|
dump(pid, option.substring("-dump:".length()));
|
||||||
|
} else if (option.equals("-finalizerinfo")) {
|
||||||
|
executeCommandForPid(pid, "jcmd", "GC.finalizer_info");
|
||||||
|
} else if (option.equals("-clstats")) {
|
||||||
|
executeCommandForPid(pid, "jcmd", "GC.class_stats");
|
||||||
} else {
|
} else {
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Invoke SA tool with the given arguments
|
private static void executeCommandForPid(String pid, String command, Object ... args)
|
||||||
private static void runTool(String option, String args[]) throws Exception {
|
throws AttachNotSupportedException, IOException,
|
||||||
String[][] tools = {
|
UnsupportedEncodingException {
|
||||||
{ "-pmap", "pmap" },
|
VirtualMachine vm = VirtualMachine.attach(pid);
|
||||||
{ "-heap", "heapSummary" },
|
|
||||||
{ "-heap:format=b", "heapDumper" },
|
|
||||||
{ "-histo", "objectHistogram" },
|
|
||||||
{ "-clstats", "classLoaderStats" },
|
|
||||||
{ "-finalizerinfo", "finalizerInfo" },
|
|
||||||
};
|
|
||||||
|
|
||||||
String name = null;
|
// Cast to HotSpotVirtualMachine as this is an
|
||||||
|
// implementation specific method.
|
||||||
// -dump option needs to be handled in a special way
|
HotSpotVirtualMachine hvm = (HotSpotVirtualMachine) vm;
|
||||||
if (option.startsWith(DUMP_OPTION_PREFIX)) {
|
try (InputStream in = hvm.executeCommand(command, args)) {
|
||||||
// first check that the option can be parsed
|
|
||||||
String fn = parseDumpOptions(option);
|
|
||||||
if (fn == null) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// tool for heap dumping
|
|
||||||
name = "heapDumper";
|
|
||||||
|
|
||||||
// HeapDumper -f <file>
|
|
||||||
args = prepend(fn, args);
|
|
||||||
args = prepend("-f", args);
|
|
||||||
} else {
|
|
||||||
int i=0;
|
|
||||||
while (i < tools.length) {
|
|
||||||
if (option.equals(tools[i][0])) {
|
|
||||||
name = tools[i][1];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name == null) {
|
|
||||||
usage(1); // no mapping to tool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tool not available on this platform.
|
|
||||||
ToolProvider tool = ToolProviderFinder.find(name);
|
|
||||||
if (tool == null) {
|
|
||||||
usage(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// invoke the main method with the arguments
|
|
||||||
tool.run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String LIVE_OBJECTS_OPTION = "-live";
|
|
||||||
private static final String ALL_OBJECTS_OPTION = "-all";
|
|
||||||
private static void histo(String pid, boolean live) throws IOException {
|
|
||||||
VirtualMachine vm = attach(pid);
|
|
||||||
InputStream in = ((HotSpotVirtualMachine)vm).
|
|
||||||
heapHisto(live ? LIVE_OBJECTS_OPTION : ALL_OBJECTS_OPTION);
|
|
||||||
drain(vm, in);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void dump(String pid, String options) throws IOException {
|
|
||||||
// parse the options to get the dump filename
|
|
||||||
String filename = parseDumpOptions(options);
|
|
||||||
if (filename == null) {
|
|
||||||
usage(1); // invalid options or no filename
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the canonical path - important to avoid just passing
|
|
||||||
// a "heap.bin" and having the dump created in the target VM
|
|
||||||
// working directory rather than the directory where jmap
|
|
||||||
// is executed.
|
|
||||||
filename = new File(filename).getCanonicalPath();
|
|
||||||
|
|
||||||
// dump live objects only or not
|
|
||||||
boolean live = isDumpLiveObjects(options);
|
|
||||||
|
|
||||||
VirtualMachine vm = attach(pid);
|
|
||||||
System.out.println("Dumping heap to " + filename + " ...");
|
|
||||||
InputStream in = ((HotSpotVirtualMachine)vm).
|
|
||||||
dumpHeap((Object)filename,
|
|
||||||
(live ? LIVE_OBJECTS_OPTION : ALL_OBJECTS_OPTION));
|
|
||||||
drain(vm, in);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse the options to the -dump option. Valid options are format=b and
|
|
||||||
// file=<file>. Returns <file> if provided. Returns null if <file> not
|
|
||||||
// provided, or invalid option.
|
|
||||||
private static String parseDumpOptions(String arg) {
|
|
||||||
assert arg.startsWith(DUMP_OPTION_PREFIX);
|
|
||||||
|
|
||||||
String filename = null;
|
|
||||||
|
|
||||||
// options are separated by comma (,)
|
|
||||||
String options[] = arg.substring(DUMP_OPTION_PREFIX.length()).split(",");
|
|
||||||
|
|
||||||
for (int i=0; i<options.length; i++) {
|
|
||||||
String option = options[i];
|
|
||||||
|
|
||||||
if (option.equals("format=b")) {
|
|
||||||
// ignore format (not needed at this time)
|
|
||||||
} else if (option.equals("live")) {
|
|
||||||
// a valid suboption
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// file=<file> - check that <file> is specified
|
|
||||||
if (option.startsWith("file=")) {
|
|
||||||
filename = option.substring(5);
|
|
||||||
if (filename.length() == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null; // option not recognized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isDumpLiveObjects(String arg) {
|
|
||||||
// options are separated by comma (,)
|
|
||||||
String options[] = arg.substring(DUMP_OPTION_PREFIX.length()).split(",");
|
|
||||||
for (String suboption : options) {
|
|
||||||
if (suboption.equals("live")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attach to <pid>, existing if we fail to attach
|
|
||||||
private static VirtualMachine attach(String pid) {
|
|
||||||
try {
|
|
||||||
return VirtualMachine.attach(pid);
|
|
||||||
} catch (Exception x) {
|
|
||||||
String msg = x.getMessage();
|
|
||||||
if (msg != null) {
|
|
||||||
System.err.println(pid + ": " + msg);
|
|
||||||
} else {
|
|
||||||
x.printStackTrace();
|
|
||||||
}
|
|
||||||
if ((x instanceof AttachNotSupportedException) && haveSA()) {
|
|
||||||
System.err.println("The -F option can be used when the " +
|
|
||||||
"target process is not responding");
|
|
||||||
}
|
|
||||||
System.exit(1);
|
|
||||||
return null; // keep compiler happy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read the stream from the target VM until EOF, then detach
|
|
||||||
private static void drain(VirtualMachine vm, InputStream in) throws IOException {
|
|
||||||
// read to EOF and just print output
|
// read to EOF and just print output
|
||||||
byte b[] = new byte[256];
|
byte b[] = new byte[256];
|
||||||
int n;
|
int n;
|
||||||
@ -308,67 +121,127 @@ public class JMap {
|
|||||||
System.out.print(s);
|
System.out.print(s);
|
||||||
}
|
}
|
||||||
} while (n > 0);
|
} while (n > 0);
|
||||||
in.close();
|
}
|
||||||
vm.detach();
|
vm.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a new string array with arg as the first element
|
private static void histo(String pid, String options)
|
||||||
private static String[] prepend(String arg, String args[]) {
|
throws AttachNotSupportedException, IOException,
|
||||||
String[] newargs = new String[args.length+1];
|
UnsupportedEncodingException {
|
||||||
newargs[0] = arg;
|
String liveopt = "-all";
|
||||||
System.arraycopy(args, 0, newargs, 1, args.length);
|
if (options.equals("") || options.equals("all")) {
|
||||||
return newargs;
|
// pass
|
||||||
|
}
|
||||||
|
else if (options.equals("live")) {
|
||||||
|
liveopt = "-live";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
usage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if SA is available
|
// inspectHeap is not the same as jcmd GC.class_histogram
|
||||||
private static boolean haveSA() {
|
executeCommandForPid(pid, "inspectheap", liveopt);
|
||||||
return ToolProviderFinder.find("heapSummary") != null;
|
}
|
||||||
|
|
||||||
|
private static void dump(String pid, String options)
|
||||||
|
throws AttachNotSupportedException, IOException,
|
||||||
|
UnsupportedEncodingException {
|
||||||
|
|
||||||
|
String subopts[] = options.split(",");
|
||||||
|
String filename = null;
|
||||||
|
String liveopt = "-all";
|
||||||
|
|
||||||
|
for (int i = 0; i < subopts.length; i++) {
|
||||||
|
String subopt = subopts[i];
|
||||||
|
if (subopt.equals("live")) {
|
||||||
|
liveopt = "-live";
|
||||||
|
} else if (subopt.startsWith("file=")) {
|
||||||
|
// file=<file> - check that <file> is specified
|
||||||
|
if (subopt.length() > 5) {
|
||||||
|
filename = subopt.substring(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filename == null) {
|
||||||
|
usage(1); // invalid options or no filename
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the canonical path - important to avoid just passing
|
||||||
|
// a "heap.bin" and having the dump created in the target VM
|
||||||
|
// working directory rather than the directory where jmap
|
||||||
|
// is executed.
|
||||||
|
filename = new File(filename).getCanonicalPath();
|
||||||
|
// dumpHeap is not the same as jcmd GC.heap_dump
|
||||||
|
executeCommandForPid(pid, "dumpheap", filename, liveopt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void checkForUnsupportedOptions(String[] args) {
|
||||||
|
// Check arguments for -F, -m, and non-numeric value
|
||||||
|
// and warn the user that SA is not supported anymore
|
||||||
|
|
||||||
|
int paramCount = 0;
|
||||||
|
|
||||||
|
for (String s : args) {
|
||||||
|
if (s.equals("-F")) {
|
||||||
|
SAOptionError("-F option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.equals("-heap")) {
|
||||||
|
SAOptionError("-heap option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reimplemented using jcmd, output format is different
|
||||||
|
from original one
|
||||||
|
|
||||||
|
if (s.equals("-clstats")) {
|
||||||
|
warnSA("-clstats option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.equals("-finalizerinfo")) {
|
||||||
|
warnSA("-finalizerinfo option used");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! s.startsWith("-")) {
|
||||||
|
if (! s.matches("[0-9]+")) {
|
||||||
|
SAOptionError("non PID argument");
|
||||||
|
}
|
||||||
|
paramCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paramCount > 1) {
|
||||||
|
SAOptionError("More than one non-option argument");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SAOptionError(String msg) {
|
||||||
|
System.err.println("Error: " + msg);
|
||||||
|
System.err.println("Cannot connect to core dump or remote debug server. Use jhsdb jmap instead");
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print usage message
|
// print usage message
|
||||||
private static void usage(int exit) {
|
private static void usage(int exit) {
|
||||||
System.err.println("Usage:");
|
System.err.println("Usage:");
|
||||||
if (haveSA()) {
|
System.err.println(" jmap -clstats <pid>");
|
||||||
System.err.println(" jmap [option] <pid>");
|
System.err.println(" to connect to running process and print class loader statistics");
|
||||||
System.err.println(" (to connect to running process)");
|
System.err.println(" jmap -finalizerinfo <pid>");
|
||||||
System.err.println(" jmap [option] <executable <core>");
|
System.err.println(" to connect to running process and print information on objects awaiting finalization");
|
||||||
System.err.println(" (to connect to a core file)");
|
System.err.println(" jmap -histo[:live] <pid>");
|
||||||
System.err.println(" jmap [option] [server_id@]<remote server IP or hostname>");
|
System.err.println(" to connect to running process and print histogram of java object heap");
|
||||||
System.err.println(" (to connect to remote debug server)");
|
System.err.println(" if the \"live\" suboption is specified, only count live objects");
|
||||||
|
System.err.println(" jmap -dump:<dump-options> <pid>");
|
||||||
|
System.err.println(" to connect to running process and dump java heap");
|
||||||
System.err.println("");
|
System.err.println("");
|
||||||
System.err.println("where <option> is one of:");
|
|
||||||
System.err.println(" <none> to print same info as Solaris pmap");
|
|
||||||
System.err.println(" -heap to print java heap summary");
|
|
||||||
System.err.println(" -histo[:live] to print histogram of java object heap; if the \"live\"");
|
|
||||||
System.err.println(" suboption is specified, only count live objects");
|
|
||||||
System.err.println(" -clstats to print class loader statistics");
|
|
||||||
System.err.println(" -finalizerinfo to print information on objects awaiting finalization");
|
|
||||||
System.err.println(" -dump:<dump-options> to dump java heap in hprof binary format");
|
|
||||||
System.err.println(" dump-options:");
|
System.err.println(" dump-options:");
|
||||||
System.err.println(" live dump only live objects; if not specified,");
|
System.err.println(" live dump only live objects; if not specified,");
|
||||||
System.err.println(" all objects in the heap are dumped.");
|
System.err.println(" all objects in the heap are dumped.");
|
||||||
System.err.println(" format=b binary format");
|
System.err.println(" format=b binary format");
|
||||||
System.err.println(" file=<file> dump heap to <file>");
|
System.err.println(" file=<file> dump heap to <file>");
|
||||||
|
System.err.println("");
|
||||||
System.err.println(" Example: jmap -dump:live,format=b,file=heap.bin <pid>");
|
System.err.println(" Example: jmap -dump:live,format=b,file=heap.bin <pid>");
|
||||||
System.err.println(" -F force. Use with -dump:<dump-options> <pid> or -histo");
|
|
||||||
System.err.println(" to force a heap dump or histogram when <pid> does not");
|
|
||||||
System.err.println(" respond. The \"live\" suboption is not supported");
|
|
||||||
System.err.println(" in this mode.");
|
|
||||||
System.err.println(" -h | -help to print this help message");
|
|
||||||
System.err.println(" -J<flag> to pass <flag> directly to the runtime system");
|
|
||||||
} else {
|
|
||||||
System.err.println(" jmap -histo <pid>");
|
|
||||||
System.err.println(" (to connect to running process and print histogram of java object heap");
|
|
||||||
System.err.println(" jmap -dump:<dump-options> <pid>");
|
|
||||||
System.err.println(" (to connect to running process and dump java heap)");
|
|
||||||
System.err.println("");
|
|
||||||
System.err.println(" dump-options:");
|
|
||||||
System.err.println(" format=b binary default");
|
|
||||||
System.err.println(" file=<file> dump heap to <file>");
|
|
||||||
System.err.println("");
|
|
||||||
System.err.println(" Example: jmap -dump:format=b,file=heap.bin <pid>");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.exit(exit);
|
System.exit(exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,6 @@ import java.io.InputStream;
|
|||||||
import com.sun.tools.attach.VirtualMachine;
|
import com.sun.tools.attach.VirtualMachine;
|
||||||
import com.sun.tools.attach.AttachNotSupportedException;
|
import com.sun.tools.attach.AttachNotSupportedException;
|
||||||
import sun.tools.attach.HotSpotVirtualMachine;
|
import sun.tools.attach.HotSpotVirtualMachine;
|
||||||
import jdk.internal.vm.agent.spi.ToolProvider;
|
|
||||||
import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class is the main class for the JStack utility. It parses its arguments
|
* This class is the main class for the JStack utility. It parses its arguments
|
||||||
@ -39,15 +37,14 @@ import jdk.internal.vm.agent.spi.ToolProviderFinder;
|
|||||||
* obtained the thread dump from a target process using the VM attach mechanism
|
* obtained the thread dump from a target process using the VM attach mechanism
|
||||||
*/
|
*/
|
||||||
public class JStack {
|
public class JStack {
|
||||||
private static final String SA_JSTACK_TOOL_NAME = "jstack";
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
usage(1); // no arguments
|
usage(1); // no arguments
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useSA = false;
|
checkForUnsupportedOptions(args);
|
||||||
boolean mixed = false;
|
|
||||||
boolean locks = false;
|
boolean locks = false;
|
||||||
|
|
||||||
// Parse the options (arguments starting with "-" )
|
// Parse the options (arguments starting with "-" )
|
||||||
@ -60,52 +57,22 @@ public class JStack {
|
|||||||
if (arg.equals("-help") || arg.equals("-h")) {
|
if (arg.equals("-help") || arg.equals("-h")) {
|
||||||
usage(0);
|
usage(0);
|
||||||
}
|
}
|
||||||
else if (arg.equals("-F")) {
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
if (arg.equals("-m")) {
|
|
||||||
mixed = true;
|
|
||||||
} else {
|
|
||||||
if (arg.equals("-l")) {
|
if (arg.equals("-l")) {
|
||||||
locks = true;
|
locks = true;
|
||||||
} else {
|
} else {
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
optionCount++;
|
optionCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mixed stack implies SA tool
|
// Next we check the parameter count.
|
||||||
if (mixed) {
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next we check the parameter count. If there are two parameters
|
|
||||||
// we assume core file and executable so we use SA.
|
|
||||||
int paramCount = args.length - optionCount;
|
int paramCount = args.length - optionCount;
|
||||||
if (paramCount == 0 || paramCount > 2) {
|
if (paramCount != 1) {
|
||||||
usage(1);
|
usage(1);
|
||||||
}
|
}
|
||||||
if (paramCount == 2) {
|
|
||||||
useSA = true;
|
|
||||||
} else {
|
|
||||||
// If we can't parse it as a pid then it must be debug server
|
|
||||||
if (!args[optionCount].matches("[0-9]+")) {
|
|
||||||
useSA = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now execute using the SA JStack tool or the built-in thread dumper
|
|
||||||
if (useSA) {
|
|
||||||
// parameters (<pid> or <exe> <core>
|
|
||||||
String params[] = new String[paramCount];
|
|
||||||
for (int i=optionCount; i<args.length; i++ ){
|
|
||||||
params[i-optionCount] = args[i];
|
|
||||||
}
|
|
||||||
runJStackTool(mixed, locks, params);
|
|
||||||
} else {
|
|
||||||
// pass -l to thread dump operation to get extra lock info
|
// pass -l to thread dump operation to get extra lock info
|
||||||
String pid = args[optionCount];
|
String pid = args[optionCount];
|
||||||
String params[];
|
String params[];
|
||||||
@ -116,30 +83,6 @@ public class JStack {
|
|||||||
}
|
}
|
||||||
runThreadDump(pid, params);
|
runThreadDump(pid, params);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// SA JStack tool
|
|
||||||
private static boolean isAgentToolPresent() {
|
|
||||||
return ToolProviderFinder.find(SA_JSTACK_TOOL_NAME) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void runJStackTool(boolean mixed, boolean locks, String args[]) throws Exception {
|
|
||||||
ToolProvider tool = ToolProviderFinder.find(SA_JSTACK_TOOL_NAME);
|
|
||||||
if (tool == null) {
|
|
||||||
usage(1); // SA not available
|
|
||||||
}
|
|
||||||
|
|
||||||
// JStack tool also takes -m and -l arguments
|
|
||||||
if (mixed) {
|
|
||||||
args = prepend("-m", args);
|
|
||||||
}
|
|
||||||
if (locks) {
|
|
||||||
args = prepend("-l", args);
|
|
||||||
}
|
|
||||||
|
|
||||||
tool.run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Attach to pid and perform a thread dump
|
// Attach to pid and perform a thread dump
|
||||||
private static void runThreadDump(String pid, String args[]) throws Exception {
|
private static void runThreadDump(String pid, String args[]) throws Exception {
|
||||||
@ -153,10 +96,6 @@ public class JStack {
|
|||||||
} else {
|
} else {
|
||||||
x.printStackTrace();
|
x.printStackTrace();
|
||||||
}
|
}
|
||||||
if ((x instanceof AttachNotSupportedException) && isAgentToolPresent()) {
|
|
||||||
System.err.println("The -F option can be used when the target " +
|
|
||||||
"process is not responding");
|
|
||||||
}
|
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,12 +117,38 @@ public class JStack {
|
|||||||
vm.detach();
|
vm.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a new string array with arg as the first element
|
private static void checkForUnsupportedOptions(String[] args) {
|
||||||
private static String[] prepend(String arg, String args[]) {
|
// Check arguments for -F, -m, and non-numeric value
|
||||||
String[] newargs = new String[args.length+1];
|
// and warn the user that SA is not supported anymore
|
||||||
newargs[0] = arg;
|
|
||||||
System.arraycopy(args, 0, newargs, 1, args.length);
|
int paramCount = 0;
|
||||||
return newargs;
|
|
||||||
|
for (String s : args) {
|
||||||
|
if (s.equals("-F")) {
|
||||||
|
SAOptionError("-F option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.equals("-m")) {
|
||||||
|
SAOptionError("-m option used");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! s.startsWith("-")) {
|
||||||
|
if (! s.matches("[0-9]+")) {
|
||||||
|
SAOptionError("non PID argument");
|
||||||
|
}
|
||||||
|
paramCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paramCount > 1) {
|
||||||
|
SAOptionError("More than one non-option argument");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SAOptionError(String msg) {
|
||||||
|
System.err.println("Error: " + msg);
|
||||||
|
System.err.println("Cannot connect to core dump or remote debug server. Use jhsdb jstack instead");
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// print usage message
|
// print usage message
|
||||||
@ -191,25 +156,8 @@ public class JStack {
|
|||||||
System.err.println("Usage:");
|
System.err.println("Usage:");
|
||||||
System.err.println(" jstack [-l] <pid>");
|
System.err.println(" jstack [-l] <pid>");
|
||||||
System.err.println(" (to connect to running process)");
|
System.err.println(" (to connect to running process)");
|
||||||
|
|
||||||
if (isAgentToolPresent()) {
|
|
||||||
System.err.println(" jstack -F [-m] [-l] <pid>");
|
|
||||||
System.err.println(" (to connect to a hung process)");
|
|
||||||
System.err.println(" jstack [-m] [-l] <executable> <core>");
|
|
||||||
System.err.println(" (to connect to a core file)");
|
|
||||||
System.err.println(" jstack [-m] [-l] [server_id@]<remote server IP or hostname>");
|
|
||||||
System.err.println(" (to connect to a remote debug server)");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println("");
|
System.err.println("");
|
||||||
System.err.println("Options:");
|
System.err.println("Options:");
|
||||||
|
|
||||||
if (isAgentToolPresent()) {
|
|
||||||
System.err.println(" -F to force a thread dump. Use when jstack <pid> does not respond" +
|
|
||||||
" (process is hung)");
|
|
||||||
System.err.println(" -m to print both java and native frames (mixed mode)");
|
|
||||||
}
|
|
||||||
|
|
||||||
System.err.println(" -l long listing. Prints additional information about locks");
|
System.err.println(" -l long listing. Prints additional information about locks");
|
||||||
System.err.println(" -h or -help to print this help message");
|
System.err.println(" -h or -help to print this help message");
|
||||||
System.exit(exit);
|
System.exit(exit);
|
||||||
|
@ -36,9 +36,9 @@ import jdk.testlibrary.Platform;
|
|||||||
* @test
|
* @test
|
||||||
* @bug 8042397
|
* @bug 8042397
|
||||||
* @summary Unit test for jmap utility test heap configuration reader
|
* @summary Unit test for jmap utility test heap configuration reader
|
||||||
|
* @modules jdk.hotspot.agent/sun.jvm.hotspot
|
||||||
* @library /test/lib/share/classes
|
* @library /test/lib/share/classes
|
||||||
* @library /lib/testlibrary
|
* @library /lib/testlibrary
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.*
|
* @build jdk.testlibrary.*
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @build JMapHeapConfigTest TmtoolTestScenario
|
* @build JMapHeapConfigTest TmtoolTestScenario
|
||||||
@ -149,7 +149,7 @@ public class JMapHeapConfigTest {
|
|||||||
}
|
}
|
||||||
cmd.add("-XX:+PrintFlagsFinal");
|
cmd.add("-XX:+PrintFlagsFinal");
|
||||||
|
|
||||||
TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "-heap");
|
TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "--heap");
|
||||||
int exitcode = tmt.launch(cmd);
|
int exitcode = tmt.launch(cmd);
|
||||||
if (exitcode != 0) {
|
if (exitcode != 0) {
|
||||||
throw new RuntimeException("Test FAILED jmap exits with non zero exit code " + exitcode);
|
throw new RuntimeException("Test FAILED jmap exits with non zero exit code " + exitcode);
|
@ -100,11 +100,13 @@ public class TmtoolTestScenario {
|
|||||||
theApp = LingeredApp.startApp(vmArgsExtended);
|
theApp = LingeredApp.startApp(vmArgsExtended);
|
||||||
|
|
||||||
System.out.println("Starting " + toolName + " against " + theApp.getPid());
|
System.out.println("Starting " + toolName + " against " + theApp.getPid());
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName);
|
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
|
||||||
|
launcher.addToolArg(toolName);
|
||||||
|
|
||||||
for (String cmd : toolArgs) {
|
for (String cmd : toolArgs) {
|
||||||
launcher.addToolArg(cmd);
|
launcher.addToolArg(cmd);
|
||||||
}
|
}
|
||||||
|
launcher.addToolArg("--pid");
|
||||||
launcher.addToolArg(Long.toString(theApp.getPid()));
|
launcher.addToolArg(Long.toString(theApp.getPid()));
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
@ -1,12 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
* published by the Free Software Foundation.
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
*
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
@ -29,41 +27,58 @@ import jdk.testlibrary.JDKToolLauncher;
|
|||||||
import jdk.testlibrary.OutputAnalyzer;
|
import jdk.testlibrary.OutputAnalyzer;
|
||||||
import jdk.testlibrary.ProcessTools;
|
import jdk.testlibrary.ProcessTools;
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* The helper class for running jinfo utility.
|
* @test
|
||||||
|
* @summary Unit test for jinfo utility
|
||||||
|
* @library /lib/testlibrary
|
||||||
|
* @build jdk.testlibrary.*
|
||||||
|
* @run main BasicJInfoTest
|
||||||
*/
|
*/
|
||||||
public final class JInfoHelper {
|
public class BasicJInfoTest {
|
||||||
|
|
||||||
/**
|
private static ProcessBuilder processBuilder = new ProcessBuilder();
|
||||||
* Print configuration information for the current process
|
|
||||||
*
|
public static void main(String[] args) throws Exception {
|
||||||
* @param toolArgs List of jinfo options
|
testJinfoNoArgs();
|
||||||
*/
|
testJinfoFlags();
|
||||||
public static OutputAnalyzer jinfo(String... toolArgs) throws Exception {
|
testJinfoProps();
|
||||||
return jinfo(true, toolArgs);
|
testJinfoFlagInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private static void testJinfoNoArgs() throws Exception {
|
||||||
* Print usage information
|
OutputAnalyzer output = jinfo();
|
||||||
*
|
output.shouldContain("-XX");
|
||||||
* @param toolArgs List of jinfo options
|
output.shouldContain("test.jdk=");
|
||||||
*/
|
output.shouldHaveExitValue(0);
|
||||||
public static OutputAnalyzer jinfoNoPid(String... toolArgs) throws Exception {
|
|
||||||
return jinfo(false, toolArgs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OutputAnalyzer jinfo(boolean toPid, String... toolArgs) throws Exception {
|
private static void testJinfoFlagInvalid() throws Exception {
|
||||||
|
OutputAnalyzer output = jinfo("-flag");
|
||||||
|
output.shouldHaveExitValue(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testJinfoFlags() throws Exception {
|
||||||
|
OutputAnalyzer output = jinfo("-flags");
|
||||||
|
output.shouldContain("-XX");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testJinfoProps() throws Exception {
|
||||||
|
OutputAnalyzer output = jinfo("-props");
|
||||||
|
output.shouldContain("test.jdk=");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static OutputAnalyzer jinfo(String... toolArgs) throws Exception {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jinfo");
|
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jinfo");
|
||||||
if (toolArgs != null) {
|
if (toolArgs != null) {
|
||||||
for (String toolArg : toolArgs) {
|
for (String toolArg : toolArgs) {
|
||||||
launcher.addToolArg(toolArg);
|
launcher.addToolArg(toolArg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toPid) {
|
|
||||||
launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));
|
launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));
|
||||||
}
|
|
||||||
|
|
||||||
ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
|
processBuilder.command(launcher.getCommand());
|
||||||
System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
|
System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
|
||||||
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
|
||||||
System.out.println(output.getOutput());
|
System.out.println(output.getOutput());
|
@ -1,343 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import sun.tools.jinfo.JInfo;
|
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import static org.testng.Assert.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @bug 8039080
|
|
||||||
* @modules jdk.jcmd/sun.tools.jinfo
|
|
||||||
* @run testng JInfoLauncherTest
|
|
||||||
* @summary Test JInfo launcher argument parsing
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public class JInfoLauncherTest {
|
|
||||||
public static final String VALIDATION_EXCEPTION_CLSNAME =
|
|
||||||
IllegalArgumentException.class.getName();
|
|
||||||
|
|
||||||
private Constructor<JInfo> jInfoConstructor;
|
|
||||||
private Field fldUseSA;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public void setup() throws Exception {
|
|
||||||
jInfoConstructor = JInfo.class.getDeclaredConstructor(String[].class);
|
|
||||||
jInfoConstructor.setAccessible(true);
|
|
||||||
fldUseSA = JInfo.class.getDeclaredField("useSA");
|
|
||||||
fldUseSA.setAccessible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private JInfo newJInfo(String[] args) throws Exception {
|
|
||||||
try {
|
|
||||||
return jInfoConstructor.newInstance((Object) args);
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (isValidationException(e.getCause())) {
|
|
||||||
throw (Exception)e.getCause();
|
|
||||||
}
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean getUseSA(JInfo jinfo) throws Exception {
|
|
||||||
return fldUseSA.getBoolean(jinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmdPID(String cmd, String ... params) throws Exception {
|
|
||||||
int offset = (cmd != null ? 1 : 0);
|
|
||||||
String[] args = new String[offset + params.length];
|
|
||||||
args[0] = cmd;
|
|
||||||
System.arraycopy(params, 0, args, offset, params.length);
|
|
||||||
JInfo j = newJInfo(args);
|
|
||||||
assertFalse(getUseSA(j), "Local jinfo must not forward to SA");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmdCore(String cmd, String ... params) throws Exception {
|
|
||||||
int offset = (cmd != null ? 1 : 0);
|
|
||||||
String[] args = new String[offset + params.length];
|
|
||||||
args[0] = cmd;
|
|
||||||
System.arraycopy(params, 0, args, offset, params.length);
|
|
||||||
JInfo j = newJInfo(args);
|
|
||||||
assertTrue(getUseSA(j), "Core jinfo must forward to SA");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmdRemote(String cmd, String ... params) throws Exception {
|
|
||||||
int offset = (cmd != null ? 1 : 0);
|
|
||||||
String[] args = new String[offset + params.length];
|
|
||||||
args[0] = cmd;
|
|
||||||
System.arraycopy(params, 0, args, offset, params.length);
|
|
||||||
JInfo j = newJInfo(args);
|
|
||||||
assertTrue(getUseSA(j), "Remote jinfo must forward to SA");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmdExtraArgs(String cmd, int argsLen) throws Exception {
|
|
||||||
String[] args = new String[argsLen + 1 + (cmd != null ? 1 : 0)];
|
|
||||||
Arrays.fill(args, "a");
|
|
||||||
if (cmd != null) {
|
|
||||||
args[0] = cmd;
|
|
||||||
} else {
|
|
||||||
cmd = "default";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JInfo j = newJInfo(args);
|
|
||||||
fail("\"" + cmd + "\" does not support more than " + argsLen +
|
|
||||||
" arguments");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cmdMissingArgs(String cmd, int reqArgs) throws Exception {
|
|
||||||
String[] args = new String[reqArgs - 1 + (cmd != null ? 1 : 0)];
|
|
||||||
Arrays.fill(args, "a");
|
|
||||||
if (cmd != null) {
|
|
||||||
args[0] = cmd;
|
|
||||||
} else {
|
|
||||||
cmd = "default";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JInfo j = newJInfo(args);
|
|
||||||
fail("\"" + cmd + "\" requires at least " + reqArgs + " argument");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDefaultPID() throws Exception {
|
|
||||||
cmdPID(null, "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsPID() throws Exception {
|
|
||||||
cmdPID("-flags", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSyspropsPID() throws Exception {
|
|
||||||
cmdPID("-sysprops", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testReadFlagPID() throws Exception {
|
|
||||||
cmdPID("-flag", "SomeManagementFlag", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag1PID() throws Exception {
|
|
||||||
cmdPID("-flag", "+SomeManagementFlag", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag2PID() throws Exception {
|
|
||||||
cmdPID("-flag", "-SomeManagementFlag", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag3PID() throws Exception {
|
|
||||||
cmdPID("-flag", "SomeManagementFlag=314", "1234");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDefaultCore() throws Exception {
|
|
||||||
cmdCore(null, "myapp.exe", "my.core");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsCore() throws Exception {
|
|
||||||
cmdCore("-flags", "myapp.exe", "my.core");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSyspropsCore() throws Exception {
|
|
||||||
cmdCore("-sysprops", "myapp.exe", "my.core");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testReadFlagCore() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "SomeManagementFlag", "myapp.exe", "my.core");
|
|
||||||
fail("Flags can not be read from core files");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag1Core() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "+SomeManagementFlag", "myapp.exe", "my.core");
|
|
||||||
fail("Flags can not be set in core files");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag2Core() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "-SomeManagementFlag", "myapp.exe", "my.core");
|
|
||||||
fail("Flags can not be set in core files");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag3Core() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "SomeManagementFlag=314", "myapp.exe", "my.core");
|
|
||||||
fail("Flags can not be set in core files");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDefaultRemote() throws Exception {
|
|
||||||
cmdRemote(null, "serverid@host");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsRemote() throws Exception {
|
|
||||||
cmdRemote("-flags", "serverid@host");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSyspropsRemote() throws Exception {
|
|
||||||
cmdRemote("-sysprops", "serverid@host");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testReadFlagRemote() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "SomeManagementFlag", "serverid@host");
|
|
||||||
fail("Flags can not be read from SA server");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag1Remote() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "+SomeManagementFlag","serverid@host");
|
|
||||||
fail("Flags can not be set on SA server");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag2Remote() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "-SomeManagementFlag", "serverid@host");
|
|
||||||
fail("Flags can not be read set on SA server");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSetFlag3Remote() throws Exception {
|
|
||||||
try {
|
|
||||||
cmdCore("-flag", "SomeManagementFlag=314", "serverid@host");
|
|
||||||
fail("Flags can not be read set on SA server");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDefaultExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs(null, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs("-flags", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSyspropsExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs("-sysprops", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs("-flag", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testHelp1ExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs("-h", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testHelp2ExtraArgs() throws Exception {
|
|
||||||
cmdExtraArgs("-help", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDefaultMissingArgs() throws Exception {
|
|
||||||
cmdMissingArgs(null, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagsMissingArgs() throws Exception {
|
|
||||||
cmdMissingArgs("-flags", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSyspropsMissingArgs() throws Exception {
|
|
||||||
cmdMissingArgs("-sysprops", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testFlagMissingArgs() throws Exception {
|
|
||||||
cmdMissingArgs("-flag", 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testUnknownCommand() throws Exception {
|
|
||||||
try {
|
|
||||||
JInfo j = newJInfo(new String[]{"-unknown_command"});
|
|
||||||
fail("JInfo accepts unknown commands");
|
|
||||||
} catch (Exception e) {
|
|
||||||
if (!isValidationException(e)) {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isValidationException(Throwable e) {
|
|
||||||
return e.getClass().getName().equals(VALIDATION_EXCEPTION_CLSNAME);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, 2015, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.lang.management.ManagementFactory;
|
|
||||||
import com.sun.management.HotSpotDiagnosticMXBean;
|
|
||||||
import jdk.testlibrary.OutputAnalyzer;
|
|
||||||
import static jdk.testlibrary.Platform.isSolaris;
|
|
||||||
import static jdk.testlibrary.Asserts.assertEquals;
|
|
||||||
import static jdk.testlibrary.Asserts.assertNotEquals;
|
|
||||||
import static jdk.testlibrary.Asserts.assertTrue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @summary The test sanity checks 'jinfo -flag' option.
|
|
||||||
* @library /lib/testlibrary
|
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.* JInfoHelper
|
|
||||||
* @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessFlagTest
|
|
||||||
*/
|
|
||||||
public class JInfoRunningProcessFlagTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
testFlag();
|
|
||||||
testFlagPlus();
|
|
||||||
testFlagMinus();
|
|
||||||
testFlagEqual();
|
|
||||||
|
|
||||||
testInvalidFlag();
|
|
||||||
|
|
||||||
testSolarisSpecificFlag();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testFlag() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertTrue(output.getStderr().isEmpty(), "'jinfo -flag HeapDumpOnOutOfMemoryError' stderr should be empty");
|
|
||||||
output.shouldContain("+HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testFlagPlus() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output.shouldContain("+HeapDumpOnOutOfMemoryError");
|
|
||||||
verifyIsEnabled("HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testFlagMinus() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output.shouldContain("-HeapDumpOnOutOfMemoryError");
|
|
||||||
verifyIsDisabled("HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testFlagEqual() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output.shouldContain("+HeapDumpOnOutOfMemoryError");
|
|
||||||
verifyIsEnabled("HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testInvalidFlag() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "monkey");
|
|
||||||
assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid flag");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testSolarisSpecificFlag() throws Exception {
|
|
||||||
if (!isSolaris())
|
|
||||||
return;
|
|
||||||
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+ExtendedDTraceProbes");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output = JInfoHelper.jinfo();
|
|
||||||
output.shouldContain("+ExtendedDTraceProbes");
|
|
||||||
verifyIsEnabled("ExtendedDTraceProbes");
|
|
||||||
|
|
||||||
output = JInfoHelper.jinfo("-flag", "-ExtendedDTraceProbes");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
output = JInfoHelper.jinfo();
|
|
||||||
output.shouldContain("-ExtendedDTraceProbes");
|
|
||||||
verifyIsDisabled("ExtendedDTraceProbes");
|
|
||||||
|
|
||||||
output = JInfoHelper.jinfo("-flag", "ExtendedDTraceProbes");
|
|
||||||
output.shouldContain("-ExtendedDTraceProbes");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void verifyIsEnabled(String flag) {
|
|
||||||
HotSpotDiagnosticMXBean hotspotDiagnostic =
|
|
||||||
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
|
|
||||||
String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
|
|
||||||
assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void verifyIsDisabled(String flag) {
|
|
||||||
HotSpotDiagnosticMXBean hotspotDiagnostic =
|
|
||||||
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
|
|
||||||
String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
|
|
||||||
assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, 2015, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import jdk.testlibrary.OutputAnalyzer;
|
|
||||||
import static jdk.testlibrary.Asserts.assertTrue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @summary The test sanity checks functionality of 'jinfo', 'jinfo -sysprops' and 'jinfo -flags'
|
|
||||||
* @library /lib/testlibrary
|
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.* JInfoHelper
|
|
||||||
* @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessTest
|
|
||||||
*/
|
|
||||||
public class JInfoRunningProcessTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
testNoOptions();
|
|
||||||
testSysprops();
|
|
||||||
testFlags();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testNoOptions() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo();
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertTrue(output.getStderr().isEmpty(), "'jinfo' stderr should be empty");
|
|
||||||
output.shouldContain("+HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testSysprops() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-sysprops");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertTrue(output.getStderr().isEmpty(), "'jinfo -sysprops' stderr should be empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testFlags() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfo("-flags");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertTrue(output.getStderr().isEmpty(), "'jinfo -flags' stderr should be empty");
|
|
||||||
output.shouldContain("+HeapDumpOnOutOfMemoryError");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014, 2015, 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
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation. Oracle designates this
|
|
||||||
* particular file as subject to the "Classpath" exception as provided
|
|
||||||
* by Oracle in the LICENSE file that accompanied this code.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import static jdk.testlibrary.Asserts.assertNotEquals;
|
|
||||||
import static jdk.testlibrary.Asserts.assertTrue;
|
|
||||||
import static jdk.testlibrary.Asserts.assertFalse;
|
|
||||||
import jdk.testlibrary.OutputAnalyzer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @test
|
|
||||||
* @summary The test sanity checks functionality of 'jinfo -h', 'jinfo -help',
|
|
||||||
* and verifies jinfo exits abnormally if started with invalid options.
|
|
||||||
* @library /lib/testlibrary
|
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.* JInfoHelper
|
|
||||||
* @run main JInfoSanityTest
|
|
||||||
*/
|
|
||||||
public class JInfoSanityTest {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
test_h();
|
|
||||||
test_help();
|
|
||||||
testVersion();
|
|
||||||
testUnknownHost();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void test_h() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfoNoPid("-h");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertFalse(output.getStderr().isEmpty(), "'jinfo -h' stderr should not be empty");
|
|
||||||
assertTrue(output.getStdout().isEmpty(), "'jinfo -h' stdout should be empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void test_help() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfoNoPid("-help");
|
|
||||||
output.shouldHaveExitValue(0);
|
|
||||||
assertFalse(output.getStderr().isEmpty(), "'jinfo -help' stderr should not be empty");
|
|
||||||
assertTrue(output.getStdout().isEmpty(), "'jinfo -help' stdout should be empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testVersion() throws Exception {
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfoNoPid("-version");
|
|
||||||
output.shouldHaveExitValue(1);
|
|
||||||
assertFalse(output.getStderr().isEmpty(), "'jinfo -version' stderr should not be empty");
|
|
||||||
assertTrue(output.getStdout().isEmpty(), "'jinfo -version' stdout should be empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void testUnknownHost() throws Exception {
|
|
||||||
String unknownHost = "Oja781nh2ev7vcvbajdg-Sda1-C";
|
|
||||||
OutputAnalyzer output = JInfoHelper.jinfoNoPid("med@" + unknownHost);
|
|
||||||
assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid operation");
|
|
||||||
output.shouldMatch(".*(Connection refused to host\\:|UnknownHostException\\:) " + unknownHost + ".*");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -34,12 +34,10 @@ import jdk.testlibrary.ProcessTools;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 6321286
|
|
||||||
* @summary Unit test for jmap utility
|
* @summary Unit test for jmap utility
|
||||||
* @key intermittent
|
* @key intermittent
|
||||||
* @library /lib/testlibrary
|
* @library /lib/testlibrary
|
||||||
* @library /test/lib/share/classes
|
* @library /test/lib/share/classes
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.*
|
* @build jdk.testlibrary.*
|
||||||
* @build jdk.test.lib.hprof.*
|
* @build jdk.test.lib.hprof.*
|
||||||
* @build jdk.test.lib.hprof.model.*
|
* @build jdk.test.lib.hprof.model.*
|
||||||
@ -54,6 +52,8 @@ public class BasicJMapTest {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
testHisto();
|
testHisto();
|
||||||
testHistoLive();
|
testHistoLive();
|
||||||
|
testFinalizerInfo();
|
||||||
|
testClstats();
|
||||||
testDump();
|
testDump();
|
||||||
testDumpLive();
|
testDumpLive();
|
||||||
}
|
}
|
||||||
@ -68,6 +68,16 @@ public class BasicJMapTest {
|
|||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void testFinalizerInfo() throws Exception {
|
||||||
|
OutputAnalyzer output = jmap("-finalizerinfo");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testClstats() throws Exception {
|
||||||
|
OutputAnalyzer output = jmap("-clstats");
|
||||||
|
output.shouldHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
private static void testDump() throws Exception {
|
private static void testDump() throws Exception {
|
||||||
dump(false);
|
dump(false);
|
||||||
}
|
}
|
||||||
@ -105,7 +115,6 @@ public class BasicJMapTest {
|
|||||||
|
|
||||||
private static OutputAnalyzer jmap(String... toolArgs) throws Exception {
|
private static OutputAnalyzer jmap(String... toolArgs) throws Exception {
|
||||||
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jmap");
|
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jmap");
|
||||||
launcher.addVMArg("-XX:+UsePerfData");
|
|
||||||
if (toolArgs != null) {
|
if (toolArgs != null) {
|
||||||
for (String toolArg : toolArgs) {
|
for (String toolArg : toolArgs) {
|
||||||
launcher.addToolArg(toolArg);
|
launcher.addToolArg(toolArg);
|
||||||
|
@ -29,10 +29,8 @@ import jdk.testlibrary.ProcessTools;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 6260070
|
|
||||||
* @summary Unit test for jstack utility
|
* @summary Unit test for jstack utility
|
||||||
* @library /lib/testlibrary
|
* @library /lib/testlibrary
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.*
|
* @build jdk.testlibrary.*
|
||||||
* @run main BasicJStackTest
|
* @run main BasicJStackTest
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,6 @@ import jdk.testlibrary.ProcessTools;
|
|||||||
* @summary Test deadlock detection
|
* @summary Test deadlock detection
|
||||||
* @library /test/lib/share/classes
|
* @library /test/lib/share/classes
|
||||||
* @library /lib/testlibrary
|
* @library /lib/testlibrary
|
||||||
* @modules java.management
|
|
||||||
* @build jdk.testlibrary.*
|
* @build jdk.testlibrary.*
|
||||||
* @build jdk.test.lib.apps.*
|
* @build jdk.test.lib.apps.*
|
||||||
* @build DeadlockDetectionTest
|
* @build DeadlockDetectionTest
|
||||||
|
Loading…
x
Reference in New Issue
Block a user