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

Applications using Oracle JVM difficult to debug inside Xcode on OSX

XMLWordPrintable

    • x86_64
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_101"
      Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
      or
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      macOS/OSX 10.12.5

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      2015 MacBook Air

      A DESCRIPTION OF THE PROBLEM :
      I've spent a little time looking at the integration of Swift with Java and it seems the Oracle JVM routinely issues a SIGSEGV during JNI_CreateJavaVM(), even if the call subsequently succeeds. As this picked up by the lldb it means you have to enter "pr h -s false SIGSEGV" into the Xcode debugger window each time the application runs for it to continue. The application runs as expected if you run it outside the debugger as the signal must be trapped.


      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.6.0_65"
      Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
      Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Try to start up JVM in any macOS project insisde Xcode, running with the debugger.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should start up as it did with the 1.6 release available here https://support.apple.com/kb/dl1572?locale=en_US
      ACTUAL -
      Any Oracle JVM stops inside the debugger with a SIGSEGV with this code:
      -> 0x1040942b4: movl (%rsi), %eax
          0x1040942b6: leaq 0xf8(%rbp), %rsi
          0x1040942bd: vmovdqu %ymm0, (%rsi)
          0x1040942c1: vmovdqu %ymm7, 0x20(%rsi)
          0x1040942c6: vmovdqu %ymm8, 0x40(%rsi)
          0x1040942cb: vmovdqu %ymm15, 0x60(%rsi)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      as above

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      #import <Foundation/Foundation.h>
      #import "jni.h"

      int main(int argc, const char * argv[]) {
          @autoreleasepool {
              // insert code here...
              struct JavaVMInitArgs vmArgs;
              JNI_GetDefaultJavaVMInitArgs(&vmArgs);
              vmArgs.version = JNI_VERSION_1_6;
      // vmArgs.nOptions = 0;
      // struct JavaVMOption opt[1];
      // vmArgs.options = opt;

              JavaVM *jvm = NULL;
              JNIEnv *env = NULL;

              NSLog(@"Hello, World! %d %p %p", JNI_CreateJavaVM(&jvm, &env, &vmArgs), jvm, env);
          }
          return 0;
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Tell the lldb debugger to ignore the SIGSEGV and continue:

      pr h -s false SIGSEGV

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: