Bug 637316 part 1 - Report whole memory mapping to crash reporter for libraries on Android. r=mwu
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 14 Mar 2011 15:23:32 +0100
changeset 63511 d5bb42e60c937947c1a0f0e09733d49268298d2c
parent 63510 bf12fcfef518c15f8d2062d6bfcf6ff341b75d2d
child 63512 0615993bf26937f87ad30c7e2e4f077b2ad76593
push idunknown
push userunknown
push dateunknown
reviewersmwu
bugs637316
milestone2.0b13pre
Bug 637316 part 1 - Report whole memory mapping to crash reporter for libraries on Android. r=mwu
other-licenses/android/linker.c
--- a/other-licenses/android/linker.c
+++ b/other-licenses/android/linker.c
@@ -955,20 +955,16 @@ load_segments(int fd, size_t offset, voi
             }
             if (pbase == MAP_FAILED) {
                 DL_ERR("%d failed to map segment from '%s' @ 0x%08x (0x%08x). "
                       "p_vaddr=0x%08x p_offset=0x%08x", pid, si->name,
                       (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
                 goto fail;
             }
 
-            report_mapping(si->name, pbase,
-                           (len + PAGE_MASK) & (~PAGE_MASK),
-                           phdr->p_offset & (~PAGE_MASK));
-
             /* If 'len' didn't end on page boundary, and it's a writable
              * segment, zero-fill the rest. */
             if ((len & PAGE_MASK) && (phdr->p_flags & PF_W))
                 memset((void *)(pbase + len), 0, PAGE_SIZE - (len & PAGE_MASK));
 
             /* Check to see if we need to extend the map for this segment to
              * cover the diff between filesz and memsz (i.e. for bss).
              *
@@ -1071,16 +1067,19 @@ load_segments(int fd, size_t offset, voi
               "greater than what was allocated (0x%08x). THIS IS BAD!",
               pid, total_sz, si->name, si->size);
         goto fail;
     }
 
     TRACE("[ %5d - Finish loading segments for '%s' @ 0x%08x. "
           "Total memory footprint: 0x%08x bytes ]\n", pid, si->name,
           (unsigned)si->base, si->size);
+
+    report_mapping(si->name, si->base, (si->size + PAGE_MASK) & (~PAGE_MASK), 0);
+
     return 0;
 
 fail:
     /* We can just blindly unmap the entire region even though some things
      * were mapped in originally with anonymous and others could have been
      * been mapped in from the file before we failed. The kernel will unmap
      * all the pages in the range, irrespective of how they got there.
      */