8232592: <Unknown compiled code> is shown in jstack mixed mode
Reviewed-by: cjplummer, phh
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java Tue Oct 22 23:55:33 2019 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java Wed Oct 23 10:02:26 2019 +0900
@@ -130,10 +130,19 @@
if (c.contains(pc)) {
CodeBlob cb = c.findBlobUnsafe(pc);
if (cb.isNMethod()) {
- names = getJavaNames(th, f.localVariableBase());
- // just print compiled code, if can't determine method
- if (names == null || names.length == 0) {
- out.println("<Unknown compiled code>");
+ if (cb.isNativeMethod()) {
+ out.print(((CompiledMethod)cb).getMethod().externalNameAndSignature());
+ long diff = pc.minus(cb.codeBegin());
+ if (diff != 0L) {
+ out.print(" + 0x" + Long.toHexString(diff));
+ }
+ out.println(" (Native method)");
+ } else {
+ names = getJavaNames(th, f.localVariableBase());
+ // just print compiled code, if can't determine method
+ if (names == null || names.length == 0) {
+ out.println("<Unknown compiled code>");
+ }
}
} else if (cb.isBufferBlob()) {
out.println("<StubRoutines>");