annotate agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java @ 8103:5ed317b25e23

7165259: Remove BugSpot Reviewed-by: coleenp, mgronlun
author sla
date Fri, 22 Feb 2013 10:03:02 +0100
parents da91efe96a93
children 39432a1cefdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6163
b87e5a681416 6310967: SA: jstack -m produce failures in output
poonam
parents: 1552
diff changeset
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 218
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 218
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: 218
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.tools;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.util.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29 import sun.jvm.hotspot.code.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
30 import sun.jvm.hotspot.interpreter.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
31 import sun.jvm.hotspot.debugger.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
32 import sun.jvm.hotspot.debugger.cdbg.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 import sun.jvm.hotspot.oops.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 import sun.jvm.hotspot.runtime.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 public class PStack extends Tool {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6163
diff changeset
37 // in non-verbose mode, Method*s are not printed in java frames
0
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public PStack(boolean v, boolean concurrentLocks) {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 this.verbose = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 this.concurrentLocks = concurrentLocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 }
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public PStack() {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 this(true, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
45 }
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 public void run() {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 run(System.out);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public void run(PrintStream out) {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 Debugger dbg = getAgent().getDebugger();
8103
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
53 run(out, dbg);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 public void run(PrintStream out, Debugger dbg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 CDebugger cdbg = dbg.getCDebugger();
a61af66fc99e Initial load
duke
parents:
diff changeset
58 if (cdbg != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 ConcurrentLocksPrinter concLocksPrinter = null;
8103
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
60 // compute and cache java Vframes.
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
61 initJFrameCache();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
62 if (concurrentLocks) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
63 concLocksPrinter = new ConcurrentLocksPrinter();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
64 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
65 // print Java level deadlocks
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
66 try {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
67 DeadlockDetector.print(out);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
68 } catch (Exception exp) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
69 out.println("can't print deadlock information: " + exp.getMessage());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 List l = cdbg.getThreadList();
a61af66fc99e Initial load
duke
parents:
diff changeset
73 final boolean cdbgCanDemangle = cdbg.canDemangle();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 for (Iterator itr = l.iterator() ; itr.hasNext();) {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 ThreadProxy th = (ThreadProxy) itr.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
76 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 CFrame f = cdbg.topFrameForThread(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 out.print("----------------- ");
a61af66fc99e Initial load
duke
parents:
diff changeset
79 out.print(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 out.println(" -----------------");
a61af66fc99e Initial load
duke
parents:
diff changeset
81 while (f != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 ClosestSymbol sym = f.closestSymbolToPC();
a61af66fc99e Initial load
duke
parents:
diff changeset
83 Address pc = f.pc();
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
84 out.print(pc + "\t");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 if (sym != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 String name = sym.getName();
a61af66fc99e Initial load
duke
parents:
diff changeset
87 if (cdbgCanDemangle) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 name = cdbg.demangle(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
90 out.print(name);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91 long diff = sym.getOffset();
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (diff != 0L) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 out.print(" + 0x" + Long.toHexString(diff));
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 out.println();
a61af66fc99e Initial load
duke
parents:
diff changeset
96 } else {
8103
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
97 // look for one or more java frames
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
98 String[] names = null;
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
99 // check interpreter frame
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
100 Interpreter interp = VM.getVM().getInterpreter();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
101 if (interp.contains(pc)) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
102 names = getJavaNames(th, f.localVariableBase());
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
103 // print codelet name if we can't determine method
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
104 if (names == null || names.length == 0) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
105 out.print("<interpreter> ");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
106 InterpreterCodelet ic = interp.getCodeletContaining(pc);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
107 if (ic != null) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
108 String desc = ic.getDescription();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
109 if (desc != null) out.print(desc);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
110 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
111 out.println();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
112 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
113 } else {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
114 // look for known code blobs
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
115 CodeCache c = VM.getVM().getCodeCache();
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
116 if (c.contains(pc)) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
117 CodeBlob cb = c.findBlobUnsafe(pc);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
118 if (cb.isNMethod()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
119 names = getJavaNames(th, f.localVariableBase());
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
120 // just print compiled code, if can't determine method
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
121 if (names == null || names.length == 0) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
122 out.println("<Unknown compiled code>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
123 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
124 } else if (cb.isBufferBlob()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
125 out.println("<StubRoutines>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
126 } else if (cb.isRuntimeStub()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
127 out.println("<RuntimeStub>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
128 } else if (cb.isDeoptimizationStub()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
129 out.println("<DeoptimizationStub>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
130 } else if (cb.isUncommonTrapStub()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
131 out.println("<UncommonTrap>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
132 } else if (cb.isExceptionStub()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
133 out.println("<ExceptionStub>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
134 } else if (cb.isSafepointStub()) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
135 out.println("<SafepointStub>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
136 } else {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
137 out.println("<Unknown code blob>");
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
138 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
139 } else {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
140 printUnknown(out);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
141 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
142 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
143 // print java frames, if any
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
144 if (names != null && names.length != 0) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
145 // print java frame(s)
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
146 for (int i = 0; i < names.length; i++) {
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
147 out.println(names[i]);
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
148 }
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
149 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
6163
b87e5a681416 6310967: SA: jstack -m produce failures in output
poonam
parents: 1552
diff changeset
151 f = f.sender(th);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 } catch (Exception exp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 exp.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // continue, may be we can do a better job for other threads
a61af66fc99e Initial load
duke
parents:
diff changeset
156 }
8103
5ed317b25e23 7165259: Remove BugSpot
sla
parents: 6725
diff changeset
157 if (concurrentLocks) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
158 JavaThread jthread = (JavaThread) proxyToThread.get(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
159 if (jthread != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
160 concLocksPrinter.print(jthread, out);
a61af66fc99e Initial load
duke
parents:
diff changeset
161 }
a61af66fc99e Initial load
duke
parents:
diff changeset
162 }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 } // for threads
a61af66fc99e Initial load
duke
parents:
diff changeset
164 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
165 if (getDebugeeType() == DEBUGEE_REMOTE) {
a61af66fc99e Initial load
duke
parents:
diff changeset
166 out.println("remote configuration is not yet implemented");
a61af66fc99e Initial load
duke
parents:
diff changeset
167 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 out.println("not yet implemented (debugger does not support CDebugger)!");
a61af66fc99e Initial load
duke
parents:
diff changeset
169 }
a61af66fc99e Initial load
duke
parents:
diff changeset
170 }
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 public static void main(String[] args) throws Exception {
a61af66fc99e Initial load
duke
parents:
diff changeset
174 PStack t = new PStack();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 t.start(args);
a61af66fc99e Initial load
duke
parents:
diff changeset
176 t.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 // -- Internals only below this point
a61af66fc99e Initial load
duke
parents:
diff changeset
180 private Map jframeCache; // Map<ThreadProxy, JavaVFrame[]>
a61af66fc99e Initial load
duke
parents:
diff changeset
181 private Map proxyToThread; // Map<ThreadProxy, JavaThread>
a61af66fc99e Initial load
duke
parents:
diff changeset
182 private PrintStream out;
a61af66fc99e Initial load
duke
parents:
diff changeset
183 private boolean verbose;
a61af66fc99e Initial load
duke
parents:
diff changeset
184 private boolean concurrentLocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 private void initJFrameCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // cache frames for subsequent reference
a61af66fc99e Initial load
duke
parents:
diff changeset
188 jframeCache = new HashMap();
a61af66fc99e Initial load
duke
parents:
diff changeset
189 proxyToThread = new HashMap();
a61af66fc99e Initial load
duke
parents:
diff changeset
190 Threads threads = VM.getVM().getThreads();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 for (JavaThread cur = threads.first(); cur != null; cur = cur.next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 List tmp = new ArrayList(10);
a61af66fc99e Initial load
duke
parents:
diff changeset
193 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 for (JavaVFrame vf = cur.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
195 tmp.add(vf);
a61af66fc99e Initial load
duke
parents:
diff changeset
196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
197 } catch (Exception exp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 // may be we may get frames for other threads, continue
a61af66fc99e Initial load
duke
parents:
diff changeset
199 // after printing stack trace.
a61af66fc99e Initial load
duke
parents:
diff changeset
200 exp.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 }
a61af66fc99e Initial load
duke
parents:
diff changeset
202 JavaVFrame[] jvframes = new JavaVFrame[tmp.size()];
a61af66fc99e Initial load
duke
parents:
diff changeset
203 System.arraycopy(tmp.toArray(), 0, jvframes, 0, jvframes.length);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 jframeCache.put(cur.getThreadProxy(), jvframes);
a61af66fc99e Initial load
duke
parents:
diff changeset
205 proxyToThread.put(cur.getThreadProxy(), cur);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
209 private void printUnknown(PrintStream out) {
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
210 out.println("\t????????");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 private String[] getJavaNames(ThreadProxy th, Address fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
214 if (fp == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217 JavaVFrame[] jvframes = (JavaVFrame[]) jframeCache.get(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 if (jvframes == null) return null; // not a java thread
a61af66fc99e Initial load
duke
parents:
diff changeset
219 List names = new ArrayList(10);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 for (int fCount = 0; fCount < jvframes.length; fCount++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 JavaVFrame vf = jvframes[fCount];
a61af66fc99e Initial load
duke
parents:
diff changeset
222 Frame f = vf.getFrame();
a61af66fc99e Initial load
duke
parents:
diff changeset
223 if (fp.equals(f.getFP())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 StringBuffer sb = new StringBuffer();
a61af66fc99e Initial load
duke
parents:
diff changeset
225 Method method = vf.getMethod();
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // a special char to identify java frames in output
a61af66fc99e Initial load
duke
parents:
diff changeset
227 sb.append("* ");
a61af66fc99e Initial load
duke
parents:
diff changeset
228 sb.append(method.externalNameAndSignature());
a61af66fc99e Initial load
duke
parents:
diff changeset
229 sb.append(" bci:" + vf.getBCI());
a61af66fc99e Initial load
duke
parents:
diff changeset
230 int lineNumber = method.getLineNumberFromBCI(vf.getBCI());
a61af66fc99e Initial load
duke
parents:
diff changeset
231 if (lineNumber != -1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
232 sb.append(" line:" + lineNumber);
a61af66fc99e Initial load
duke
parents:
diff changeset
233 }
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 if (verbose) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6163
diff changeset
236 sb.append(" Method*:" + method.getAddress());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
237 }
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 if (vf.isCompiledFrame()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
240 sb.append(" (Compiled frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
241 if (vf.isDeoptimized()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 sb.append(" [deoptimized]");
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244 } else if (vf.isInterpretedFrame()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 sb.append(" (Interpreted frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
246 }
a61af66fc99e Initial load
duke
parents:
diff changeset
247 if (vf.mayBeImpreciseDbg()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
248 sb.append("; information may be imprecise");
a61af66fc99e Initial load
duke
parents:
diff changeset
249 }
a61af66fc99e Initial load
duke
parents:
diff changeset
250 sb.append(")");
a61af66fc99e Initial load
duke
parents:
diff changeset
251 names.add(sb.toString());
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253 }
a61af66fc99e Initial load
duke
parents:
diff changeset
254 String[] res = new String[names.size()];
a61af66fc99e Initial load
duke
parents:
diff changeset
255 System.arraycopy(names.toArray(), 0, res, 0, res.length);
a61af66fc99e Initial load
duke
parents:
diff changeset
256 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }