diff options
author | Petr Machata <pmachata@redhat.com> | 2009-11-13 00:38:27 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2009-11-13 00:38:27 +0100 |
commit | 003dd328425b57a5944dfd1454cb0e73c8f615dd (patch) | |
tree | 92b1fa57f9b1d14a910f3a956f525aa802c41edd | |
parent | 3b478b186141bbba5bb29a6ef224e1ec1bae1dd3 (diff) | |
download | elfutils-pmachata/dwfl_core_file_report.tar.gz |
Load ahead core file chunk only if the area is vaddr-contiguouspmachata/dwfl_core_file_report
-rw-r--r-- | libdwfl/ChangeLog | 5 | ||||
-rw-r--r-- | libdwfl/core-file.c | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 9e76838f..c210bcae 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2009-11-12 Petr Machata <pmachata@redhat.com> + + * 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 <roland@redhat.com> * 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 77f208cc..ad1c78d8 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; |