From 910fa9ad509780f513805dedbe0828071cb66d5f Mon Sep 17 00:00:00 2001 From: Lutz Schmidt Date: Tue, 28 May 2019 09:41:20 +0200 Subject: [PATCH] 8224672: (lib)hsdis-.so search incorrect after JDK-8213084 Reviewed-by: kvn, shade --- src/hotspot/share/compiler/disassembler.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/compiler/disassembler.cpp b/src/hotspot/share/compiler/disassembler.cpp index 14c747953a5..49e7db404a7 100644 --- a/src/hotspot/share/compiler/disassembler.cpp +++ b/src/hotspot/share/compiler/disassembler.cpp @@ -774,13 +774,14 @@ bool Disassembler::load_library(outputStream* st) { // Match "[lib]jvm[^/]*" in jvm_path. const char* base = buf; const char* p = strrchr(buf, *os::file_separator()); + if (p != NULL) lib_offset = p - base + 1; // this points to the first char after separator #ifdef _WIN32 p = strstr(p ? p : base, "jvm"); + if (p != NULL) jvm_offset = p - base; // this points to 'j' in jvm. #else p = strstr(p ? p : base, "libjvm"); + if (p != NULL) jvm_offset = p - base + 3; // this points to 'j' in libjvm. #endif - if (p != NULL) lib_offset = p - base + 1; - if (p != NULL) jvm_offset = p - base; } #endif @@ -794,11 +795,13 @@ bool Disassembler::load_library(outputStream* st) { // 1. /jre/lib///libhsdis-.so strcpy(&buf[jvm_offset], hsdis_library_name); strcat(&buf[jvm_offset], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s", buf); _library = os::dll_load(buf, ebuf, sizeof ebuf); if (_library == NULL && lib_offset >= 0) { // 2. /jre/lib///hsdis-.so strcpy(&buf[lib_offset], hsdis_library_name); strcat(&buf[lib_offset], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s", buf); _library = os::dll_load(buf, ebuf, sizeof ebuf); } if (_library == NULL && lib_offset > 0) { @@ -809,6 +812,7 @@ bool Disassembler::load_library(outputStream* st) { lib_offset = p - buf + 1; strcpy(&buf[lib_offset], hsdis_library_name); strcat(&buf[lib_offset], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s", buf); _library = os::dll_load(buf, ebuf, sizeof ebuf); } } @@ -817,6 +821,7 @@ bool Disassembler::load_library(outputStream* st) { // 4. hsdis-.so (using LD_LIBRARY_PATH) strcpy(&buf[0], hsdis_library_name); strcat(&buf[0], os::dll_file_extension()); + if (Verbose) st->print_cr("Trying to load: %s via LD_LIBRARY_PATH or equivalent", buf); _library = os::dll_load(buf, ebuf, sizeof ebuf); }