From f6685af216f3e5c4d8c2dfd184c64ab1f0489646 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 19 Apr 2011 17:59:32 +0200 Subject: [PATCH] fix MC in 32bit [Marion, still learning git -- shame on Lucas] --- src/mc/mc_checkpoint.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index a43de263c4..f2d404ba14 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -42,32 +42,26 @@ 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 = 0; - char copy = 0; s_map_region reg; memory_map_t maps = get_memory_map(); - /* Save the std heap and the writtable mapped pages of libsimgrid */ - while(i < maps->mapsize - && (maps->regions[i].pathname == NULL - || memcmp(maps->regions[i].pathname, "/lib/ld", 7))){ - reg = maps->regions[i]; - if((reg.prot & PROT_WRITE)){ - if(reg.start_addr == std_heap){ - MC_snapshot_add_region(snapshot, reg.start_addr, - (char*)reg.end_addr - (char*)reg.start_addr); - - }else if(copy || (reg.pathname != NULL - && !memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10))){ - MC_snapshot_add_region(snapshot, reg.start_addr, - (char*)reg.end_addr - (char*)reg.start_addr); - /* This will force the save of the regions in the next iterations, - * but we assume that ld will be found mapped and break the loop - * before saving a wrong region.(This is ugly I know). */ - copy = TRUE; + /* 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){ + 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++; } + i++; + } + /* FIXME: free the memory map */ } -- 2.20.1