Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Merge add_compared_pointers and already_compared_pointers into add_compared_pointers
[simgrid.git] / src / mc / mc_compare.c
1 /* Copyright (c) 2012-2013. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <inttypes.h>
8
9 #include "mc_private.h"
10
11 #include "xbt/mmalloc.h"
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, mc,
14                                 "Logging specific to mc_compare");
15
16 typedef struct s_pointers_pair{
17   void *p1;
18   void *p2;
19 }s_pointers_pair_t, *pointers_pair_t;
20
21 __thread xbt_dynar_t compared_pointers;
22
23 /************************** Free functions ****************************/
24 /********************************************************************/
25
26 static void stack_region_free(stack_region_t s){
27   if(s){
28     xbt_free(s->process_name);
29     xbt_free(s);
30   }
31 }
32
33 static void stack_region_free_voidp(void *s){
34   stack_region_free((stack_region_t) * (void **) s);
35 }
36
37 static void pointers_pair_free(pointers_pair_t p){
38   xbt_free(p);
39 }
40
41 static void pointers_pair_free_voidp(void *p){
42   pointers_pair_free((pointers_pair_t) * (void **)p);
43 }
44
45 /************************** Snapshot comparison *******************************/
46 /******************************************************************************/
47
48 /** \brief Try to add a pair a compared pointers to the set of compared pointers
49  *
50  *  \result !=0 if the pointers were added (they were not in the set),
51  *      0 otherwise (they were already in the set)
52  */
53 static int add_compared_pointers(void *p1, void *p2){
54
55   pointers_pair_t new_pair = xbt_new0(s_pointers_pair_t, 1);
56   new_pair->p1 = p1;
57   new_pair->p2 = p2;
58   
59   if(xbt_dynar_is_empty(compared_pointers)){
60     xbt_dynar_push(compared_pointers, &new_pair);
61     return 1;
62   }
63
64   unsigned int cursor = 0;
65   int start = 0;
66   int end = xbt_dynar_length(compared_pointers) - 1;
67   pointers_pair_t pair = NULL;
68
69   pointers_pair_t* p = (pointers_pair_t*) xbt_dynar_get_ptr(compared_pointers, 0);
70
71   while(start <= end){
72     cursor = (start + end) / 2;
73     pair = p[cursor];
74     if(pair->p1 < p1){
75       start = cursor + 1;
76     } else if(pair->p1 > p1) {
77       end = cursor - 1 ;
78     } else if(pair->p2 < p2){
79       start = cursor + 1;
80     } else if(pair->p2 > p2) {
81       end = cursor - 1 ;
82     } else {
83       pointers_pair_free(new_pair);
84       return 0;
85     }
86   }
87
88   if(pair->p1 < p1)
89     xbt_dynar_insert_at(compared_pointers, cursor + 1, &new_pair);
90   else if(pair->p1 > p1)
91     xbt_dynar_insert_at(compared_pointers, cursor, &new_pair);
92   else if(pair->p2 < p2)
93     xbt_dynar_insert_at(compared_pointers, cursor + 1, &new_pair);
94   else if(pair->p2 > p2)
95     xbt_dynar_insert_at(compared_pointers, cursor, &new_pair);
96   else
97     xbt_die("Unrecheable");
98
99   return 1;
100 }
101
102 static int compare_areas_with_type(void *area1, void *area2, 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){
103
104   unsigned int cursor = 0;
105   dw_type_t member, subtype, subsubtype;
106   int elm_size, i, res, switch_types = 0;
107   void *addr_pointed1, *addr_pointed2;
108
109   switch(type->type){
110   case DW_TAG_base_type:
111   case DW_TAG_enumeration_type:
112   case DW_TAG_union_type:
113     return (memcmp(area1, area2, type->byte_size) != 0);
114     break;
115   case DW_TAG_typedef:
116   case DW_TAG_volatile_type:
117   case DW_TAG_const_type:
118     return compare_areas_with_type(area1, area2, info, other_info, type->subtype, region_size, region_type, start_data, pointer_level);
119     break;
120   case DW_TAG_array_type:
121     subtype = type->subtype;
122     switch(subtype->type){
123     case DW_TAG_base_type:
124     case DW_TAG_enumeration_type:
125     case DW_TAG_pointer_type:
126     case DW_TAG_structure_type:
127     case DW_TAG_union_type:
128       if(subtype->byte_size == 0){ /*declaration of the type, need the complete description */
129           subtype = subtype->other_object_same_type;
130           switch_types = 1;
131       }
132       elm_size = subtype->byte_size;
133       break;
134     case DW_TAG_const_type:
135     case DW_TAG_typedef:
136     case DW_TAG_volatile_type:
137       subsubtype = subtype->subtype;
138       if(subsubtype->byte_size == 0){ /*declaration of the type, need the complete description */
139           subsubtype = subsubtype->other_object_same_type;
140           switch_types = 1;
141       }
142       elm_size = subsubtype->byte_size;
143       break;
144     default : 
145       return 0;
146       break;
147     }
148     for(i=0; i<type->element_count; i++){
149       if(switch_types)
150         res = compare_areas_with_type((char *)area1 + (i*elm_size), (char *)area2 + (i*elm_size), other_info, info, type->subtype, region_size, region_type, start_data, pointer_level);
151       else
152         res = compare_areas_with_type((char *)area1 + (i*elm_size), (char *)area2 + (i*elm_size), info, other_info, type->subtype, region_size, region_type, start_data, pointer_level);
153       if(res == 1)
154         return res;
155     }
156     break;
157   case DW_TAG_pointer_type:
158     if(type->subtype && type->subtype->type == DW_TAG_subroutine_type){
159       addr_pointed1 = *((void **)(area1)); 
160       addr_pointed2 = *((void **)(area2));
161       return (addr_pointed1 != addr_pointed2);
162     }else{
163       addr_pointed1 = *((void **)(area1)); 
164       addr_pointed2 = *((void **)(area2));
165       
166       if(addr_pointed1 == NULL && addr_pointed2 == NULL)
167         return 0;
168       if(!add_compared_pointers(addr_pointed1, addr_pointed2))
169         return 0;
170
171       pointer_level++;
172       
173       // Some cases are not handled here:
174       // * the pointers lead to different areas (one to the heap, the other to the RW segment ...);
175       // * a pointer leads to the read-only segment of the current object;
176       // * a pointer lead to a different ELF object.
177
178       // The pointers are both in the heap:
179       if(addr_pointed1 > std_heap && (char *)addr_pointed1 < (char*) std_heap + STD_HEAP_SIZE){
180         if(!(addr_pointed2 > std_heap && (char *)addr_pointed2 < (char*) std_heap + STD_HEAP_SIZE))
181           return 1;
182         return compare_heap_area(addr_pointed1, addr_pointed2, NULL, info, other_info, type->dw_type_id, pointer_level);
183       }
184
185       // The pointers are both in the current object R/W segment:
186       else if(addr_pointed1 > start_data && (char*)addr_pointed1 <= (char *)start_data + region_size){
187         if(!(addr_pointed2 > start_data && (char*)addr_pointed2 <= (char *)start_data + region_size))
188           return 1;
189         if(type->dw_type_id == NULL)
190           return  (addr_pointed1 != addr_pointed2);
191         else
192           return  compare_areas_with_type(addr_pointed1, addr_pointed2, info, other_info, type->subtype, region_size, region_type, start_data, pointer_level);
193       }
194
195       else{
196         return (addr_pointed1 != addr_pointed2);
197       }
198     }
199     break;
200   case DW_TAG_structure_type:
201     xbt_dynar_foreach(type->members, cursor, member){
202       XBT_DEBUG("Compare member %s", member->name);
203       res = compare_areas_with_type((char *)area1 + member->offset, (char *)area2 + member->offset, info, other_info, member->subtype, region_size, region_type, start_data, pointer_level);
204       if(res == 1)
205         return res;
206     }
207     break;
208   case DW_TAG_subroutine_type:
209     return -1;
210     break;
211   default:
212     XBT_VERB("Unknown case : %d", type->type);
213     break;
214   }
215   
216   return 0;
217 }
218
219 static int compare_global_variables(int region_type, mc_mem_region_t r1, mc_mem_region_t r2){
220
221   if(!compared_pointers){
222     compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
223     MC_ignore_global_variable("compared_pointers");
224   }else{
225     xbt_dynar_reset(compared_pointers);
226   }
227
228   xbt_dynar_t variables;
229   int res;
230   unsigned int cursor = 0;
231   dw_variable_t current_var;
232   size_t offset;
233   void *start_data;
234   void* start_data_binary = mc_binary_info->start_rw;
235   void* start_data_libsimgrid = mc_libsimgrid_info->start_rw;
236
237   mc_object_info_t object_info = NULL;
238   mc_object_info_t other_object_info = NULL;
239   if(region_type == 2){
240     object_info = mc_binary_info;
241     other_object_info = mc_libsimgrid_info;
242     start_data = start_data_binary;
243   }else{
244     object_info = mc_libsimgrid_info;
245     other_object_info = mc_binary_info;
246     start_data = start_data_libsimgrid;
247   }
248   variables = object_info->global_variables;
249
250   xbt_dynar_foreach(variables, cursor, current_var){
251
252     // If the variable is not in this object, skip it:
253     // We do not expect to find a pointer to something which is not reachable
254     // by the global variables.
255     if((char*) current_var->address < (char*) object_info->start_rw
256       || (char*) current_var->address > (char*) object_info->end_rw)
257        continue;
258
259     offset = (char *)current_var->address - (char *)object_info->start_rw;
260
261     dw_type_t bvariable_type = current_var->type;
262     res = compare_areas_with_type((char *)r1->data + offset, (char *)r2->data + offset, object_info, other_object_info, bvariable_type, r1->size, region_type, start_data, 0);
263     if(res == 1){
264       XBT_VERB("Global variable %s (%p - %p) is different between snapshots", current_var->name, (char *)r1->data + offset, (char *)r2->data + offset);
265       xbt_dynar_free(&compared_pointers);
266       compared_pointers = NULL;
267       return 1;
268     }
269
270   }
271
272   xbt_dynar_free(&compared_pointers);
273   compared_pointers = NULL;
274
275   return 0;
276
277 }
278
279 static int compare_local_variables(mc_snapshot_stack_t stack1, mc_snapshot_stack_t stack2, void *heap1, void *heap2){
280   void* start_data_binary = mc_binary_info->start_rw;
281   void* start_data_libsimgrid = mc_libsimgrid_info->start_rw;
282
283   if(!compared_pointers){
284     compared_pointers = xbt_dynar_new(sizeof(pointers_pair_t), pointers_pair_free_voidp);
285     MC_ignore_global_variable("compared_pointers");
286   }else{
287     xbt_dynar_reset(compared_pointers);
288   }
289
290   if(xbt_dynar_length(stack1->local_variables) != xbt_dynar_length(stack2->local_variables)){
291     XBT_VERB("Different number of local variables");
292     xbt_dynar_free(&compared_pointers);
293     compared_pointers = NULL;
294     return 1;
295   }else{
296     unsigned int cursor = 0;
297     local_variable_t current_var1, current_var2;
298     int offset1, offset2, res;
299     while(cursor < xbt_dynar_length(stack1->local_variables)){
300       current_var1 = (local_variable_t)xbt_dynar_get_as(stack1->local_variables, cursor, local_variable_t);
301       current_var2 = (local_variable_t)xbt_dynar_get_as(stack2->local_variables, cursor, local_variable_t);
302       if(strcmp(current_var1->name, current_var2->name) != 0 || strcmp(current_var1->frame, current_var2->frame) != 0 || current_var1->ip != current_var2->ip){
303         xbt_dynar_free(&compared_pointers);
304         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);
305         return 1;
306       }
307       offset1 = (char *)current_var1->address - (char *)std_heap;
308       offset2 = (char *)current_var2->address - (char *)std_heap;
309       XBT_DEBUG("Compare local variable %s of frame %s", current_var1->name, current_var1->frame);
310
311
312       if(current_var1->region == 1) {
313         dw_type_t subtype = current_var1->type;
314         res = compare_areas_with_type( (char *)heap1 + offset1, (char *)heap2 + offset2, mc_libsimgrid_info, mc_binary_info, subtype, 0, 1, start_data_libsimgrid, 0);
315       } else {
316         dw_type_t subtype = current_var2->type;
317         res = compare_areas_with_type( (char *)heap1 + offset1, (char *)heap2 + offset2, mc_binary_info, mc_libsimgrid_info, subtype, 0, 2, start_data_binary, 0);
318       }
319       if(res == 1){
320         XBT_VERB("Local variable %s (%p - %p) in frame %s  is different between snapshots", current_var1->name,(char *)heap1 + offset1, (char *)heap2 + offset2, current_var1->frame);
321         xbt_dynar_free(&compared_pointers);
322         compared_pointers = NULL;
323         return res;
324       }
325       cursor++;
326     }
327     xbt_dynar_free(&compared_pointers);
328     compared_pointers = NULL;
329     return 0;
330   }
331 }
332
333 int snapshot_compare(void *state1, void *state2){
334
335   mc_snapshot_t s1, s2;
336   int num1, num2;
337   
338   if(_sg_mc_property_file && _sg_mc_property_file[0] != '\0'){ /* Liveness MC */
339     s1 = ((mc_visited_pair_t)state1)->graph_state->system_state;
340     s2 = ((mc_visited_pair_t)state2)->graph_state->system_state;
341     num1 = ((mc_visited_pair_t)state1)->num;
342     num2 =  ((mc_visited_pair_t)state2)->num;
343     /* Firstly compare automaton state */
344     /*if(xbt_automaton_state_compare(((mc_pair_t)state1)->automaton_state, ((mc_pair_t)state2)->automaton_state) != 0)
345       return 1;
346     if(xbt_automaton_propositional_symbols_compare_value(((mc_pair_t)state1)->atomic_propositions, ((mc_pair_t)state2)->atomic_propositions) != 0)
347     return 1;*/
348   }else{ /* Safety MC */
349     s1 = ((mc_visited_state_t)state1)->system_state;
350     s2 = ((mc_visited_state_t)state2)->system_state;
351     num1 = ((mc_visited_state_t)state1)->num;
352     num2 = ((mc_visited_state_t)state2)->num;
353   }
354
355   int errors = 0;
356   int res_init;
357
358   xbt_os_timer_t global_timer = xbt_os_timer_new();
359   xbt_os_timer_t timer = xbt_os_timer_new();
360
361   xbt_os_walltimer_start(global_timer);
362
363   #ifdef MC_DEBUG
364     xbt_os_walltimer_start(timer);
365   #endif
366
367   int hash_result = 0;
368   if(_sg_mc_hash) {
369     hash_result = (s1->hash != s2->hash);
370     if(hash_result) {
371       XBT_VERB("(%d - %d) Different hash : 0x%" PRIx64 "--0x%" PRIx64, num1, num2, s1->hash, s2->hash);
372 #ifndef MC_DEBUG
373       return 1;
374 #endif
375     } else {
376       XBT_VERB("(%d - %d) Same hash : 0x%" PRIx64, num1, num2, s1->hash);
377     }
378   }
379
380   int i = 0;
381   size_t size_used1, size_used2;
382   int is_diff = 0;
383
384
385   /* Compare size of stacks */
386   while(i < xbt_dynar_length(s1->stacks)){
387     size_used1 = s1->stack_sizes[i];
388     size_used2 = s2->stack_sizes[i];
389     if(size_used1 != size_used2){
390     #ifdef MC_DEBUG
391       if(is_diff == 0){
392         xbt_os_walltimer_stop(timer);
393         mc_comp_times->stacks_sizes_comparison_time = xbt_os_timer_elapsed(timer);
394       }
395       XBT_DEBUG("(%d - %d) Different size used in stacks : %zu - %zu", num1, num2, size_used1, size_used2);
396       errors++;
397       is_diff = 1;
398     #else
399       #ifdef MC_VERBOSE
400       XBT_VERB("(%d - %d) Different size used in stacks : %zu - %zu", num1, num2, size_used1, size_used2);
401       #endif
402
403       xbt_os_walltimer_stop(timer);
404       xbt_os_timer_free(timer);
405       xbt_os_walltimer_stop(global_timer);
406       mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
407       xbt_os_timer_free(global_timer);
408
409       return 1;
410     #endif  
411     }
412     i++;
413   }
414
415   #ifdef MC_DEBUG
416     if(is_diff == 0)
417       xbt_os_walltimer_stop(timer);
418     xbt_os_walltimer_start(timer);
419   #endif
420
421   /* Init heap information used in heap comparison algorithm */
422   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);
423   if(res_init == -1){
424      #ifdef MC_DEBUG
425     XBT_DEBUG("(%d - %d) Different heap information", num1, num2); 
426         errors++; 
427       #else
428         #ifdef MC_VERBOSE
429         XBT_VERB("(%d - %d) Different heap information", num1, num2); 
430         #endif
431
432         xbt_os_walltimer_stop(global_timer);
433         mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
434         xbt_os_timer_free(global_timer);
435
436         return 1;
437       #endif
438   }
439
440   #ifdef MC_DEBUG
441     xbt_os_walltimer_start(timer);
442   #endif
443
444   /* Stacks comparison */
445   unsigned int  cursor = 0;
446   int diff_local = 0;
447   is_diff = 0;
448   mc_snapshot_stack_t stack1, stack2;
449     
450   while(cursor < xbt_dynar_length(s1->stacks)){
451     stack1 = (mc_snapshot_stack_t)xbt_dynar_get_as(s1->stacks, cursor, mc_snapshot_stack_t);
452     stack2 = (mc_snapshot_stack_t)xbt_dynar_get_as(s2->stacks, cursor, mc_snapshot_stack_t);
453     diff_local = compare_local_variables(stack1, stack2, s1->regions[0]->data, s2->regions[0]->data);
454     if(diff_local > 0){
455       #ifdef MC_DEBUG
456         if(is_diff == 0){
457           xbt_os_walltimer_stop(timer);
458           mc_comp_times->stacks_comparison_time = xbt_os_timer_elapsed(timer);
459         }
460         XBT_DEBUG("(%d - %d) Different local variables between stacks %d", num1, num2, cursor + 1);
461         errors++;
462         is_diff = 1;
463       #else
464         
465         #ifdef MC_VERBOSE
466         XBT_VERB("(%d - %d) Different local variables between stacks %d", num1, num2, cursor + 1);
467         #endif
468           
469         reset_heap_information();
470         xbt_os_walltimer_stop(timer);
471         xbt_os_timer_free(timer);
472         xbt_os_walltimer_stop(global_timer);
473         mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
474         xbt_os_timer_free(global_timer);
475  
476         return 1;
477       #endif
478     }
479     cursor++;
480   }
481
482
483
484  const char* names[3] = { "?", "libsimgrid", "binary" };
485 #ifdef MC_DEBUG
486  double *times[3] = {
487    NULL,
488    &mc_comp_times->libsimgrid_global_variables_comparison_time,
489    &mc_comp_times->binary_global_variables_comparison_time
490  };
491 #endif
492
493  int k=0;
494  for(k=2; k!=0; --k) {
495     #ifdef MC_DEBUG
496       if(is_diff == 0)
497         xbt_os_walltimer_stop(timer);
498       xbt_os_walltimer_start(timer);
499     #endif
500
501   /* Compare global variables */
502   is_diff = compare_global_variables(k, s1->regions[k], s2->regions[k]);
503   if(is_diff != 0){
504     #ifdef MC_DEBUG
505       xbt_os_walltimer_stop(timer);
506       *times[k] = xbt_os_timer_elapsed(timer);
507       XBT_DEBUG("(%d - %d) Different global variables in %s", num1, num2, names[k]);
508       errors++;
509     #else
510       #ifdef MC_VERBOSE
511       XBT_VERB("(%d - %d) Different global variables in %s", num1, num2, names[k]);
512       #endif
513
514       reset_heap_information();
515       xbt_os_walltimer_stop(timer);
516       xbt_os_timer_free(timer);
517       xbt_os_walltimer_stop(global_timer);
518       mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
519       xbt_os_timer_free(global_timer);
520
521       return 1;
522     #endif
523   }
524  }
525
526   #ifdef MC_DEBUG
527     xbt_os_walltimer_start(timer);
528   #endif
529
530   /* Compare heap */
531     if(mmalloc_compare_heap((xbt_mheap_t)s1->regions[0]->data,
532                             (xbt_mheap_t)s2->regions[0]->data,
533                             mc_libsimgrid_info,
534                             mc_binary_info) > 0){
535
536     #ifdef MC_DEBUG
537       xbt_os_walltimer_stop(timer);
538       mc_comp_times->heap_comparison_time = xbt_os_timer_elapsed(timer); 
539       XBT_DEBUG("(%d - %d) Different heap (mmalloc_compare)", num1, num2);
540       errors++;
541     #else
542  
543       #ifdef MC_VERBOSE
544       XBT_VERB("(%d - %d) Different heap (mmalloc_compare)", num1, num2);
545       #endif
546        
547       reset_heap_information();
548       xbt_os_walltimer_stop(timer);
549       xbt_os_timer_free(timer);
550       xbt_os_walltimer_stop(global_timer);
551       mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
552       xbt_os_timer_free(global_timer);
553
554       return 1;
555     #endif
556   }else{
557     #ifdef MC_DEBUG
558       xbt_os_walltimer_stop(timer);
559     #endif
560   }
561
562   reset_heap_information();
563   
564   xbt_os_walltimer_stop(timer);
565   xbt_os_timer_free(timer);
566
567   #ifdef MC_VERBOSE
568     xbt_os_walltimer_stop(global_timer);
569     mc_snapshot_comparison_time = xbt_os_timer_elapsed(global_timer);
570   #endif
571
572   xbt_os_timer_free(global_timer);
573
574   #ifdef MC_DEBUG
575     print_comparison_times();
576   #endif
577
578 #ifdef MC_VERBOSE
579    if(errors || hash_result)
580      XBT_VERB("(%d - %d) Difference found", num1, num2);
581    else
582      XBT_VERB("(%d - %d) No difference found", num1, num2);
583 #endif
584
585 #if defined(MC_DEBUG) && defined(MC_VERBOSE)
586    if(_sg_mc_hash) {
587      // * false positive SHOULD be avoided.
588      // * There MUST not be any false negative.
589
590      XBT_VERB("(%d - %d) State equality hash test is %s %s", num1, num2,
591        (hash_result!=0) == (errors!=0) ? "true" : "false",
592        !hash_result ? "positive" : "negative");
593    }
594 #endif
595
596    return errors > 0 || hash_result;
597   
598 }
599
600 /***************************** Statistics *****************************/
601 /*******************************************************************/
602
603 void print_comparison_times(){
604   XBT_DEBUG("*** Comparison times ***");
605   XBT_DEBUG("- Nb processes : %f", mc_comp_times->nb_processes_comparison_time);
606   XBT_DEBUG("- Nb bytes used : %f", mc_comp_times->bytes_used_comparison_time);
607   XBT_DEBUG("- Stacks sizes : %f", mc_comp_times->stacks_sizes_comparison_time);
608   XBT_DEBUG("- Binary global variables : %f", mc_comp_times->binary_global_variables_comparison_time);
609   XBT_DEBUG("- Libsimgrid global variables : %f", mc_comp_times->libsimgrid_global_variables_comparison_time);
610   XBT_DEBUG("- Heap : %f", mc_comp_times->heap_comparison_time);
611   XBT_DEBUG("- Stacks : %f", mc_comp_times->stacks_comparison_time);
612 }
613
614 /**************************** MC snapshot compare simcall **************************/
615 /***********************************************************************************/
616
617 int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall,
618                                    mc_snapshot_t s1, mc_snapshot_t s2){
619   return snapshot_compare(s1, s2);
620 }
621
622 int MC_compare_snapshots(void *s1, void *s2){
623   
624   MC_ignore_local_variable("self", "simcall_BODY_mc_snapshot");
625   return simcall_mc_compare_snapshots(s1, s2);
626
627 }