agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-8003348 Sdiff agent/src/share/classes/sun/jvm/hotspot/tools

agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java

Print this page
8003348: SA can not read core file on OS X
   1 /*
   2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.tools;
  26 
  27 import java.io.*;
  28 import java.util.*;
  29 import sun.jvm.hotspot.code.*;
  30 import sun.jvm.hotspot.interpreter.*;
  31 import sun.jvm.hotspot.debugger.*;
  32 import sun.jvm.hotspot.debugger.cdbg.*;
  33 import sun.jvm.hotspot.oops.*;
  34 import sun.jvm.hotspot.runtime.*;

  35 
  36 public class PStack extends Tool {
  37     // in non-verbose mode, Method*s are not printed in java frames
  38    public PStack(boolean v, boolean concurrentLocks) {
  39       this.verbose = v;
  40       this.concurrentLocks = concurrentLocks;
  41    }
  42 
  43    public PStack() {
  44       this(true, true);
  45    }
  46 
  47    public void run() {
  48       run(System.out);
  49    }
  50 
  51    public void run(PrintStream out) {
  52       Debugger dbg = getAgent().getDebugger();
  53       run(out, dbg);
  54    }
  55 
  56    public void run(PrintStream out, Debugger dbg) {





  57       CDebugger cdbg = dbg.getCDebugger();
  58       if (cdbg != null) {
  59          ConcurrentLocksPrinter concLocksPrinter = null;
  60          // compute and cache java Vframes.
  61          initJFrameCache();
  62          if (concurrentLocks) {
  63             concLocksPrinter = new ConcurrentLocksPrinter();
  64          }
  65          // print Java level deadlocks
  66          try {
  67             DeadlockDetector.print(out);
  68          } catch (Exception exp) {
  69             out.println("can't print deadlock information: " + exp.getMessage());
  70          }
  71 
  72          List l = cdbg.getThreadList();
  73          final boolean cdbgCanDemangle = cdbg.canDemangle();
  74          for (Iterator itr = l.iterator() ; itr.hasNext();) {
  75             ThreadProxy th = (ThreadProxy) itr.next();
  76             try {


   1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.tools;
  26 
  27 import java.io.*;
  28 import java.util.*;
  29 import sun.jvm.hotspot.code.*;
  30 import sun.jvm.hotspot.interpreter.*;
  31 import sun.jvm.hotspot.debugger.*;
  32 import sun.jvm.hotspot.debugger.cdbg.*;
  33 import sun.jvm.hotspot.oops.*;
  34 import sun.jvm.hotspot.runtime.*;
  35 import sun.jvm.hotspot.utilities.PlatformInfo;
  36 
  37 public class PStack extends Tool {
  38     // in non-verbose mode, Method*s are not printed in java frames
  39    public PStack(boolean v, boolean concurrentLocks) {
  40       this.verbose = v;
  41       this.concurrentLocks = concurrentLocks;
  42    }
  43 
  44    public PStack() {
  45       this(true, true);
  46    }
  47 
  48    public void run() {
  49       run(System.out);
  50    }
  51 
  52    public void run(PrintStream out) {
  53       Debugger dbg = getAgent().getDebugger();
  54       run(out, dbg);
  55    }
  56 
  57    public void run(PrintStream out, Debugger dbg) {
  58       if (PlatformInfo.getOS().equals("darwin")) {
  59         out.println("Not available on Darwin");
  60         return;
  61       }
  62 
  63       CDebugger cdbg = dbg.getCDebugger();
  64       if (cdbg != null) {
  65          ConcurrentLocksPrinter concLocksPrinter = null;
  66          // compute and cache java Vframes.
  67          initJFrameCache();
  68          if (concurrentLocks) {
  69             concLocksPrinter = new ConcurrentLocksPrinter();
  70          }
  71          // print Java level deadlocks
  72          try {
  73             DeadlockDetector.print(out);
  74          } catch (Exception exp) {
  75             out.println("can't print deadlock information: " + exp.getMessage());
  76          }
  77 
  78          List l = cdbg.getThreadList();
  79          final boolean cdbgCanDemangle = cdbg.canDemangle();
  80          for (Iterator itr = l.iterator() ; itr.hasNext();) {
  81             ThreadProxy th = (ThreadProxy) itr.next();
  82             try {


agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File