+ }
+ break;
+ case e_dw_structure_type:
+ xbt_dynar_foreach(type->members, cursor, member){
+ res = compare_areas_with_type((char *)area1 + member->offset, (char *)area2 + member->offset, types, other_types, member->dw_type_id, region_size, region_type, start_data, pointer_level);
+ if(res == 1)
+ return res;
+ }
+ break;
+ case e_dw_subroutine_type:
+ return -1;
+ break;
+ default:
+ XBT_VERB("Unknown case : %d", type->type);
+ break;
+ }
+
+ return 0;
+}
+
+static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_region_t r2){
+
+ if(!compared_pointers){
+ compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
+ MC_ignore_global_variable("compared_pointers");
+ }else{
+ xbt_dynar_reset(compared_pointers);
+ }
+
+ xbt_dynar_t variables;
+ xbt_dict_t types, other_types;
+ int res;
+ unsigned int cursor = 0;
+ dw_variable_t current_var;
+ size_t offset;
+ void *start_data;
+
+ if(region_type == 2){
+ variables = mc_global_variables_binary;
+ types = mc_variables_type_binary;
+ other_types = mc_variables_type_libsimgrid;
+ start_data = start_data_binary;
+ }else{
+ variables = mc_global_variables_libsimgrid;
+ types = mc_variables_type_libsimgrid;
+ other_types = mc_variables_type_binary;
+ start_data = start_data_libsimgrid;
+ }
+
+ 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;
+
+ 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){
+ XBT_VERB("Global variable %s (%p - %p) is different between snapshots", current_var->name, (char *)r1->data + offset, (char *)r2->data + offset);
+ xbt_dynar_free(&compared_pointers);
+ compared_pointers = NULL;
+ return 1;
+ }
+
+ }
+
+ xbt_dynar_free(&compared_pointers);
+ compared_pointers = NULL;
+
+ return 0;
+
+}
+
+static int compare_local_variables(mc_snapshot_stack_t stack1, mc_snapshot_stack_t stack2, void *heap1, void *heap2){
+
+ if(!compared_pointers){
+ compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
+ MC_ignore_global_variable("compared_pointers");
+ }else{
+ xbt_dynar_reset(compared_pointers);
+ }
+
+ if(xbt_dynar_length(stack1->local_variables) != xbt_dynar_length(stack2->local_variables)){
+ XBT_VERB("Different number of local variables");
+ xbt_dynar_free(&compared_pointers);
+ compared_pointers = NULL;
+ return 1;
+ }else{
+ unsigned int cursor = 0;
+ local_variable_t current_var1, current_var2;
+ int offset1, offset2, res;
+ while(cursor < xbt_dynar_length(stack1->local_variables)){
+ current_var1 = (local_variable_t)xbt_dynar_get_as(stack1->local_variables, cursor, local_variable_t);
+ current_var2 = (local_variable_t)xbt_dynar_get_as(stack2->local_variables, cursor, local_variable_t);
+ if(strcmp(current_var1->name, current_var2->name) != 0 || strcmp(current_var1->frame, current_var2->frame) != 0 || current_var1->ip != current_var2->ip){
+ xbt_dynar_free(&compared_pointers);
+ XBT_VERB("Different name of variable (%s - %s) or frame (%s - %s) or ip (%lu - %lu)", current_var1->name, current_var2->name, current_var1->frame, current_var2->frame, current_var1->ip, current_var2->ip);