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

jni_FatalError and Xcheck:jni warnings should print the native stack when there are no Java frames

    XMLWordPrintable

Details

    • b04

    Backports

      Description

        JavaThread::print_stack_on is a no-op if there are no Java frames:

        void JavaThread::print_stack_on(outputStream* st) {
          if (!has_last_Java_frame()) return;

        But it is used to show where -Xcheck:jni warnings originate from and from jni_FatalError. That means that when the JNI code is executed at the top-level of a thread, such as in the launcher, with no Java code on the stack, then we get zero information about where the warning, or error, was generated. This makes tracking down such warnings very tedious.

        If there are no Java frames the JNI code should call the debug utility print_native_stack; though I note a second problem if we do that is that os::current_frame() will trigger an assertion in the frame code due to a NULL pc. So a little more effort is needed to make that work (I commented out the assertion and got the stack trace I wanted).

        Attachments

          Issue Links

            Activity

              People

                dholmes David Holmes
                dholmes David Holmes
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: