X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f0caab39332af0b46570a9be4ec17a1dceefc229..31fd837a0980fd05c51f65c3b20018d70e9c2cb4:/src/mc/mc_checkpoint.c diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index 47d1be9239..984323bf3b 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -112,9 +112,50 @@ void MC_take_snapshot(mc_snapshot_t snapshot) free_memory_map(maps); } -void MC_take_snapshot_liveness(mc_snapshot_t snapshot) +void MC_init_memory_map_info(){ + + unsigned int i = 0; + s_map_region_t reg; + memory_map_t maps = get_memory_map(); + + while (i < maps->mapsize) { + reg = maps->regions[i]; + if ((reg.prot & PROT_WRITE)){ + if (maps->regions[i].pathname == NULL){ + if(reg.start_addr == raw_heap){ + end_raw_heap = reg.end_addr; + } + } else { + if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ + start_data_libsimgrid = reg.start_addr; + } + } + }else if ((reg.prot & PROT_READ)){ + if (maps->regions[i].pathname != NULL){ + if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ + start_text_libsimgrid = reg.start_addr; + libsimgrid_path = strdup(maps->regions[i].pathname); + }else{ + if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){ + start_text_binary = reg.start_addr; + } + } + } + } + i++; + } + +} + +mc_snapshot_t MC_take_snapshot_liveness() { + raw_mem_set = (mmalloc_get_current_heap() == raw_heap); + + MC_SET_RAW_MEM; + + mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1); + unsigned int i = 0; s_map_region_t reg; memory_map_t maps = get_memory_map(); @@ -176,6 +217,13 @@ void MC_take_snapshot_liveness(mc_snapshot_t snapshot) free_memory_map(maps); + MC_UNSET_RAW_MEM; + + if(raw_mem_set) + MC_SET_RAW_MEM; + + return snapshot; + } void MC_restore_snapshot(mc_snapshot_t snapshot) @@ -209,7 +257,10 @@ void get_libsimgrid_plt_section(){ int i, plt_not_found = 1; unsigned long int size, offset; - char *command = bprintf( "objdump --section-headers %s", libsimgrid_path); + if(libsimgrid_path == NULL) + libsimgrid_path = get_libsimgrid_path(); + + char *command = bprintf("objdump --section-headers %s", libsimgrid_path); fp = popen(command, "r"); @@ -246,7 +297,6 @@ void get_libsimgrid_plt_section(){ } } - } free(command);