X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/57fe5b0979405e769623b751871db271dfb61652..babb079cb238a644531e4cf5aa2dd045d8790b3c:/src/mc/mc_checkpoint.c diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index e9830d5138..4af29d3447 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -76,46 +76,46 @@ static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, void *start return; } -void MC_take_snapshot(mc_snapshot_t snapshot) -{ - unsigned int i = 0; - s_map_region_t reg; - memory_map_t maps = get_memory_map(); - - /* Save the std heap and the writable mapped pages of libsimgrid */ - while (i < maps->mapsize) { - reg = maps->regions[i]; - if ((reg.prot & PROT_WRITE)){ - if (maps->regions[i].pathname == NULL){ - if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one) - MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - } - i++; - } else { - if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ - MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - i++; - reg = maps->regions[i]; - while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){ - MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - i++; - reg = maps->regions[i]; - } - }else{ - i++; - } - } - }else{ - i++; - } - } - - free_memory_map(maps); -} +/* void MC_take_snapshot(mc_snapshot_t snapshot) */ +/* { */ +/* unsigned int i = 0; */ +/* s_map_region_t reg; */ +/* memory_map_t maps = get_memory_map(); */ + +/* /\* Save the std heap and the writable mapped pages of libsimgrid *\/ */ +/* while (i < maps->mapsize) { */ +/* reg = maps->regions[i]; */ +/* if ((reg.prot & PROT_WRITE)){ */ +/* if (maps->regions[i].pathname == NULL){ */ +/* if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one) */ +/* MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); */ +/* } */ +/* i++; */ +/* } else { */ +/* if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ */ +/* MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); */ +/* i++; */ +/* reg = maps->regions[i]; */ +/* while(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize){ */ +/* MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); */ +/* i++; */ +/* reg = maps->regions[i]; */ +/* } */ +/* }else{ */ +/* i++; */ +/* } */ +/* } */ +/* }else{ */ +/* i++; */ +/* } */ +/* } */ + +/* free_memory_map(maps); */ +/* } */ void MC_init_memory_map_info(){ - raw_mem_set = (mmalloc_get_current_heap() == raw_heap); + int raw_mem_set = (mmalloc_get_current_heap() == raw_heap); MC_SET_RAW_MEM; @@ -171,11 +171,15 @@ void MC_init_memory_map_info(){ } -mc_snapshot_t MC_take_snapshot_liveness() -{ +mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){ + return MC_take_snapshot(); +} - raw_mem_set = (mmalloc_get_current_heap() == raw_heap); +mc_snapshot_t MC_take_snapshot() +{ + int raw_mem = (mmalloc_get_current_heap() == raw_heap); + MC_SET_RAW_MEM; mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1); @@ -245,13 +249,14 @@ mc_snapshot_t MC_take_snapshot_liveness() } } - snapshot->stacks = take_snapshot_stacks(heap); + if(_surf_mc_visited > 0 || strcmp(_surf_mc_property_file,"")) + snapshot->stacks = take_snapshot_stacks(heap); free_memory_map(maps); MC_UNSET_RAW_MEM; - if(raw_mem_set) + if(raw_mem) MC_SET_RAW_MEM; return snapshot; @@ -296,8 +301,10 @@ void get_libsimgrid_plt_section(){ fp = popen(command, "r"); - if(fp == NULL) + if(fp == NULL){ perror("popen failed"); + xbt_abort(); + } while ((read = getline(&line, &n, fp)) != -1 && plt_not_found == 1) { @@ -352,8 +359,10 @@ void get_binary_plt_section(){ fp = popen(command, "r"); - if(fp == NULL) + if(fp == NULL){ perror("popen failed"); + xbt_abort(); + } while ((read = getline(&line, &n, fp)) != -1 && plt_not_found == 1) {