< prev index next >

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

Print this page

@@ -281,11 +281,11 @@
     const char *jvm_name = 0;
     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 useSharedSpacesAddr = 0;
       uintptr_t sharedBaseAddressAddr = 0, sharedBaseAddress = 0;
       uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0;
       jboolean useSharedSpaces = 0;
       int m;
       size_t n;

@@ -375,23 +375,23 @@
       }
 
       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;
+          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_t) header._space[m]._used);
-            print_debug("added a share archive map at 0x%lx\n", base);
-          }
+                                   base, size);
+          print_debug("added a share archive map [%d] at 0x%lx (size 0x%lx bytes)\n", m, base, size);
         }
       }
       return true;
    }
    lib = lib->next;
< prev index next >