}
void mmalloc_backtrace_fragment_display(xbt_mheap_t mdp, size_t block, size_t frag){
-
+
xbt_ex_t e;
memcpy(&e.bt,&(mdp->heapinfo[block].busy_frag.bt[frag]),sizeof(void*)*XBT_BACKTRACE_SIZE);
}
void* s_heap = (char *)mmalloc_get_current_heap() - STD_HEAP_SIZE - getpagesize();
-
+
void *heapbase1 = (char *)mdp1 + BLOCKSIZE;
void *heapbase2 = (char *)mdp2 + BLOCKSIZE;
fprintf(stderr,"Different size of a large cluster : %zu - %zu\n", mdp1->heapinfo[i].busy_block.size, mdp2->heapinfo[i].busy_block.size);
fflush(NULL);
errors++;
- }
+ }
if(mdp1->heapinfo[i].busy_block.busy_size != mdp2->heapinfo[i].busy_block.busy_size){
fprintf(stderr,"Different busy_size of a large cluster : %zu - %zu\n", mdp1->heapinfo[i].busy_block.busy_size, mdp2->heapinfo[i].busy_block.busy_size);
fflush(NULL);
errors++;
- }
+ }
-
/* Hamming distance on different blocks */
distance = 0;
fprintf(stderr, "Different byte (offset=%d) (%p - %p) in block %zu\n", k, (char *)addr_block1 + k, (char *)addr_block2 + k, i); fflush(NULL);
pointer_align = (k / sizeof(void*)) * sizeof(void*);
address_pointed1 = *((void **)((char *)addr_block1 + pointer_align));
- address_pointed2 = *((void **)((char *)addr_block2 + pointer_align));
+ address_pointed2 = *((void **)((char *)addr_block2 + pointer_align));
if(((address_pointed1 > (void *)s_heap) && (address_pointed1 < mdp1->breakval)) && ((address_pointed2 > (void *)s_heap) && (address_pointed2 < mdp2->breakval))){
block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) % BLOCKSIZE;
block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) % BLOCKSIZE;
fprintf(stderr, "Pointers on blocks with different types \n");
distance++;
}
-
}else{
/* FIXME : peut pointer vers le début d'un fragment mais dans un bloc */
fprintf(stderr, "Pointed addresses (%p - %p) not valid\n", address_pointed1, address_pointed2);
fprintf(stderr, "Pointed addresses (%p - %p) not in std_heap\n", address_pointed1, address_pointed2);
distance++;
}
-
}
}
}
mmalloc_backtrace_block_display(mdp1, i);
mmalloc_backtrace_block_display(mdp2, i);
fprintf(stderr, "\n");
- errors++;
+ errors++;
total_distance += distance;
}
-
-
+
i++;
-
+
}else{
-
+
if(mdp1->heapinfo[i].type > 0){ /* busy fragmented block */
if(mdp1->heapinfo[i].type != mdp2->heapinfo[i].type){
if(mdp1->heapinfo[i].busy_frag.nfree != mdp2->heapinfo[i].busy_frag.nfree){
fprintf(stderr,"Different free fragments in fragmented block %zu : %zu - %zu\n", i, mdp1->heapinfo[i].busy_frag.nfree, mdp2->heapinfo[i].busy_frag.nfree); fflush(NULL);
errors++;
- }
-
+ }
+
if(mdp1->heapinfo[i].busy_frag.first != mdp2->heapinfo[i].busy_frag.first){
fprintf(stderr,"Different busy_size of a large cluster : %zu - %zu\n", mdp1->heapinfo[i].busy_block.busy_size, mdp2->heapinfo[i].busy_block.busy_size); fflush(NULL);
errors++;
- }
+ }
frag_size = pow(2, mdp1->heapinfo[i].type);
}
if(mdp1->heapinfo[i].busy_frag.frag_size[j] > 0){
-
+
addr_frag1 = (char *)addr_block1 + (j * frag_size);
xbt_assert(addr_frag1 < breakval1, "Fragment address out of heap memory used");
fprintf(stderr, "Different byte (offset=%d) (%p - %p) in fragment %zu in block %zu\n", k, (char *)addr_frag1 + k, (char *)addr_frag2 + k, j, i); fflush(NULL);
pointer_align = (k / sizeof(void*)) * sizeof(void*);
address_pointed1 = *((void **)((char *)addr_frag1 + pointer_align));
- address_pointed2 = *((void **)((char *)addr_frag2 + pointer_align));
+ address_pointed2 = *((void **)((char *)addr_frag2 + pointer_align));
if(((address_pointed1 > (void *)s_heap) && (address_pointed1 < mdp1->breakval)) && ((address_pointed2 > (void *)s_heap) && (address_pointed2 < mdp2->breakval))){
block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) % BLOCKSIZE;
block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) % BLOCKSIZE;
}
}
-
+
if(distance > 0){
fprintf(stderr,"\nDifferent data in fragment %zu (size = %zu, size used = %hu) in block %zu \n", j, frag_size, mdp1->heapinfo[i].busy_frag.frag_size[j], i);
fprintf(stderr, "Hamming distance between fragments : %d\n", distance);
fprintf(stderr, "\n");
errors++;
total_distance += distance;
-
+
}
}
i++;
}
-
+
}
}
/* size_t n = 0; /\* Amount of bytes to read by getline *\/ */
/* fp = fopen("/proc/self/maps", "r"); */
-
+
/* if(fp == NULL) */
/* perror("fopen failed"); */