Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] In compare_global_variables only compare values in the R/W segment
[simgrid.git] / src / mc / mc_compare.c
index 4eae390..fad3371 100644 (file)
@@ -268,10 +268,14 @@ static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_
 
   xbt_dynar_foreach(variables, cursor, current_var){
 
-    if(region_type == 2)
-      offset = (char *)current_var->address.address - (char *)start_data_binary;
-    else
-      offset = (char *)current_var->address.address - (char *)start_data_libsimgrid;
+    // If the variable is not in this object, skip it:
+    // We do not expect to find a pointer to something which is not reachable
+    // by the global variables.
+    if((char*) current_var->address.address < (char*) object_info->start_rw
+      || (char*) current_var->address.address > (char*) object_info->end_rw)
+       continue;
+
+    offset = (char *)current_var->address.address - (char *)object_info->start_rw;
 
     res = compare_areas_with_type((char *)r1->data + offset, (char *)r2->data + offset, types, other_types, current_var->type_origin, r1->size, region_type, start_data, 0);
     if(res == 1){