Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191049

Add alternate version of pns() that is callable from within hotspot source

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 10
    • 10
    • hotspot
    • None
    • b34

      The pns() function in debug.cpp is provided for use when running in a debugger so you can dump the mixed java and native stacks. However, it requires passing in $fp, $sp, and $pc registers. This makes it hard to use if you want to add a call to it from within hotspot source. I propose the following alternate psn2() function to be used for this purpose.

      //
      // This version of pns() is not useful 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));
        }
      }

            cjplummer Chris Plummer
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: