From: Petr Machata Date: Thu, 12 Nov 2009 23:38:27 +0000 (+0100) Subject: Load ahead core file chunk only if the area is vaddr-contiguous X-Git-Tag: elfutils-0.144~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=003dd328425b57a5944dfd1454cb0e73c8f615dd;p=thirdparty%2Felfutils.git Load ahead core file chunk only if the area is vaddr-contiguous --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 9e76838fd..c210bcae2 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2009-11-12 Petr Machata + + * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if + the chunk is both offset-contiguous and vaddr-contiguous. + 2009-11-05 Roland McGrath * link_map.c (report_r_debug): Skip entries with l_ld==0. diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c index 77f208cc7..ad1c78d8f 100644 --- a/libdwfl/core-file.c +++ b/libdwfl/core-file.c @@ -283,7 +283,16 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, || ((phdr.p_vaddr + phdr.p_memsz + align - 1) & -align) <= vaddr); GElf_Off start = vaddr - phdr.p_vaddr + phdr.p_offset; - GElf_Off end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + GElf_Off end; + GElf_Addr end_vaddr; + + inline void update_end () + { + end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + end_vaddr = (phdr.p_vaddr + phdr.p_memsz + align - 1) & -align; + } + + update_end (); /* Use following contiguous segments to get towards SIZE. */ inline bool more (size_t size) @@ -299,11 +308,12 @@ dwfl_elf_phdr_memory_callback (Dwfl *dwfl, int ndx, if (phdr.p_type == PT_LOAD) { - if (phdr.p_offset > end) + if (phdr.p_offset > end + || phdr.p_vaddr > end_vaddr) /* It's discontiguous! */ return false; - end = (phdr.p_offset + phdr.p_filesz + align - 1) & -align; + update_end (); } } return true;