< prev index next >
src/jdk.hotspot.agent/share/native/libsaproc/ps_core_common.c
Print this page
*** 39,48 ****
--- 39,54 ----
#ifdef __APPLE__
#include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h"
#endif
+ #ifdef PF_R
+ #define MAP_R_FLAG PF_R
+ #else
+ #define MAP_R_FLAG 0
+ #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,121 ****
destroy_map_info(ph);
free(ph->core);
}
}
! static map_info* allocate_init_map(int fd, off_t offset, uintptr_t vaddr, size_t memsz) {
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;
}
--- 117,127 ----
destroy_map_info(ph);
free(ph->core);
}
}
! 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,140 ****
// initialize map
map->fd = fd;
map->offset = offset;
map->vaddr = vaddr;
map->memsz = memsz;
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) {
map_info* map;
! if ((map = allocate_init_map(fd, offset, vaddr, memsz)) == NULL) {
return NULL;
}
// add this to map list
map->next = ph->core->maps;
--- 129,147 ----
// 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, uint32_t flags) {
map_info* map;
! if ((map = allocate_init_map(fd, offset, vaddr, memsz, flags)) == NULL) {
return NULL;
}
// add this to map list
map->next = ph->core->maps;
*** 147,157 ****
// 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) {
return NULL;
}
map->next = ph->core->class_share_maps;
ph->core->class_share_maps = map;
--- 154,164 ----
// 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, MAP_R_FLAG)) == NULL) {
return NULL;
}
map->next = ph->core->class_share_maps;
ph->core->class_share_maps = map;
< prev index next >