X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9933a5cbfedabf7925419be3dc06a319c6943a66..67d9420f78fbf068e11d3f575ebd59a995aeefee:/src/xbt/mmalloc/mm_diff.c diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index 6fc74ec557..fe69f23ef7 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -14,65 +14,24 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mm_diff, xbt, extern char *xbt_binary_name; -void mmalloc_backtrace_display(xbt_mheap_t mdp, void *ptr){ - size_t block = BLOCK(ptr); - int type; - xbt_ex_t e; - - if ((char *) ptr < (char *) mdp->heapbase || block > mdp->heapsize) { - fprintf(stderr,"Ouch, this pointer is not mine. I cannot display its backtrace. I refuse it to death!!\n"); - abort(); - } - - type = mdp->heapinfo[block].type; - - if (type != 0) { - //fprintf(stderr,"Only full blocks are backtraced for now. Ignoring your request.\n"); - return; - } - if (mdp->heapinfo[block].busy_block.bt_size == 0) { - fprintf(stderr,"No backtrace available for that block, sorry.\n"); - return; - } - - memcpy(&e.bt,&(mdp->heapinfo[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE); - e.used = mdp->heapinfo[block].busy_block.bt_size; - - xbt_ex_setup_backtrace(&e); - if (e.used == 0) { - fprintf(stderr, "(backtrace not set)\n"); - } else if (e.bt_strings == NULL) { - fprintf(stderr, "(backtrace not ready to be computed. %s)\n",xbt_binary_name?"Dunno why":"xbt_binary_name not setup yet"); - } else { - int i; - - fprintf(stderr, "Backtrace of where the block %p was malloced (%d frames):\n",ptr,e.used); - for (i = 0; i < e.used; i++) /* no need to display "xbt_backtrace_display" */{ - fprintf(stderr,"%d",i);fflush(NULL); - fprintf(stderr, "---> %s\n", e.bt_strings[i] + 4); - } - } -} - - -void mmalloc_backtrace_block_display(xbt_mheap_t mdp, size_t block){ +void mmalloc_backtrace_block_display(xbt_mheap_t heap, size_t block){ int type; xbt_ex_t e; - type = mdp->heapinfo[block].type; + type = heap->heapinfo[block].type; if (type != 0) { fprintf(stderr,"Only full blocks are backtraced for now. Ignoring your request.\n"); return; } - if (mdp->heapinfo[block].busy_block.bt_size == 0) { + if (heap->heapinfo[block].busy_block.bt_size == 0) { fprintf(stderr,"No backtrace available for that block, sorry.\n"); return; } - memcpy(&e.bt,&(mdp->heapinfo[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE); - e.used = mdp->heapinfo[block].busy_block.bt_size; + memcpy(&e.bt,&(heap->heapinfo[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE); + e.used = heap->heapinfo[block].busy_block.bt_size; xbt_ex_setup_backtrace(&e); if (e.used == 0) { @@ -141,7 +100,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){ void *heapbase2 = (char *)mdp2 + BLOCKSIZE; size_t i, j; - void *addr_block1, *addr_block2, *addr_frag1, *addr_frag2; + void *addr_block1 = NULL, *addr_block2 = NULL, *addr_frag1 = NULL, *addr_frag2 = NULL; size_t frag_size; i = 1; @@ -151,7 +110,7 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){ int total_distance = 0; int pointer_align; - void *address_pointed1, *address_pointed2; + void *address_pointed1 = NULL, *address_pointed2 = NULL; int block_pointed1, block_pointed2, frag_pointed1, frag_pointed2; void *addr_block_pointed1 = NULL, *addr_block_pointed2 = NULL, *addr_frag_pointed1 = NULL, *addr_frag_pointed2 = NULL; @@ -606,9 +565,3 @@ int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){ -void mmalloc_display_info_heap(xbt_mheap_t h){ - -} - - -