Merge all remaining changes from branches/PTRCHECK.  These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c
index d9dc42f..1c2b678 100644
--- a/memcheck/mc_leakcheck.c
+++ b/memcheck/mc_leakcheck.c
@@ -85,7 +85,7 @@
 
    n_starts = 1;
    while (True) {
-      starts = VG_(malloc)( n_starts * sizeof(Addr) );
+      starts = VG_(malloc)( "mc.gss.1", n_starts * sizeof(Addr) );
       if (starts == NULL)
          break;
       r = VG_(am_get_segment_starts)( starts, n_starts );
@@ -469,7 +469,7 @@
 	 p->indirect_bytes += lc_markstack[i].indirect;
       } else {
          n_lossrecords ++;
-         p = VG_(malloc)(sizeof(LossRecord));
+         p = VG_(malloc)( "mc.fr.1", sizeof(LossRecord));
          p->loss_mode    = lc_markstack[i].state;
          p->allocated_at = where;
          p->total_bytes  = lc_shadows[i]->szB;
@@ -608,7 +608,8 @@
    VG_(ssort)((void*)mallocs, n_mallocs, 
               sizeof(VgHashNode*), lc_compar);
 
-   malloc_chunk_holds_a_pool_chunk = VG_(calloc)( n_mallocs, sizeof(Bool) );
+   malloc_chunk_holds_a_pool_chunk = VG_(calloc)( "mc.fas.1",
+                                                  n_mallocs, sizeof(Bool) );
 
    *n_shadows = n_mallocs;
 
@@ -620,7 +621,8 @@
          /* We'll need a shadow for this chunk. */
          ++(*n_shadows);
 
-         /* Possibly invalidate the malloc holding the beginning of this chunk. */
+         /* Possibly invalidate the malloc holding the beginning of
+            this chunk. */
          m = find_shadow_for(mc->data, mallocs, n_mallocs);
          if (m != -1 && malloc_chunk_holds_a_pool_chunk[m] == False) {
             tl_assert(*n_shadows > 0);
@@ -641,7 +643,7 @@
    }
 
    tl_assert(*n_shadows > 0);
-   shadows = VG_(malloc)(sizeof(VgHashNode*) * (*n_shadows));
+   shadows = VG_(malloc)("mc.fas.2", sizeof(VgHashNode*) * (*n_shadows));
    s = 0;
 
    /* Copy the mempool chunks into the final array. */
@@ -738,7 +740,8 @@
    lc_max_mallocd_addr = lc_shadows[lc_n_shadows-1]->data
                          + lc_shadows[lc_n_shadows-1]->szB;
 
-   lc_markstack = VG_(malloc)( lc_n_shadows * sizeof(*lc_markstack) );
+   lc_markstack = VG_(malloc)( "mc.ddml.1",
+                               lc_n_shadows * sizeof(*lc_markstack) );
    for (i = 0; i < lc_n_shadows; i++) {
       lc_markstack[i].next = -1;
       lc_markstack[i].state = Unreached;