Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : add backtrace for each fragment allocated with mmalloc
authorMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 28 Feb 2012 09:29:50 +0000 (10:29 +0100)
committerMarion Guthmuller <marion.guthmuller@loria.fr>
Tue, 28 Feb 2012 09:29:50 +0000 (10:29 +0100)
src/xbt/mmalloc/mmalloc.c
src/xbt/mmalloc/mmprivate.h

index b13412b..bbdc937 100644 (file)
@@ -153,7 +153,7 @@ void *mmalloc(xbt_mheap_t mdp, size_t size)
 
       frag_nb = RESIDUAL(result, BLOCKSIZE) >> log;
       mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = requested_size;
 
       frag_nb = RESIDUAL(result, BLOCKSIZE) >> log;
       mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = requested_size;
-      //FIXME setup backtrace
+      xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[frag_nb],XBT_BACKTRACE_SIZE);
 
       next->prev->next = next->next;
       if (next->next != NULL) {
 
       next->prev->next = next->next;
       if (next->next != NULL) {
@@ -184,8 +184,8 @@ void *mmalloc(xbt_mheap_t mdp, size_t size)
         }
       }
       mdp->heapinfo[block].busy_frag.frag_size[0] = requested_size;
         }
       }
       mdp->heapinfo[block].busy_frag.frag_size[0] = requested_size;
-      // FIXME: setup backtrace
-
+      xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[0],XBT_BACKTRACE_SIZE);
+      
       /* Initialize the nfree and first counters for this block.  */
       mdp->heapinfo[block].type = log;
       mdp->heapinfo[block].busy_frag.nfree = i - 1;
       /* Initialize the nfree and first counters for this block.  */
       mdp->heapinfo[block].type = log;
       mdp->heapinfo[block].busy_frag.nfree = i - 1;
index 507a27d..2298c27 100644 (file)
@@ -131,7 +131,7 @@ typedef struct {
       size_t nfree;           /* Free fragments in a fragmented block.  */
       size_t first;           /* First free fragment of the block.  */
       unsigned short frag_size[MAX_FRAGMENT_PER_BLOCK];
       size_t nfree;           /* Free fragments in a fragmented block.  */
       size_t first;           /* First free fragment of the block.  */
       unsigned short frag_size[MAX_FRAGMENT_PER_BLOCK];
-      //void *bt[XBT_BACKTRACE_SIZE][MAX_FRAGMENT_PER_BLOCK]; /* Where it was malloced (or realloced lastly) */
+      void *bt[MAX_FRAGMENT_PER_BLOCK][XBT_BACKTRACE_SIZE]; /* Where it was malloced (or realloced lastly) */
     } busy_frag;
     struct {
       size_t size; /* Size (in blocks) of a large cluster.  */
     } busy_frag;
     struct {
       size_t size; /* Size (in blocks) of a large cluster.  */