annotate agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents b87e5a681416
children 5ed317b25e23
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();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 run(out, dbg, getAgent().isJavaMode());
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 run(out, dbg, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 private void run(PrintStream out, Debugger dbg, final boolean isJava) {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 CDebugger cdbg = dbg.getCDebugger();
a61af66fc99e Initial load
duke
parents:
diff changeset
62 if (cdbg != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 ConcurrentLocksPrinter concLocksPrinter = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
64 if (isJava) {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // compute and cache java Vframes.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 initJFrameCache();
a61af66fc99e Initial load
duke
parents:
diff changeset
67 if (concurrentLocks) {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 concLocksPrinter = new ConcurrentLocksPrinter();
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // print Java level deadlocks
a61af66fc99e Initial load
duke
parents:
diff changeset
71 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 DeadlockDetector.print(out);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 } catch (Exception exp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 out.println("can't print deadlock information: " + exp.getMessage());
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 List l = cdbg.getThreadList();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 final boolean cdbgCanDemangle = cdbg.canDemangle();
a61af66fc99e Initial load
duke
parents:
diff changeset
80 for (Iterator itr = l.iterator() ; itr.hasNext();) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 ThreadProxy th = (ThreadProxy) itr.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 CFrame f = cdbg.topFrameForThread(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 out.print("----------------- ");
a61af66fc99e Initial load
duke
parents:
diff changeset
85 out.print(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 out.println(" -----------------");
a61af66fc99e Initial load
duke
parents:
diff changeset
87 while (f != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 ClosestSymbol sym = f.closestSymbolToPC();
a61af66fc99e Initial load
duke
parents:
diff changeset
89 Address pc = f.pc();
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
90 out.print(pc + "\t");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (sym != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 String name = sym.getName();
a61af66fc99e Initial load
duke
parents:
diff changeset
93 if (cdbgCanDemangle) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 name = cdbg.demangle(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
96 out.print(name);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 long diff = sym.getOffset();
a61af66fc99e Initial load
duke
parents:
diff changeset
98 if (diff != 0L) {
a61af66fc99e Initial load
duke
parents:
diff changeset
99 out.print(" + 0x" + Long.toHexString(diff));
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101 out.println();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 if (isJava) {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // look for one or more java frames
a61af66fc99e Initial load
duke
parents:
diff changeset
105 String[] names = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // check interpreter frame
a61af66fc99e Initial load
duke
parents:
diff changeset
107 Interpreter interp = VM.getVM().getInterpreter();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 if (interp.contains(pc)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 names = getJavaNames(th, f.localVariableBase());
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // print codelet name if we can't determine method
a61af66fc99e Initial load
duke
parents:
diff changeset
111 if (names == null || names.length == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 out.print("<interpreter> ");
a61af66fc99e Initial load
duke
parents:
diff changeset
113 InterpreterCodelet ic = interp.getCodeletContaining(pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (ic != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 String desc = ic.getDescription();
a61af66fc99e Initial load
duke
parents:
diff changeset
116 if (desc != null) out.print(desc);
a61af66fc99e Initial load
duke
parents:
diff changeset
117 }
a61af66fc99e Initial load
duke
parents:
diff changeset
118 out.println();
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // look for known code blobs
a61af66fc99e Initial load
duke
parents:
diff changeset
122 CodeCache c = VM.getVM().getCodeCache();
a61af66fc99e Initial load
duke
parents:
diff changeset
123 if (c.contains(pc)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 CodeBlob cb = c.findBlobUnsafe(pc);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 if (cb.isNMethod()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 names = getJavaNames(th, f.localVariableBase());
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // just print compiled code, if can't determine method
a61af66fc99e Initial load
duke
parents:
diff changeset
128 if (names == null || names.length == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
129 out.println("<Unknown compiled code>");
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 } else if (cb.isBufferBlob()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 out.println("<StubRoutines>");
a61af66fc99e Initial load
duke
parents:
diff changeset
133 } else if (cb.isRuntimeStub()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 out.println("<RuntimeStub>");
a61af66fc99e Initial load
duke
parents:
diff changeset
135 } else if (cb.isDeoptimizationStub()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 out.println("<DeoptimizationStub>");
a61af66fc99e Initial load
duke
parents:
diff changeset
137 } else if (cb.isUncommonTrapStub()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
138 out.println("<UncommonTrap>");
a61af66fc99e Initial load
duke
parents:
diff changeset
139 } else if (cb.isExceptionStub()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 out.println("<ExceptionStub>");
a61af66fc99e Initial load
duke
parents:
diff changeset
141 } else if (cb.isSafepointStub()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 out.println("<SafepointStub>");
a61af66fc99e Initial load
duke
parents:
diff changeset
143 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 out.println("<Unknown code blob>");
a61af66fc99e Initial load
duke
parents:
diff changeset
145 }
a61af66fc99e Initial load
duke
parents:
diff changeset
146 } else {
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
147 printUnknown(out);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
148 }
a61af66fc99e Initial load
duke
parents:
diff changeset
149 }
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // print java frames, if any
a61af66fc99e Initial load
duke
parents:
diff changeset
151 if (names != null && names.length != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 // print java frame(s)
a61af66fc99e Initial load
duke
parents:
diff changeset
153 for (int i = 0; i < names.length; i++) {
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
154 out.println(names[i]);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 } else {
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
158 printUnknown(out);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
159 }
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
6163
b87e5a681416 6310967: SA: jstack -m produce failures in output
poonam
parents: 1552
diff changeset
161 f = f.sender(th);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
162 }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 } catch (Exception exp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 exp.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // continue, may be we can do a better job for other threads
a61af66fc99e Initial load
duke
parents:
diff changeset
166 }
a61af66fc99e Initial load
duke
parents:
diff changeset
167 if (isJava && concurrentLocks) {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 JavaThread jthread = (JavaThread) proxyToThread.get(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
169 if (jthread != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
170 concLocksPrinter.print(jthread, out);
a61af66fc99e Initial load
duke
parents:
diff changeset
171 }
a61af66fc99e Initial load
duke
parents:
diff changeset
172 }
a61af66fc99e Initial load
duke
parents:
diff changeset
173 } // for threads
a61af66fc99e Initial load
duke
parents:
diff changeset
174 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (getDebugeeType() == DEBUGEE_REMOTE) {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 out.println("remote configuration is not yet implemented");
a61af66fc99e Initial load
duke
parents:
diff changeset
177 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
178 out.println("not yet implemented (debugger does not support CDebugger)!");
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 protected boolean requiresVM() {
a61af66fc99e Initial load
duke
parents:
diff changeset
184 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 public static void main(String[] args) throws Exception {
a61af66fc99e Initial load
duke
parents:
diff changeset
188 PStack t = new PStack();
a61af66fc99e Initial load
duke
parents:
diff changeset
189 t.start(args);
a61af66fc99e Initial load
duke
parents:
diff changeset
190 t.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // -- Internals only below this point
a61af66fc99e Initial load
duke
parents:
diff changeset
194 private Map jframeCache; // Map<ThreadProxy, JavaVFrame[]>
a61af66fc99e Initial load
duke
parents:
diff changeset
195 private Map proxyToThread; // Map<ThreadProxy, JavaThread>
a61af66fc99e Initial load
duke
parents:
diff changeset
196 private PrintStream out;
a61af66fc99e Initial load
duke
parents:
diff changeset
197 private boolean verbose;
a61af66fc99e Initial load
duke
parents:
diff changeset
198 private boolean concurrentLocks;
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 private void initJFrameCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 // cache frames for subsequent reference
a61af66fc99e Initial load
duke
parents:
diff changeset
202 jframeCache = new HashMap();
a61af66fc99e Initial load
duke
parents:
diff changeset
203 proxyToThread = new HashMap();
a61af66fc99e Initial load
duke
parents:
diff changeset
204 Threads threads = VM.getVM().getThreads();
a61af66fc99e Initial load
duke
parents:
diff changeset
205 for (JavaThread cur = threads.first(); cur != null; cur = cur.next()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
206 List tmp = new ArrayList(10);
a61af66fc99e Initial load
duke
parents:
diff changeset
207 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 for (JavaVFrame vf = cur.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 tmp.add(vf);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211 } catch (Exception exp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
212 // may be we may get frames for other threads, continue
a61af66fc99e Initial load
duke
parents:
diff changeset
213 // after printing stack trace.
a61af66fc99e Initial load
duke
parents:
diff changeset
214 exp.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
215 }
a61af66fc99e Initial load
duke
parents:
diff changeset
216 JavaVFrame[] jvframes = new JavaVFrame[tmp.size()];
a61af66fc99e Initial load
duke
parents:
diff changeset
217 System.arraycopy(tmp.toArray(), 0, jvframes, 0, jvframes.length);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 jframeCache.put(cur.getThreadProxy(), jvframes);
a61af66fc99e Initial load
duke
parents:
diff changeset
219 proxyToThread.put(cur.getThreadProxy(), cur);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 }
a61af66fc99e Initial load
duke
parents:
diff changeset
221 }
a61af66fc99e Initial load
duke
parents:
diff changeset
222
218
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
223 private void printUnknown(PrintStream out) {
a5838065ab24 6620329: jstack prints double native methods on Solaris/sparc
swamyv
parents: 0
diff changeset
224 out.println("\t????????");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 private String[] getJavaNames(ThreadProxy th, Address fp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (fp == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 return null;
a61af66fc99e Initial load
duke
parents:
diff changeset
230 }
a61af66fc99e Initial load
duke
parents:
diff changeset
231 JavaVFrame[] jvframes = (JavaVFrame[]) jframeCache.get(th);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (jvframes == null) return null; // not a java thread
a61af66fc99e Initial load
duke
parents:
diff changeset
233 List names = new ArrayList(10);
a61af66fc99e Initial load
duke
parents:
diff changeset
234 for (int fCount = 0; fCount < jvframes.length; fCount++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 JavaVFrame vf = jvframes[fCount];
a61af66fc99e Initial load
duke
parents:
diff changeset
236 Frame f = vf.getFrame();
a61af66fc99e Initial load
duke
parents:
diff changeset
237 if (fp.equals(f.getFP())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 StringBuffer sb = new StringBuffer();
a61af66fc99e Initial load
duke
parents:
diff changeset
239 Method method = vf.getMethod();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 // a special char to identify java frames in output
a61af66fc99e Initial load
duke
parents:
diff changeset
241 sb.append("* ");
a61af66fc99e Initial load
duke
parents:
diff changeset
242 sb.append(method.externalNameAndSignature());
a61af66fc99e Initial load
duke
parents:
diff changeset
243 sb.append(" bci:" + vf.getBCI());
a61af66fc99e Initial load
duke
parents:
diff changeset
244 int lineNumber = method.getLineNumberFromBCI(vf.getBCI());
a61af66fc99e Initial load
duke
parents:
diff changeset
245 if (lineNumber != -1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 sb.append(" line:" + lineNumber);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 if (verbose) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6163
diff changeset
250 sb.append(" Method*:" + method.getAddress());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
251 }
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 if (vf.isCompiledFrame()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 sb.append(" (Compiled frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
255 if (vf.isDeoptimized()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 sb.append(" [deoptimized]");
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 } else if (vf.isInterpretedFrame()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 sb.append(" (Interpreted frame");
a61af66fc99e Initial load
duke
parents:
diff changeset
260 }
a61af66fc99e Initial load
duke
parents:
diff changeset
261 if (vf.mayBeImpreciseDbg()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 sb.append("; information may be imprecise");
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 sb.append(")");
a61af66fc99e Initial load
duke
parents:
diff changeset
265 names.add(sb.toString());
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268 String[] res = new String[names.size()];
a61af66fc99e Initial load
duke
parents:
diff changeset
269 System.arraycopy(names.toArray(), 0, res, 0, res.length);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 }