-static int data_program_region_compare(void *d1, void *d2, size_t size){
- int distance = 0;
- size_t i = 0;
- int pointer_align;
- void *addr_pointed1 = NULL, *addr_pointed2 = NULL;
-
- for(i=0; i<size; i++){
- if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
- pointer_align = (i / sizeof(void*)) * sizeof(void*);
- addr_pointed1 = *((void **)((char *)d1 + pointer_align));
- addr_pointed2 = *((void **)((char *)d2 + pointer_align));
- if((addr_pointed1 > start_plt_binary && addr_pointed1 < end_plt_binary) || (addr_pointed2 > start_plt_binary && addr_pointed2 < end_plt_binary)){
- continue;
- }else{
- XBT_DEBUG("Different byte (offset=%zu) (%p - %p) in data program region", i, (char *)d1 + i, (char *)d2 + i);
- distance++;
+static int compare_areas_with_type(void *area1, void *area2, mc_snapshot_t snapshot1, mc_snapshot_t snapshot2, mc_object_info_t info, mc_object_info_t other_info, dw_type_t type, int region_size, int region_type, void *start_data, int pointer_level){
+
+ unsigned int cursor = 0;
+ dw_type_t member, subtype, subsubtype;
+ int elm_size, i, res, switch_types = 0;
+ void *addr_pointed1, *addr_pointed2;
+
+ switch(type->type){
+ case DW_TAG_unspecified_type:
+ return 1;
+
+ case DW_TAG_base_type:
+ case DW_TAG_enumeration_type:
+ case DW_TAG_union_type:
+ return (memcmp(area1, area2, type->byte_size) != 0);
+ break;
+ case DW_TAG_typedef:
+ case DW_TAG_volatile_type:
+ case DW_TAG_const_type:
+ return compare_areas_with_type(area1, area2, snapshot1, snapshot2, info, other_info, type->subtype, region_size, region_type, start_data, pointer_level);
+ break;
+ case DW_TAG_array_type:
+ subtype = type->subtype;
+ switch(subtype->type){
+ case DW_TAG_unspecified_type:
+ return 1;
+
+ case DW_TAG_base_type:
+ case DW_TAG_enumeration_type:
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_rvalue_reference_type:
+ case DW_TAG_structure_type:
+ case DW_TAG_class_type:
+ case DW_TAG_union_type:
+ if(subtype->byte_size == 0){ /*declaration of the type, need the complete description */
+ subtype = subtype->other_object_same_type;
+ switch_types = 1;
+ }
+ elm_size = subtype->byte_size;
+ break;
+ case DW_TAG_const_type:
+ case DW_TAG_typedef:
+ case DW_TAG_volatile_type:
+ subsubtype = subtype->subtype;
+ if(subsubtype->byte_size == 0){ /*declaration of the type, need the complete description */
+ subsubtype = subsubtype->other_object_same_type;
+ switch_types = 1;