Mercurial > hg > graal-compiler
comparison agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java @ 218:a5838065ab24
6620329: jstack prints double native methods on Solaris/sparc
Summary: Fixed stack walking code in sparc to start frame walk from last_java_sp.
Reviewed-by: sgoldman
author | swamyv |
---|---|
date | Tue, 24 Jun 2008 21:37:10 -0700 |
parents | a61af66fc99e |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
217:411c61adc994 | 218:a5838065ab24 |
---|---|
85 out.print(th); | 85 out.print(th); |
86 out.println(" -----------------"); | 86 out.println(" -----------------"); |
87 while (f != null) { | 87 while (f != null) { |
88 ClosestSymbol sym = f.closestSymbolToPC(); | 88 ClosestSymbol sym = f.closestSymbolToPC(); |
89 Address pc = f.pc(); | 89 Address pc = f.pc(); |
90 out.print(pc + "\t"); | |
90 if (sym != null) { | 91 if (sym != null) { |
91 String name = sym.getName(); | 92 String name = sym.getName(); |
92 if (cdbgCanDemangle) { | 93 if (cdbgCanDemangle) { |
93 name = cdbg.demangle(name); | 94 name = cdbg.demangle(name); |
94 } | 95 } |
95 out.print(pc + "\t" + name); | 96 out.print(name); |
96 long diff = sym.getOffset(); | 97 long diff = sym.getOffset(); |
97 if (diff != 0L) { | 98 if (diff != 0L) { |
98 out.print(" + 0x" + Long.toHexString(diff)); | 99 out.print(" + 0x" + Long.toHexString(diff)); |
99 } | 100 } |
100 out.println(); | 101 out.println(); |
118 } | 119 } |
119 } else { | 120 } else { |
120 // look for known code blobs | 121 // look for known code blobs |
121 CodeCache c = VM.getVM().getCodeCache(); | 122 CodeCache c = VM.getVM().getCodeCache(); |
122 if (c.contains(pc)) { | 123 if (c.contains(pc)) { |
123 out.print(pc + "\t"); | |
124 CodeBlob cb = c.findBlobUnsafe(pc); | 124 CodeBlob cb = c.findBlobUnsafe(pc); |
125 if (cb.isNMethod()) { | 125 if (cb.isNMethod()) { |
126 names = getJavaNames(th, f.localVariableBase()); | 126 names = getJavaNames(th, f.localVariableBase()); |
127 // just print compiled code, if can't determine method | 127 // just print compiled code, if can't determine method |
128 if (names == null || names.length == 0) { | 128 if (names == null || names.length == 0) { |
142 out.println("<SafepointStub>"); | 142 out.println("<SafepointStub>"); |
143 } else { | 143 } else { |
144 out.println("<Unknown code blob>"); | 144 out.println("<Unknown code blob>"); |
145 } | 145 } |
146 } else { | 146 } else { |
147 printUnknown(out,pc); | 147 printUnknown(out); |
148 } | 148 } |
149 } | 149 } |
150 // print java frames, if any | 150 // print java frames, if any |
151 if (names != null && names.length != 0) { | 151 if (names != null && names.length != 0) { |
152 // print java frame(s) | 152 // print java frame(s) |
153 for (int i = 0; i < names.length; i++) { | 153 for (int i = 0; i < names.length; i++) { |
154 out.println(pc + "\t" + names[i]); | 154 out.println(names[i]); |
155 } | 155 } |
156 } | 156 } |
157 } else { | 157 } else { |
158 printUnknown(out,pc); | 158 printUnknown(out); |
159 } | 159 } |
160 } | 160 } |
161 f = f.sender(); | 161 f = f.sender(); |
162 } | 162 } |
163 } catch (Exception exp) { | 163 } catch (Exception exp) { |
218 jframeCache.put(cur.getThreadProxy(), jvframes); | 218 jframeCache.put(cur.getThreadProxy(), jvframes); |
219 proxyToThread.put(cur.getThreadProxy(), cur); | 219 proxyToThread.put(cur.getThreadProxy(), cur); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 private void printUnknown(PrintStream out, Address pc) { | 223 private void printUnknown(PrintStream out) { |
224 out.println(pc + "\t????????"); | 224 out.println("\t????????"); |
225 } | 225 } |
226 | 226 |
227 private String[] getJavaNames(ThreadProxy th, Address fp) { | 227 private String[] getJavaNames(ThreadProxy th, Address fp) { |
228 if (fp == null) { | 228 if (fp == null) { |
229 return null; | 229 return null; |