Mercurial > hg > graal-jvmci-8
comparison agent/src/os/linux/ps_core.c @ 12936:1bee3014cf2a
8025812: tmtools/jmap/heap_config tests fail on Linux-ia32 because it Cant attach to the core file
Summary: Coredump store memsz elf field rounded up to page
Reviewed-by: dholmes, sla
author | dsamersoff |
---|---|
date | Thu, 17 Oct 2013 16:08:01 +0400 |
parents | 5705c7ee6dd7 |
children |
comparison
equal
deleted
inserted
replaced
12935:9e0ef3f02648 | 12936:1bee3014cf2a |
---|---|
717 static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* lib_ehdr, uintptr_t lib_base) { | 717 static bool read_lib_segments(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* lib_ehdr, uintptr_t lib_base) { |
718 int i = 0; | 718 int i = 0; |
719 ELF_PHDR* phbuf; | 719 ELF_PHDR* phbuf; |
720 ELF_PHDR* lib_php = NULL; | 720 ELF_PHDR* lib_php = NULL; |
721 | 721 |
722 int page_size=sysconf(_SC_PAGE_SIZE); | 722 int page_size = sysconf(_SC_PAGE_SIZE); |
723 | 723 |
724 if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) { | 724 if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) { |
725 return false; | 725 return false; |
726 } | 726 } |
727 | 727 |
734 uintptr_t target_vaddr = lib_php->p_vaddr + lib_base; | 734 uintptr_t target_vaddr = lib_php->p_vaddr + lib_base; |
735 map_info *existing_map = core_lookup(ph, target_vaddr); | 735 map_info *existing_map = core_lookup(ph, target_vaddr); |
736 | 736 |
737 if (existing_map == NULL){ | 737 if (existing_map == NULL){ |
738 if (add_map_info(ph, lib_fd, lib_php->p_offset, | 738 if (add_map_info(ph, lib_fd, lib_php->p_offset, |
739 target_vaddr, lib_php->p_filesz) == NULL) { | 739 target_vaddr, lib_php->p_memsz) == NULL) { |
740 goto err; | 740 goto err; |
741 } | 741 } |
742 } else { | 742 } else { |
743 // Coredump stores value of p_memsz elf field | |
744 // rounded up to page boundary. | |
745 | |
743 if ((existing_map->memsz != page_size) && | 746 if ((existing_map->memsz != page_size) && |
744 (existing_map->fd != lib_fd) && | 747 (existing_map->fd != lib_fd) && |
745 (existing_map->memsz != lib_php->p_filesz)){ | 748 (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) { |
746 | 749 |
747 print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)", | 750 print_debug("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n", |
748 target_vaddr, lib_php->p_filesz, lib_php->p_flags); | 751 target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags); |
749 goto err; | 752 goto err; |
750 } | 753 } |
751 | 754 |
752 /* replace PT_LOAD segment with library segment */ | 755 /* replace PT_LOAD segment with library segment */ |
753 print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", | 756 print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n", |
754 existing_map->memsz, lib_php->p_filesz); | 757 existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size)); |
755 | 758 |
756 existing_map->fd = lib_fd; | 759 existing_map->fd = lib_fd; |
757 existing_map->offset = lib_php->p_offset; | 760 existing_map->offset = lib_php->p_offset; |
758 existing_map->memsz = lib_php->p_filesz; | 761 existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size); |
759 } | 762 } |
760 } | 763 } |
761 | 764 |
762 lib_php++; | 765 lib_php++; |
763 } | 766 } |