59 // Ready to go with the database... 60 try { 61 // print deadlock information before stack trace 62 DeadlockDetector.print(tty); 63 } catch (Exception exp) { 64 exp.printStackTrace(); 65 tty.println("Can't print deadlocks:" + exp.getMessage()); 66 } 67 68 try { 69 ConcurrentLocksPrinter concLocksPrinter = null; 70 if (concurrentLocks) { 71 concLocksPrinter = new ConcurrentLocksPrinter(); 72 } 73 Threads threads = VM.getVM().getThreads(); 74 int i = 1; 75 for (JavaThread cur = threads.first(); cur != null; cur = cur.next(), i++) { 76 if (cur.isJavaThread()) { 77 cur.printThreadInfoOn(tty); 78 try { 79 for (JavaVFrame vf = cur.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) { 80 Method method = vf.getMethod(); 81 tty.print(" - " + method.externalNameAndSignature() + 82 " @bci=" + vf.getBCI()); 83 84 int lineNumber = method.getLineNumberFromBCI(vf.getBCI()); 85 if (lineNumber != -1) { 86 tty.print(", line=" + lineNumber); 87 } 88 89 if (verbose) { 90 Address pc = vf.getFrame().getPC(); 91 if (pc != null) { 92 tty.print(", pc=" + pc); 93 } 94 95 tty.print(", Method*=" + method.getAddress()); 96 } 97 98 if (vf.isCompiledFrame()) { 99 tty.print(" (Compiled frame"); 100 if (vf.isDeoptimized()) { 101 tty.print(" [deoptimized]"); 102 } 103 } 104 if (vf.isInterpretedFrame()) { 105 tty.print(" (Interpreted frame"); 106 } 107 if (vf.mayBeImpreciseDbg()) { 108 tty.print("; information may be imprecise"); 109 } 110 111 tty.println(")"); 112 } 113 } catch (Exception e) { 114 tty.println("Error occurred during stack walking:"); 115 e.printStackTrace(); 116 } 117 tty.println(); 118 if (concurrentLocks) { 119 concLocksPrinter.print(cur, tty); 120 } 121 tty.println(); 122 } 123 } 124 } 125 catch (AddressException e) { 126 System.err.println("Error accessing address 0x" + Long.toHexString(e.getAddress())); 127 e.printStackTrace(); 128 } 129 } 130 131 public static void main(String[] args) { | 59 // Ready to go with the database... 60 try { 61 // print deadlock information before stack trace 62 DeadlockDetector.print(tty); 63 } catch (Exception exp) { 64 exp.printStackTrace(); 65 tty.println("Can't print deadlocks:" + exp.getMessage()); 66 } 67 68 try { 69 ConcurrentLocksPrinter concLocksPrinter = null; 70 if (concurrentLocks) { 71 concLocksPrinter = new ConcurrentLocksPrinter(); 72 } 73 Threads threads = VM.getVM().getThreads(); 74 int i = 1; 75 for (JavaThread cur = threads.first(); cur != null; cur = cur.next(), i++) { 76 if (cur.isJavaThread()) { 77 cur.printThreadInfoOn(tty); 78 try { 79 int count = 0; 80 81 for (JavaVFrame vf = cur.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) { 82 Method method = vf.getMethod(); 83 tty.print(" - " + method.externalNameAndSignature() + 84 " @bci=" + vf.getBCI()); 85 86 int lineNumber = method.getLineNumberFromBCI(vf.getBCI()); 87 if (lineNumber != -1) { 88 tty.print(", line=" + lineNumber); 89 } 90 91 if (verbose) { 92 Address pc = vf.getFrame().getPC(); 93 if (pc != null) { 94 tty.print(", pc=" + pc); 95 } 96 97 tty.print(", Method*=" + method.getAddress()); 98 } 99 100 if (vf.isCompiledFrame()) { 101 tty.print(" (Compiled frame"); 102 if (vf.isDeoptimized()) { 103 tty.print(" [deoptimized]"); 104 } 105 } 106 if (vf.isInterpretedFrame()) { 107 tty.print(" (Interpreted frame"); 108 } 109 if (vf.mayBeImpreciseDbg()) { 110 tty.print("; information may be imprecise"); 111 } 112 113 tty.println(")"); 114 vf.printLockInfo(tty, count++); 115 } 116 } catch (Exception e) { 117 tty.println("Error occurred during stack walking:"); 118 e.printStackTrace(); 119 } 120 tty.println(); 121 if (concurrentLocks) { 122 concLocksPrinter.print(cur, tty); 123 } 124 tty.println(); 125 } 126 } 127 } 128 catch (AddressException e) { 129 System.err.println("Error accessing address 0x" + Long.toHexString(e.getAddress())); 130 e.printStackTrace(); 131 } 132 } 133 134 public static void main(String[] args) { |