Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use mc_snapshot_read in snapshot_compare (compatibility with per-page snapshots)
[simgrid.git] / src / mc / mc_compare.c
index 9411ceb..0d9389a 100644 (file)
@@ -337,7 +337,7 @@ static int compare_local_variables(mc_snapshot_t snapshot1,
   } else {
     unsigned int cursor = 0;
     local_variable_t current_var1, current_var2;
-    int offset1, offset2, res;
+    int res;
     while (cursor < xbt_dynar_length(stack1->local_variables)) {
       current_var1 =
           (local_variable_t) xbt_dynar_get_as(stack1->local_variables, cursor,
@@ -357,11 +357,8 @@ static int compare_local_variables(mc_snapshot_t snapshot1,
              current_var1->ip, current_var2->ip);
         return 1;
       }
-      offset1 = (char *) current_var1->address - (char *) std_heap;
-      offset2 = (char *) current_var2->address - (char *) std_heap;
       // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram
 
-
         dw_type_t subtype = current_var1->type;
         res =
             compare_areas_with_type(current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1),
@@ -482,10 +479,11 @@ int snapshot_compare(void *state1, void *state2)
 #endif
 
   /* Init heap information used in heap comparison algorithm */
-  res_init =
-      init_heap_information((xbt_mheap_t) s1->regions[0]->data,
-                            (xbt_mheap_t) s2->regions[0]->data, s1->to_ignore,
-                            s2->to_ignore);
+  xbt_mheap_t heap1 = (xbt_mheap_t) mc_snapshot_read(std_heap, s1,
+    alloca(sizeof(struct mdesc)), sizeof(struct mdesc));
+  xbt_mheap_t heap2 = (xbt_mheap_t) mc_snapshot_read(std_heap, s2,
+    alloca(sizeof(struct mdesc)), sizeof(struct mdesc));
+  res_init = init_heap_information(heap1, heap2, s1->to_ignore, s2->to_ignore);
   if (res_init == -1) {
 #ifdef MC_DEBUG
     XBT_DEBUG("(%d - %d) Different heap information", num1, num2);