< prev index next >

src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c

Print this page

*** 259,275 **** --- 259,277 ---- #ifdef LINUX // mangled name of Arguments::SharedArchivePath #define SHARED_ARCHIVE_PATH_SYM "_ZN9Arguments17SharedArchivePathE" #define USE_SHARED_SPACES_SYM "UseSharedSpaces" + #define SHARED_BASE_ADDRESS_SYM "SharedBaseAddress" #define LIBJVM_NAME "/libjvm.so" #endif #ifdef __APPLE__ // mangled name of Arguments::SharedArchivePath #define SHARED_ARCHIVE_PATH_SYM "__ZN9Arguments17SharedArchivePathE" #define USE_SHARED_SPACES_SYM "_UseSharedSpaces" + #define SHARED_BASE_ADDRESS_SYM "_SharedBaseAddress" #define LIBJVM_NAME "/libjvm.dylib" #endif bool init_classsharing_workaround(struct ps_prochandle* ph) { lib_info* lib = ph->libs;
*** 280,289 **** --- 282,292 ---- if ((jvm_name = strstr(lib->name, LIBJVM_NAME)) != 0) { char classes_jsa[PATH_MAX]; CDSFileMapHeaderBase header; int fd = -1; uintptr_t base = 0, useSharedSpacesAddr = 0; + uintptr_t sharedBaseAddressAddr = 0, sharedBaseAddress = 0; uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0; jboolean useSharedSpaces = 0; int m; size_t n;
*** 306,315 **** --- 309,329 ---- if ((int)useSharedSpaces == 0) { print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); return true; } + sharedBaseAddressAddr = lookup_symbol(ph, jvm_name, SHARED_BASE_ADDRESS_SYM); + if (sharedBaseAddressAddr == 0) { + print_debug("can't lookup 'SharedBaseAddress' flag\n"); + return false; + } + + if (read_pointer(ph, sharedBaseAddressAddr, &sharedBaseAddress) != true) { + print_debug("can't read the value of 'SharedBaseAddress' flag\n"); + return false; + } + sharedArchivePathAddrAddr = lookup_symbol(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM); if (sharedArchivePathAddrAddr == 0) { print_debug("can't lookup shared archive path symbol\n"); return false; }
*** 365,382 **** for (m = 0; m < NUM_CDS_REGIONS; m++) { if (header._space[m]._read_only) { // With *some* linux versions, the core file doesn't include read-only mmap'ed // files regions, so let's add them here. This is harmless if the core file also // include these regions. ! base = (uintptr_t) header._space[m]._addr._base; // no need to worry about the fractional pages at-the-end. // possible fractional pages are handled by core_read_data. add_class_share_map_info(ph, (off_t) header._space[m]._file_offset, base, (size_t) header._space[m]._used); print_debug("added a share archive map at 0x%lx\n", base); } } return true; } lib = lib->next; } return true; --- 379,399 ---- for (m = 0; m < NUM_CDS_REGIONS; m++) { if (header._space[m]._read_only) { // With *some* linux versions, the core file doesn't include read-only mmap'ed // files regions, so let's add them here. This is harmless if the core file also // include these regions. ! base = (uintptr_t) header._space[m]._mapping_offset; ! if (base != 0) { ! base = sharedBaseAddress + base; // no need to worry about the fractional pages at-the-end. // possible fractional pages are handled by core_read_data. add_class_share_map_info(ph, (off_t) header._space[m]._file_offset, base, (size_t) header._space[m]._used); print_debug("added a share archive map at 0x%lx\n", base); } } + } return true; } lib = lib->next; } return true;
< prev index next >