+void mmalloc_backtrace_display(void *addr){
+
+ size_t block, frag_nb;
+ int type;
+
+ xbt_mheap_t heap = __mmalloc_current_heap ?: (xbt_mheap_t) mmalloc_preinit();
+
+ block = (((char*) (addr) - (char*) heap -> heapbase) / BLOCKSIZE + 1);
+
+ type = heap->heapinfo[block].type;
+
+ switch(type){
+ case -1 : /* Free block */
+ fprintf(stderr, "Asked to display the backtrace of a block that is free. I'm puzzled\n");
+ xbt_abort();
+ break;
+ case 0: /* Large block */
+ mmalloc_backtrace_block_display(heap->heapinfo, block);
+ break;
+ default: /* Fragmented block */
+ frag_nb = RESIDUAL(addr, BLOCKSIZE) >> type;
+ if(heap->heapinfo[block].busy_frag.frag_size[frag_nb] == -1){
+ fprintf(stderr , "Asked to display the backtrace of a fragment that is free. I'm puzzled\n");
+ xbt_abort();
+ }
+ mmalloc_backtrace_fragment_display(heap->heapinfo, block, frag_nb);
+ break;
+ }
+
+}
+