-
-
-/********************************* Backtrace ***********************************/
-/******************************************************************************/
-
-static void mmalloc_backtrace_block_display(void *heapinfo, int block)
-{
-
- /* xbt_ex_t e; */
-
- /* if (((malloc_info *)heapinfo)[block].busy_block.bt_size == 0) { */
- /* fprintf(stderr, "No backtrace available for that block, sorry.\n"); */
- /* return; */
- /* } */
-
- /* memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_block.bt),sizeof(void*)*XBT_BACKTRACE_SIZE); */
- /* e.used = ((malloc_info *)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 %d was malloced (%d frames):\n", block ,e.used); */
- /* for (i = 0; i < e.used; i++) /\* no need to display "xbt_backtrace_display" *\/{ */
- /* fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4); */
- /* } */
- /* } */
-}
-
-static void mmalloc_backtrace_fragment_display(void *heapinfo, int block,
- int frag)
-{
-
- /* xbt_ex_t e; */
-
- /* memcpy(&e.bt,&(((malloc_info *)heapinfo)[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE); */
- /* e.used = XBT_BACKTRACE_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 fragment %d in block %d was malloced (%d frames):\n", frag, block ,e.used); */
- /* for (i = 0; i < e.used; i++) /\* no need to display "xbt_backtrace_display" *\/{ */
- /* fprintf(stderr, "%d ---> %s\n",i, e.bt_strings[i] + 4); */
- /* } */
- /* } */
-
-}
-
-static void mmalloc_backtrace_display(void *addr)
-{
-
- /* size_t block, frag_nb; */
- /* int type; */
-
- /* block = (((char*) (addr) - (char*) heap -> heapbase) / BLOCKSIZE + 1); */
-
- /* type = heap->heapinfo[block].type; */
-
- /* switch(type){ */
- /* case MMALLOC_TYPE_HEAPINFO : */
- /* case MMALLOC_TYPE_FREE : /\* 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; */
- /* } */
-}
-
-
-static int compare_backtrace(int b1, int f1, int b2, int f2)
-{
- /*int i = 0;
- if(f1 != -1){
- for(i=0; i< XBT_BACKTRACE_SIZE; i++){
- if(heapinfo1[b1].busy_frag.bt[f1][i] != heapinfo2[b2].busy_frag.bt[f2][i]){
- //mmalloc_backtrace_fragment_display((void*)heapinfo1, b1, f1);
- //mmalloc_backtrace_fragment_display((void*)heapinfo2, b2, f2);
- return 1;
- }
- }
- }else{
- for(i=0; i< heapinfo1[b1].busy_block.bt_size; i++){
- if(heapinfo1[b1].busy_block.bt[i] != heapinfo2[b2].busy_block.bt[i]){
- //mmalloc_backtrace_block_display((void*)heapinfo1, b1);
- //mmalloc_backtrace_block_display((void*)heapinfo2, b2);
- return 1;
- }
- }
- } */
- return 0;
-}
-
-