提交 b49be1f4 编写于 作者: S sla

6626412: jstack using SA prints some info messages into err stream

Reviewed-by: coleenp, farvidsson, jbachorik, dsamersoff, sspitsyn
上级 bbc8bac4
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
package sun.jvm.hotspot.tools; package sun.jvm.hotspot.tools;
import java.io.PrintStream; import java.io.PrintStream;
import java.util.Hashtable;
import sun.jvm.hotspot.*; import sun.jvm.hotspot.HotSpotAgent;
import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.runtime.VM;
// generic command line or GUI tool. // generic command line or GUI tool.
// override run & code main as shown below. // override run & code main as shown below.
...@@ -147,6 +147,7 @@ public abstract class Tool implements Runnable { ...@@ -147,6 +147,7 @@ public abstract class Tool implements Runnable {
} }
PrintStream err = System.err; PrintStream err = System.err;
PrintStream out = System.out;
int pid = 0; int pid = 0;
String coreFileName = null; String coreFileName = null;
...@@ -180,18 +181,18 @@ public abstract class Tool implements Runnable { ...@@ -180,18 +181,18 @@ public abstract class Tool implements Runnable {
try { try {
switch (debugeeType) { switch (debugeeType) {
case DEBUGEE_PID: case DEBUGEE_PID:
err.println("Attaching to process ID " + pid + ", please wait..."); out.println("Attaching to process ID " + pid + ", please wait...");
agent.attach(pid); agent.attach(pid);
break; break;
case DEBUGEE_CORE: case DEBUGEE_CORE:
err.println("Attaching to core " + coreFileName + out.println("Attaching to core " + coreFileName +
" from executable " + executableName + ", please wait..."); " from executable " + executableName + ", please wait...");
agent.attach(executableName, coreFileName); agent.attach(executableName, coreFileName);
break; break;
case DEBUGEE_REMOTE: case DEBUGEE_REMOTE:
err.println("Attaching to remote server " + remoteServer + ", please wait..."); out.println("Attaching to remote server " + remoteServer + ", please wait...");
agent.attach(remoteServer); agent.attach(remoteServer);
break; break;
} }
...@@ -218,7 +219,7 @@ public abstract class Tool implements Runnable { ...@@ -218,7 +219,7 @@ public abstract class Tool implements Runnable {
return 1; return 1;
} }
err.println("Debugger attached successfully."); out.println("Debugger attached successfully.");
startInternal(); startInternal();
return 0; return 0;
} }
...@@ -237,14 +238,14 @@ public abstract class Tool implements Runnable { ...@@ -237,14 +238,14 @@ public abstract class Tool implements Runnable {
// Remains of the start mechanism, common to both start methods. // Remains of the start mechanism, common to both start methods.
private void startInternal() { private void startInternal() {
PrintStream err = System.err; PrintStream out = System.out;
VM vm = VM.getVM(); VM vm = VM.getVM();
if (vm.isCore()) { if (vm.isCore()) {
err.println("Core build detected."); out.println("Core build detected.");
} else if (vm.isClientCompiler()) { } else if (vm.isClientCompiler()) {
err.println("Client compiler detected."); out.println("Client compiler detected.");
} else if (vm.isServerCompiler()) { } else if (vm.isServerCompiler()) {
err.println("Server compiler detected."); out.println("Server compiler detected.");
} else { } else {
throw new RuntimeException("Fatal error: " throw new RuntimeException("Fatal error: "
+ "should have been able to detect core/C1/C2 build"); + "should have been able to detect core/C1/C2 build");
...@@ -252,8 +253,8 @@ public abstract class Tool implements Runnable { ...@@ -252,8 +253,8 @@ public abstract class Tool implements Runnable {
String version = vm.getVMRelease(); String version = vm.getVMRelease();
if (version != null) { if (version != null) {
err.print("JVM version is "); out.print("JVM version is ");
err.println(version); out.println(version);
} }
run(); run();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册