< prev index next >

src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp

Print this page

*** 536,548 **** --- 536,550 ---- buf[i] = '\0'; return true; } #define USE_SHARED_SPACES_SYM "UseSharedSpaces" + #define SHARED_BASE_ADDRESS_SYM "SharedBaseAddress" // mangled symbol name for Arguments::SharedArchivePath #define SHARED_ARCHIVE_PATH_SYM "__1cJArgumentsRSharedArchivePath_" + static uintptr_t sharedBaseAddress = 0; static int init_classsharing_workaround(void *cd, const prmap_t* pmap, const char* obj_name) { Debugger* dbg = (Debugger*) cd; JNIEnv* env = dbg->env; jobject this_obj = dbg->this_obj;
*** 575,584 **** --- 577,599 ---- } else if ((int)value == 0) { print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); return 1; } + psaddr_t sharedBaseAddressAddr = 0; + ps_pglobal_lookup(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM, &sharedBaseAddressAddr); + if (sharedBaseAddressAddr == 0) { + print_debug("can't find symbol 'SharedBaseAddress'\n"); + THROW_NEW_DEBUGGER_EXCEPTION_("can't find 'SharedBaseAddress' flag\n", 1); + } + + sharedBaseAddress = 0; + if (read_pointer(ph, sharedBaseAddressAddr, &sharedBaseAddress) != true) { + print_debug("can't read the value of 'SharedBaseAddress' flag\n"); + THROW_NEW_DEBUGGER_EXCEPTION_("can't get SharedBaseAddress from debuggee", 1); + } + char classes_jsa[PATH_MAX]; psaddr_t sharedArchivePathAddrAddr = 0; ps_pglobal_lookup(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM, &sharedArchivePathAddrAddr); if (sharedArchivePathAddrAddr == 0) { print_debug("can't find symbol 'Arguments::SharedArchivePath'\n");
*** 646,657 **** THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1); } if (_libsaproc_debug) { for (int m = 0; m < NUM_CDS_REGIONS; m++) { print_debug("shared file offset %d mapped at 0x%lx, size = %ld, read only? = %d\n", ! pheader->_space[m]._file_offset, pheader->_space[m]._addr._base, pheader->_space[m]._used, pheader->_space[m]._read_only); } } // FIXME: For now, omitting other checks such as VM version etc. --- 661,674 ---- THROW_NEW_DEBUGGER_EXCEPTION_(errMsg, 1); } if (_libsaproc_debug) { for (int m = 0; m < NUM_CDS_REGIONS; m++) { + jlong mapping_offset = pheader->_space[m]._mapping_offset; + jlong baseAddress = (mapping_offset == 0) ? 0 : (mapping_offset + (jlong)sharedBaseAddress); print_debug("shared file offset %d mapped at 0x%lx, size = %ld, read only? = %d\n", ! pheader->_space[m]._file_offset, baseAddress, pheader->_space[m]._used, pheader->_space[m]._read_only); } } // FIXME: For now, omitting other checks such as VM version etc.
*** 1051,1064 **** // We can skip the non-read-only maps. These are mapped as MAP_PRIVATE // and hence will be read by libproc. Besides, the file copy may be // stale because the process might have modified those pages. if (pheader->_space[m]._read_only) { ! jlong baseAddress = (jlong) (uintptr_t) pheader->_space[m]._addr._base; size_t usedSize = pheader->_space[m]._used; ! if (address >= baseAddress && address < (baseAddress + usedSize)) { ! // the given address falls in this shared heap area print_debug("found shared map at 0x%lx\n", (long) baseAddress); // If more data is asked than actually mapped from file, we need to zero fill // till the end-of-page boundary. But, java array new does that for us. we just --- 1068,1082 ---- // We can skip the non-read-only maps. These are mapped as MAP_PRIVATE // and hence will be read by libproc. Besides, the file copy may be // stale because the process might have modified those pages. if (pheader->_space[m]._read_only) { ! jlong mapping_offset = (jlong) (uintptr_t) pheader->_space[m]._mapping_offset; ! jlong baseAddress = mapping_offset + (jlong)sharedBaseAddress; size_t usedSize = pheader->_space[m]._used; ! if (mapping_offset != 0 && address >= baseAddress && address < (baseAddress + usedSize)) { ! // the given address falls in this shared metadata area print_debug("found shared map at 0x%lx\n", (long) baseAddress); // If more data is asked than actually mapped from file, we need to zero fill // till the end-of-page boundary. But, java array new does that for us. we just
< prev index next >