void mmalloc_set_current_heap(xbt_mheap_t new_heap);
xbt_mheap_t mmalloc_get_current_heap(void);
-int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2, void* s_heap);
+int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2);
void mmalloc_backtrace_display(xbt_mheap_t mdp, void *addr);
return distance;
}
-int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap){
+int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
if(s1->num_reg != s2->num_reg){
XBT_INFO("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
errors++;
}
- if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, s_heap)){
+ if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
XBT_INFO("Different heap (mmalloc_compare)");
errors++;
}
//XBT_INFO("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points));
//if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){
//if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){
- if(snapshot_compare(pair_test->system_state, sn, std_heap) == 0){
+ if(snapshot_compare(pair_test->system_state, sn) == 0){
MC_free_snapshot(sn);
xbt_dynar_reset(prop_ato);
if(pair_test->search_cycle == sc) {
if(automaton_state_compare(pair_test->automaton_state, st) == 0){
if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
- if(snapshot_compare(pair_test->system_state, sn, std_heap) == 0){
+ if(snapshot_compare(pair_test->system_state, sn) == 0){
MC_free_snapshot(sn);
xbt_dynar_reset(prop_ato);
MC_UNSET_RAW_MEM;
- xbt_test_assert(snapshot_compare(snapshot1, snapshot2, std_heap, raw_heap) == 0, "Different consecutive snapshot");
+ xbt_test_assert(snapshot_compare(snapshot1, snapshot2) == 0, "Different consecutive snapshot");
}
MC_UNSET_RAW_MEM;
- xbt_test_assert(snapshot_compare(snapshot1, snapshot2, std_heap) != 0, "Same snapshot with new allocations");
+ xbt_test_assert(snapshot_compare(snapshot1, snapshot2) != 0, "Same snapshot with new allocations");
}
void set_pair_reached(xbt_state_t st);
int reached_hash(xbt_state_t st);
void set_pair_reached_hash(xbt_state_t st);
-int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap);
+int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2);
int data_program_region_compare(void *d1, void *d2, size_t size);
int data_libsimgrid_region_compare(void *d1, void *d2, size_t size);
void MC_pair_delete(mc_pair_t pair);
}
}
-int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2, void* s_heap){
+int mmalloc_compare_heap(xbt_mheap_t mdp1, xbt_mheap_t mdp2){
if(mdp1 == NULL && mdp2 == NULL){
fprintf(stderr, "Malloc descriptors null\n");
return 0;
}
- int errors = mmalloc_compare_mdesc(mdp1, mdp2, s_heap);
+ int errors = mmalloc_compare_mdesc(mdp1, mdp2);
return (errors > 0);
}
-int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap){
+int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2){
int errors = 0;
//void* heapbase1 = (char *)mdp1 + ((char *)mdp1->heapbase - (char *)s_heap);
//void* heapbase2 = (char *)mdp2 + ((char *)mdp2->heapbase - (char *)s_heap);
+
+ xbt_mheap_t s_heap = mmalloc_get_current_heap();
void *heapbase1 = (char *)mdp1 + BLOCKSIZE;
void *heapbase2 = (char *)mdp2 + BLOCKSIZE;
pointer_align = (k / sizeof(void*)) * sizeof(void*);
address_pointed1 = *((void **)((char *)addr_block1 + pointer_align));
address_pointed2 = *((void **)((char *)addr_block2 + pointer_align));
- if(((address_pointed1 > s_heap) && (address_pointed1 < end_heap)) && ((address_pointed2 > s_heap) && (address_pointed2 < end_heap))){
+ if(((address_pointed1 > (void *)s_heap) && (address_pointed1 < end_heap)) && ((address_pointed2 > (void *)s_heap) && (address_pointed2 < end_heap))){
block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
//fprintf(stderr, "Blocks pointed : %d - %d\n", block_pointed1, block_pointed2);
pointer_align = (k / sizeof(void*)) * sizeof(void*);
address_pointed1 = *((void **)((char *)addr_frag1 + pointer_align));
address_pointed2 = *((void **)((char *)addr_frag2 + pointer_align));
- if(((address_pointed1 > s_heap) && (address_pointed1 < end_heap)) && ((address_pointed2 > s_heap) && (address_pointed2 < end_heap))){
+ if(((address_pointed1 > (void *)s_heap) && (address_pointed1 < end_heap)) && ((address_pointed2 > (void *)s_heap) && (address_pointed2 < end_heap))){
block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
//fprintf(stderr, "Blocks pointed : %d - %d\n", block_pointed1, block_pointed2);
}
-void *get_end_addr_heap(void *s_heap){
+void *get_end_addr_heap(void *heap){
FILE *fp; /* File pointer to process's proc maps file */
char *line = NULL; /* Temporal storage for each line that is readed */
start_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 0, char*), NULL, 16);
end_addr = (void *) strtoul(xbt_dynar_get_as(start_end, 1, char*), NULL, 16);
- if(start_addr == s_heap){
+ if(start_addr == heap){
free(line);
fclose(fp);
xbt_dynar_reset(lfields);
};
-int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2, void* s_heap);
+int mmalloc_compare_mdesc(struct mdesc *mdp1, struct mdesc *mdp2);
void mmalloc_display_info(void *h);