Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : one region in snapshot for data and bss segments of libsimgrid
[simgrid.git] / src / mc / mc_checkpoint.c
index d23fbf5..0a90046 100644 (file)
@@ -154,6 +154,8 @@ mc_snapshot_t MC_take_snapshot()
   memory_map_t maps = get_memory_map();
   int nb_reg = 0;
   void *heap = NULL;
+  size_t size = 0;
+  void *start = NULL;
 
   /* Save the std heap and the writable mapped pages of libsimgrid */
   while (i < maps->mapsize) {
@@ -170,17 +172,18 @@ mc_snapshot_t MC_take_snapshot()
         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);
-          start_data_libsimgrid = reg.start_addr;
+          size = (char*)reg.end_addr - (char*)reg.start_addr;
+          start = reg.start_addr;
           nb_reg++;
           i++;
           reg = maps->regions[i];
           if(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);
+            size += (char*)reg.end_addr - (char*)reg.start_addr;
             reg = maps->regions[i];
             i++;
             nb_reg++;
           }
+          MC_snapshot_add_region(snapshot, 1, start, size);
         } else {
           if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
             MC_snapshot_add_region(snapshot, 2, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr);
@@ -197,18 +200,6 @@ mc_snapshot_t MC_take_snapshot()
           }
         }
       }
-    }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++;
     }else{
       i++;
     }
@@ -259,9 +250,6 @@ void get_libsimgrid_plt_section(){
   int i, plt_found = 0;
   unsigned long int size, offset;
 
-  if(libsimgrid_path == NULL)
-    libsimgrid_path = get_libsimgrid_path();
-
   char *command = bprintf("objdump --section-headers %s", libsimgrid_path);
 
   fp = popen(command, "r");