< prev index next >

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

Print this page

        

@@ -37,11 +37,15 @@
 #include "libproc_impl.h"
 #include "cds.h"
 
 #ifdef __APPLE__
 #include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h"
+#ifndef PF_R
+#define PF_R 0x4
 #endif
+#endif
+
 
 #ifdef LINUX
 // I have no idea why this function is called ps_pread() on macos but ps_pdread on linux.
 #define ps_pread ps_pdread
 #endif

@@ -111,11 +115,11 @@
     destroy_map_info(ph);
     free(ph->core);
   }
 }
 
-static map_info* allocate_init_map(int fd, off_t offset, uintptr_t vaddr, size_t memsz) {
+static map_info* allocate_init_map(int fd, off_t offset, uintptr_t vaddr, size_t memsz, uint32_t flags) {
   map_info* map;
   if ( (map = (map_info*) calloc(1, sizeof(map_info))) == NULL) {
     print_debug("can't allocate memory for map_info\n");
     return NULL;
   }

@@ -123,18 +127,19 @@
   // initialize map
   map->fd     = fd;
   map->offset = offset;
   map->vaddr  = vaddr;
   map->memsz  = memsz;
+  map->flags  = flags;
   return map;
 }
 
 // add map info with given fd, offset, vaddr and memsz
 map_info* add_map_info(struct ps_prochandle* ph, int fd, off_t offset,
-                       uintptr_t vaddr, size_t memsz) {
+                       uintptr_t vaddr, size_t memsz, uint32_t flags) {
   map_info* map;
-  if ((map = allocate_init_map(fd, offset, vaddr, memsz)) == NULL) {
+  if ((map = allocate_init_map(fd, offset, vaddr, memsz, flags)) == NULL) {
     return NULL;
   }
 
   // add this to map list
   map->next  = ph->core->maps;

@@ -147,11 +152,11 @@
 // Part of the class sharing workaround
 static map_info* add_class_share_map_info(struct ps_prochandle* ph, off_t offset,
                              uintptr_t vaddr, size_t memsz) {
   map_info* map;
   if ((map = allocate_init_map(ph->core->classes_jsa_fd,
-                               offset, vaddr, memsz)) == NULL) {
+                               offset, vaddr, memsz, PF_R)) == NULL) {
     return NULL;
   }
 
   map->next = ph->core->class_share_maps;
   ph->core->class_share_maps = map;
< prev index next >