--- old/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c 2019-10-28 17:14:27.498206143 -0700 +++ new/src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c 2019-10-28 17:14:27.102191971 -0700 @@ -283,7 +283,7 @@ char classes_jsa[PATH_MAX]; CDSFileMapHeaderBase header; int fd = -1; - uintptr_t base = 0, useSharedSpacesAddr = 0; + uintptr_t useSharedSpacesAddr = 0; uintptr_t sharedBaseAddressAddr = 0, sharedBaseAddress = 0; uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0; jboolean useSharedSpaces = 0; @@ -377,19 +377,19 @@ ph->core->classes_jsa_fd = fd; // add read-only maps from classes.jsa to the list of maps for (m = 0; m < NUM_CDS_REGIONS; m++) { - if (header._space[m]._read_only) { + if (header._space[m]._read_only && + !header._space[m]._is_heap_region && + !header._space[m]._is_bitmap_region) { // 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); - } + uintptr_t base = sharedBaseAddress + (uintptr_t) header._space[m]._mapping_offset; + size_t size = header._space[m]._used; + // 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); + print_debug("added a share archive map [%d] at 0x%lx (size 0x%lx bytes)\n", m, base, size); } } return true;