8232592: <Unknown compiled code> is shown in jstack mixed mode
authorysuenaga
Wed, 23 Oct 2019 10:02:26 +0900
changeset 58743 083bbca50d2d
parent 58742 a6c56d661d75
child 58744 c9c3bb79861e
8232592: <Unknown compiled code> is shown in jstack mixed mode Reviewed-by: cjplummer, phh
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
--- 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>");