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

SA core file support on OSX has some bugs trying to locate the jvm libraries

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 16
    • hotspot
    • None
    • b11

      I tried to attach to a core file that was generated while running the jhsdb command (yes, using SA to debug SA). SA crashed when I did this, and after fixing the crash, it was still unable to attach.

      The issue is with ps_core.c::get_real_path(), which tries to find the path to the java libs. It starts by searching for bin/java in the path to the executable (execpath), and uses that to find the path to the java libraries. However, that doesn't work if the execpath ends in bin/jhsdb, or any other java launcher in the bin directory. It then checks JAVA_HOME. If that is null, it then falls into the following code:

            char* dyldpath = getenv("DYLD_LIBRARY_PATH");
            char* save_ptr;
            char* dypath = strtok_r(dyldpath, ":", &save_ptr);

      This gets a SEGV if DYLD_LIBRARY_PATH is null (the crash I mentioned above), so one fix needed is to add the null check. If the DYLD_LIBRARY_PATH check fails, then it gives up, so another change I made that helped with the jhsdb case was as a last resort to have it just search for bin/ instead of bin/java.

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

              Created:
              Updated:
              Resolved: