Thu, 14 Nov 2013 20:03:15 +0100
6626412: jstack using SA prints some info messages into err stream
Reviewed-by: coleenp, farvidsson, jbachorik, dsamersoff, sspitsyn
agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java | file | annotate | diff | comparison | revisions |
1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Thu Nov 14 19:30:07 2013 +0100 1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Thu Nov 14 20:03:15 2013 +0100 1.3 @@ -25,11 +25,11 @@ 1.4 package sun.jvm.hotspot.tools; 1.5 1.6 import java.io.PrintStream; 1.7 -import java.util.Hashtable; 1.8 1.9 -import sun.jvm.hotspot.*; 1.10 -import sun.jvm.hotspot.runtime.*; 1.11 -import sun.jvm.hotspot.debugger.*; 1.12 +import sun.jvm.hotspot.HotSpotAgent; 1.13 +import sun.jvm.hotspot.debugger.DebuggerException; 1.14 +import sun.jvm.hotspot.debugger.JVMDebugger; 1.15 +import sun.jvm.hotspot.runtime.VM; 1.16 1.17 // generic command line or GUI tool. 1.18 // override run & code main as shown below. 1.19 @@ -147,6 +147,7 @@ 1.20 } 1.21 1.22 PrintStream err = System.err; 1.23 + PrintStream out = System.out; 1.24 1.25 int pid = 0; 1.26 String coreFileName = null; 1.27 @@ -180,18 +181,18 @@ 1.28 try { 1.29 switch (debugeeType) { 1.30 case DEBUGEE_PID: 1.31 - err.println("Attaching to process ID " + pid + ", please wait..."); 1.32 + out.println("Attaching to process ID " + pid + ", please wait..."); 1.33 agent.attach(pid); 1.34 break; 1.35 1.36 case DEBUGEE_CORE: 1.37 - err.println("Attaching to core " + coreFileName + 1.38 + out.println("Attaching to core " + coreFileName + 1.39 " from executable " + executableName + ", please wait..."); 1.40 agent.attach(executableName, coreFileName); 1.41 break; 1.42 1.43 case DEBUGEE_REMOTE: 1.44 - err.println("Attaching to remote server " + remoteServer + ", please wait..."); 1.45 + out.println("Attaching to remote server " + remoteServer + ", please wait..."); 1.46 agent.attach(remoteServer); 1.47 break; 1.48 } 1.49 @@ -218,7 +219,7 @@ 1.50 return 1; 1.51 } 1.52 1.53 - err.println("Debugger attached successfully."); 1.54 + out.println("Debugger attached successfully."); 1.55 startInternal(); 1.56 return 0; 1.57 } 1.58 @@ -237,14 +238,14 @@ 1.59 // Remains of the start mechanism, common to both start methods. 1.60 private void startInternal() { 1.61 1.62 - PrintStream err = System.err; 1.63 + PrintStream out = System.out; 1.64 VM vm = VM.getVM(); 1.65 if (vm.isCore()) { 1.66 - err.println("Core build detected."); 1.67 + out.println("Core build detected."); 1.68 } else if (vm.isClientCompiler()) { 1.69 - err.println("Client compiler detected."); 1.70 + out.println("Client compiler detected."); 1.71 } else if (vm.isServerCompiler()) { 1.72 - err.println("Server compiler detected."); 1.73 + out.println("Server compiler detected."); 1.74 } else { 1.75 throw new RuntimeException("Fatal error: " 1.76 + "should have been able to detect core/C1/C2 build"); 1.77 @@ -252,8 +253,8 @@ 1.78 1.79 String version = vm.getVMRelease(); 1.80 if (version != null) { 1.81 - err.print("JVM version is "); 1.82 - err.println(version); 1.83 + out.print("JVM version is "); 1.84 + out.println(version); 1.85 } 1.86 1.87 run();