Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java @ 3944:35c656d0b685
7090654: nightly failures after 7086585
Reviewed-by: kvn
author | never |
---|---|
date | Wed, 14 Sep 2011 13:57:32 -0700 |
parents | c18cbe5936b8 |
children | 38ea2efa32a7 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.tools; | |
26 | |
27 public class JStack extends Tool { | |
28 public JStack(boolean mixedMode, boolean concurrentLocks) { | |
29 this.mixedMode = mixedMode; | |
30 this.concurrentLocks = concurrentLocks; | |
31 } | |
32 | |
33 public JStack() { | |
34 this(true, true); | |
35 } | |
36 | |
37 protected boolean needsJavaPrefix() { | |
38 return false; | |
39 } | |
40 | |
41 public String getName() { | |
42 return "jstack"; | |
43 } | |
44 | |
45 protected void printFlagsUsage() { | |
46 System.out.println(" -l\tto print java.util.concurrent locks"); | |
47 System.out.println(" -m\tto print both java and native frames (mixed mode)"); | |
48 super.printFlagsUsage(); | |
49 } | |
50 | |
51 public void run() { | |
52 Tool tool = null; | |
53 if (mixedMode) { | |
54 tool = new PStack(false, concurrentLocks); | |
55 } else { | |
56 tool = new StackTrace(false, concurrentLocks); | |
57 } | |
58 tool.setAgent(getAgent()); | |
59 tool.setDebugeeType(getDebugeeType()); | |
60 tool.run(); | |
61 } | |
62 | |
63 public static void main(String[] args) { | |
64 boolean mixedMode = false; | |
65 boolean concurrentLocks = false; | |
66 int used = 0; | |
67 for (int i = 0; i < args.length; i++) { | |
68 if (args[i].equals("-m")) { | |
69 mixedMode = true; | |
70 used++; | |
71 } else if (args[i].equals("-l")) { | |
72 concurrentLocks = true; | |
73 used++; | |
74 } | |
75 } | |
76 | |
77 if (used != 0) { | |
78 String[] newArgs = new String[args.length - used]; | |
79 for (int i = 0; i < newArgs.length; i++) { | |
80 newArgs[i] = args[i + used]; | |
81 } | |
82 args = newArgs; | |
83 } | |
84 | |
85 JStack jstack = new JStack(mixedMode, concurrentLocks); | |
86 jstack.start(args); | |
87 jstack.stop(); | |
88 } | |
89 | |
90 private boolean mixedMode; | |
91 private boolean concurrentLocks; | |
92 } |