RFR(S): 8191049: Add alternate version of pns() that is callable from within hotspot source

Chris Plummer chris.plummer at oracle.com
Thu Nov 9 20:29:49 UTC 2017


Hi,

Please review the following:

https://bugs.openjdk.java.net/browse/JDK-8191049

diff --git a/src/hotspot/share/utilities/debug.cpp 
b/src/hotspot/share/utilities/debug.cpp
--- a/src/hotspot/share/utilities/debug.cpp
+++ b/src/hotspot/share/utilities/debug.cpp
@@ -631,6 +631,24 @@
    VMError::print_native_stack(tty, fr, t, buf, sizeof(buf));
  }

+//
+// This version of pns() will not work when called from the debugger, 
but is
+// useful when called from within hotspot code. The advantages over pns()
+// are not having to pass in any arguments, and it will work on 
Windows/x64.
+//
+extern "C" void pns2() { // print native stack
+  Command c("pns2");
+  static char buf[O_BUFLEN];
+  if (os::platform_print_native_stack(tty, NULL, buf, sizeof(buf))) {
+    // We have printed the native stack in platform-specific code,
+    // so nothing else to do in this case.
+  } else {
+    Thread* t = Thread::current_or_null();
+    frame fr = os::current_frame();
+    VMError::print_native_stack(tty, fr, t, buf, sizeof(buf));
+  }
+}
+
  #endif // !PRODUCT

There is also a pre-existing thread with some discussion:

http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2017-November/025134.html

thanks,

Chris



More information about the hotspot-dev mailing list