X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3d50752e785a7b4931b3a95ea45f29cb33b72779..f6685af216f3e5c4d8c2dfd184c64ab1f0489646:/src/mc/mc_checkpoint.c diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index c1e8ea98aa..f2d404ba14 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -1,3 +1,4 @@ +#include #include "private.h" static mc_mem_region_t MC_region_new(void *start_addr, size_t size); @@ -40,19 +41,29 @@ static void MC_snapshot_add_region(mc_snapshot_t snapshot, void *start_addr, siz void MC_take_snapshot(mc_snapshot_t snapshot) { - unsigned int i; + unsigned int i = 0; s_map_region reg; memory_map_t maps = get_memory_map(); - /* Save all the writable mapped pages except the raw_heap and the stack */ - for (i = 0; i < maps->mapsize; i++) { + /* Save the std heap and the writable mapped pages of libsimgrid */ + while (i < maps->mapsize) { reg = maps->regions[i]; - if((reg.prot & PROT_WRITE) && reg.start_addr != raw_heap - && (reg.pathname == NULL || strncmp(reg.pathname, "[stack]", 7))){ - MC_snapshot_add_region(snapshot, reg.start_addr, - (char*)reg.end_addr - (char*)reg.start_addr); + if ((reg.prot & PROT_WRITE)){ + if (maps->regions[i].pathname == NULL){ + if (reg.start_addr == std_heap){ + MC_snapshot_add_region(snapshot, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); + } + } else { + if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ + MC_snapshot_add_region(snapshot, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); + } + } } + i++; } + + + /* FIXME: free the memory map */ } void MC_restore_snapshot(mc_snapshot_t snapshot)