]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Load ahead core file chunk only if the area is vaddr-contiguous pmachata/dwfl_core_file_report
authorPetr Machata <pmachata@redhat.com>
Thu, 12 Nov 2009 23:38:27 +0000 (00:38 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 12 Nov 2009 23:38:27 +0000 (00:38 +0100)
libdwfl/ChangeLog
libdwfl/core-file.c

index 9e76838fd5115234be534d19a66c11462ab0d71e..c210bcae278c8f83d846dcbcf28a7313b8f04088 100644 (file)
@@ -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.
index 77f208cc7c5a20ca0ab9479d6b4fc967d87c0079..ad1c78d8f7a6c524a323b1ce5e8ee4153d110946 100644 (file)
@@ -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;