JDK-8043264 : hsdis library not picked up correctly on expected paths
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2014-05-15
  • Updated: 2021-05-18
  • Resolved: 2014-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9 Other
9 b15Fixed openjdk8u302Fixed
Related Reports
Relates :  
Description
On Windows, the hsdis library isn't picked up correctly in all expected paths described in Disassembler::load_library():

  // Find the disassembler shared library.
  // Search for several paths derived from libjvm, in this order:
  // 1. <home>/jre/lib/<arch>/<vm>/libhsdis-<arch>.so  (for compatibility)
  // 2. <home>/jre/lib/<arch>/<vm>/hsdis-<arch>.so
  // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
  // 4. hsdis-<arch>.so  (using LD_LIBRARY_PATH)

The reason is that the code that concatenates the paths doesn't take os::file_separator() into account, and always uses '/' instead, like:

const char* p = strrchr(buf, '/');

The fix is to change the use of '/' into *os::file_separator() on two lines in Disassembler::load_library().
Comments
Fix Request [8u] Backport this to fix file separator issue on Windows, patch applies cleanly to 8u.
30-04-2021

Assigning the bug to Krystal as he already sent a patch with the suggested fix in a review request. The patch is: --- a/src/share/vm/compiler/disassembler.cpp Thu May 15 11:35:26 2014 -0700 +++ b/src/share/vm/compiler/disassembler.cpp Thu May 15 13:14:58 2014 -0700 @@ -86,7 +86,7 @@ { // Match "jvm[^/]*" in jvm_path. const char* base = buf; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) lib_offset = p - base + 1; p = strstr(p ? p : base, "jvm"); if (p != NULL) jvm_offset = p - base; @@ -111,7 +111,7 @@ if (_library == NULL) { // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so buf[lib_offset - 1] = '\0'; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) { lib_offset = p - buf + 1; strcpy(&buf[lib_offset], hsdis_library_name);
17-05-2014