Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : detect pointers on valid fragment in heap comparison algorithm
[simgrid.git] / src / mc / mc_liveness.c
1 /* Copyright (c) 2008-2012 Da SimGrid Team. All rights reserved.            */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "mc_private.h"
7 #include <unistd.h>
8
9 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
10                                 "Logging specific to algorithms for liveness properties verification");
11
12 xbt_dynar_t reached_pairs;
13 xbt_dynar_t reached_pairs_hash;
14 xbt_dynar_t visited_pairs;
15 xbt_dynar_t visited_pairs_hash;
16 xbt_dynar_t successors;
17
18 xbt_dynar_t hosts_table;
19
20
21 /* fast implementation of djb2 algorithm */
22 unsigned int hash_region(char *str, int str_len){
23
24   int c;
25   register unsigned int hash = 5381;
26
27   while (str_len--) {
28     c = *str++;
29     hash = ((hash << 5) + hash) + c;    /* hash * 33 + c */
30   }
31
32   return hash;
33
34 }
35
36 int data_program_region_compare(void *d1, void *d2, size_t size){
37   int distance = 0;
38   int i;
39   
40   for(i=0; i<size; i++){
41     if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
42       fprintf(stderr,"Different byte (offset=%d) (%p - %p) in data program region\n", i, (char *)d1 + i, (char *)d2 + i);
43       distance++;
44     }
45   }
46   
47   fprintf(stderr, "Hamming distance between data program regions : %d\n", distance);
48
49   return distance;
50 }
51
52 int data_libsimgrid_region_compare(void *d1, void *d2, size_t size){
53   int distance = 0;
54   int i;
55   
56   for(i=0; i<size; i++){
57     if(memcmp(((char *)d1) + i, ((char *)d2) + i, 1) != 0){
58       fprintf(stderr, "Different byte (offset=%d) (%p - %p) in data libsimgrid region\n", i, (char *)d1 + i, (char *)d2 + i);
59       distance++;
60     }
61   }
62   
63   fprintf(stderr, "Hamming distance between data libsimgrid regions : %d\n", distance);
64   
65   return distance;
66 }
67
68 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
69
70   
71   if(s1->num_reg != s2->num_reg){
72     XBT_INFO("Different num_reg (s1 = %u, s2 = %u)", s1->num_reg, s2->num_reg);
73     return 1;
74   }
75
76   int i;
77   int errors = 0;
78
79   for(i=0 ; i< s1->num_reg ; i++){
80
81     if(s1->regions[i]->type != s2->regions[i]->type){
82       XBT_INFO("Different type of region");
83       errors++;
84     }
85
86     switch(s1->regions[i]->type){
87     case 0:
88       if(s1->regions[i]->size != s2->regions[i]->size){
89         XBT_INFO("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
90         errors++;
91       }
92       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
93         XBT_INFO("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
94         errors++;
95       }
96       if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
97         XBT_INFO("Different heap (mmalloc_compare)");
98         errors++; 
99       }
100       break;
101     case 1 :
102       if(s1->regions[i]->size != s2->regions[i]->size){
103         XBT_INFO("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
104         errors++;
105       }
106       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
107         XBT_INFO("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
108         errors++;
109       }
110       if(data_libsimgrid_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
111         XBT_INFO("Different memcmp for data in libsimgrid");
112         errors++;
113       }
114       break;
115     case 2 :
116       if(s1->regions[i]->size != s2->regions[i]->size){
117         XBT_INFO("Different size of data program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
118         errors++;
119       }
120       if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
121         XBT_INFO("Different start addr of data program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
122         errors++;
123       }
124       if(data_program_region_compare(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
125         XBT_INFO("Different memcmp for data in program");
126         errors++;
127       }
128       break;
129     default:
130       break;
131     }
132   }
133
134   return (errors > 0);
135   
136 }
137
138 int reached(xbt_state_t st){
139
140
141   if(xbt_dynar_is_empty(reached_pairs)){
142
143     return 0;
144
145   }else{
146
147     MC_SET_RAW_MEM;
148
149     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
150     MC_take_snapshot_liveness(sn);    
151     
152     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
153     int res;
154     int_f_void_t f;
155
156     /* Get values of propositional symbols */
157     unsigned int cursor = 0;
158     xbt_propositional_symbol_t ps = NULL;
159     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
160       f = (int_f_void_t)ps->function;
161       res = (*f)();
162       xbt_dynar_push_as(prop_ato, int, res);
163     }
164
165     cursor = 0;
166     mc_pair_reached_t pair_test = NULL;
167
168     //xbt_dict_t current_rdv_points = SIMIX_get_rdv_points();
169      
170     xbt_dynar_foreach(reached_pairs, cursor, pair_test){
171       XBT_INFO("Pair reached #%d", pair_test->nb);
172       if(automaton_state_compare(pair_test->automaton_state, st) == 0){
173         if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
174           //XBT_INFO("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points));
175           //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){
176           //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){
177           if(snapshot_compare(pair_test->system_state, sn) == 0){
178      
179             MC_free_snapshot(sn);
180             xbt_dynar_reset(prop_ato);
181             xbt_free(prop_ato);
182             MC_UNSET_RAW_MEM;
183             return 1;
184           }
185           /* }
186              }else{
187              XBT_INFO("Different size of rdv points (%d - %d)",xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points) );
188              }*/
189         }else{
190           XBT_INFO("Different values of propositional symbols");
191         }
192       }else{
193         XBT_INFO("Different automaton state");
194       }
195     }
196
197     MC_free_snapshot(sn);
198     xbt_dynar_reset(prop_ato);
199     xbt_free(prop_ato);
200     MC_UNSET_RAW_MEM;
201     return 0;
202     
203   }
204 }
205
206 int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2){ /* d1 = pair_test, d2 = current_pair */ 
207   
208   xbt_dict_cursor_t cursor_dict = NULL;
209   char *key;
210   char *data;
211   smx_rdv_t rdv1, rdv2;
212   xbt_fifo_item_t item1, item2;
213   smx_action_t action1, action2;
214   xbt_fifo_item_t item_req1, item_req2;
215   smx_simcall_t req1, req2;
216   int i=0;
217   int j=0;
218
219   xbt_dict_foreach(d1, cursor_dict, key, data){
220     rdv1 = (smx_rdv_t)data;
221     rdv2 = xbt_dict_get_or_null(d2, rdv1->name);
222     if(rdv2 == NULL){
223       XBT_INFO("Rdv point unknown");
224       return 1;
225     }else{
226       if(xbt_fifo_size(rdv1->comm_fifo) != xbt_fifo_size(rdv2->comm_fifo)){
227         XBT_INFO("Different total of actions in mailbox \"%s\" (%d - %d)", rdv1->name, xbt_fifo_size(rdv1->comm_fifo),xbt_fifo_size(rdv2->comm_fifo) );
228         return 1;
229       }else{
230    
231         XBT_INFO("Total of actions in mailbox \"%s\" : %d", rdv1->name, xbt_fifo_size(rdv1->comm_fifo)); 
232    
233         item1 = xbt_fifo_get_first_item(rdv1->comm_fifo);  
234         item2 = xbt_fifo_get_first_item(rdv2->comm_fifo);
235
236         while(i<xbt_fifo_size(rdv1->comm_fifo)){
237           action1 = (smx_action_t) xbt_fifo_get_item_content(item1);
238           action2 = (smx_action_t) xbt_fifo_get_item_content(item2);
239
240           if(action1->type != action2->type){
241             XBT_INFO("Different type of action");
242             return 1;
243           }
244
245           if(action1->state != action2->state){
246             XBT_INFO("Different state of action");
247             return 1;
248           }
249
250           if(xbt_fifo_size(action1->simcalls) != xbt_fifo_size(action2->simcalls)){
251             XBT_INFO("Different size of simcall list (%d - %d", xbt_fifo_size(action1->simcalls), xbt_fifo_size(action2->simcalls));
252             return 1;
253           }else{
254
255             item_req1 = xbt_fifo_get_first_item(action1->simcalls);  
256             item_req2 = xbt_fifo_get_first_item(action2->simcalls);
257
258             while(j<xbt_fifo_size(action1->simcalls)){
259
260               req1 = (smx_simcall_t) xbt_fifo_get_item_content(item_req1);
261               req2 = (smx_simcall_t) xbt_fifo_get_item_content(item_req2);
262          
263               if(req1->call != req2->call){
264                 XBT_INFO("Different simcall call in simcalls of action (%d - %d)", (int)req1->call, (int)req2->call);
265                 return 1;
266               }
267               if(req1->issuer->pid != req2->issuer->pid){
268                 XBT_INFO("Different simcall issuer in simcalls of action (%lu- %lu)", req1->issuer->pid, req2->issuer->pid);
269                 return 1;
270               }
271
272               item_req1 = xbt_fifo_get_next_item(item_req1);  
273               item_req2 = xbt_fifo_get_next_item(item_req2);
274               j++;
275          
276             }
277           }
278
279           switch(action1->type){
280           case 0: /* execution */
281           case 1: /* parallel execution */
282             if(strcmp(action1->execution.host->name, action2->execution.host->name) != 0)
283               return 1;
284             break;
285           case 2: /* comm */
286             if(action1->comm.type != action2->comm.type)
287               return 1;
288             //XBT_INFO("Type of comm : %d", action1->comm.type);
289        
290             switch(action1->comm.type){
291             case 0: /* SEND */
292               if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
293                 return 1;
294               if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
295                 return 1;
296               break;
297             case 1: /* RECEIVE */
298               if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
299                 return 1;
300               if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
301                 return 1;
302               break;
303             case 2: /* READY */
304               if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
305                 return 1;
306               if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
307                 return 1;
308               if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
309                 return 1;
310               if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
311                 return 1;
312               break;
313             case 3: /* DONE */
314               if(action1->comm.src_proc->pid != action2->comm.src_proc->pid)
315                 return 1;
316               if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0)
317                 return 1;
318               if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid)
319                 return 1;
320               if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0)
321                 return 1;
322               break;
323          
324             } /* end of switch on type of comm */
325        
326             if(action1->comm.refcount != action2->comm.refcount)
327               return 1;
328             if(action1->comm.detached != action2->comm.detached)
329               return 1;
330             if(action1->comm.rate != action2->comm.rate)
331               return 1;
332             if(action1->comm.task_size != action2->comm.task_size)
333               return 1;
334             if(action1->comm.src_buff != action2->comm.src_buff)
335               return 1;
336             if(action1->comm.dst_buff != action2->comm.dst_buff)
337               return 1;
338             if(action1->comm.src_data != action2->comm.src_data)
339               return 1;
340             if(action1->comm.dst_data != action2->comm.dst_data)
341               return 1;
342        
343             break;
344           case 3: /* sleep */
345             if(strcmp(action1->sleep.host->name, action2->sleep.host->name) != 0)
346               return 1;
347             break;
348           case 4: /* synchro */
349        
350             break;
351           default:
352             break;
353           }
354
355           item1 = xbt_fifo_get_next_item(item1);  
356           item2 = xbt_fifo_get_next_item(item2);
357           i++;
358         }
359       }
360     }
361   }
362
363   return 0;
364    
365 }
366
367 void set_pair_reached(xbt_state_t st){
368
369  
370   MC_SET_RAW_MEM;
371   
372   mc_pair_reached_t pair = NULL;
373   pair = xbt_new0(s_mc_pair_reached_t, 1);
374   pair->nb = xbt_dynar_length(reached_pairs) + 1;
375   pair->automaton_state = st;
376   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
377   pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
378   //pair->rdv_points = xbt_dict_new();  
379   MC_take_snapshot_liveness(pair->system_state);
380
381   /* Get values of propositional symbols */
382   unsigned int cursor = 0;
383   xbt_propositional_symbol_t ps = NULL;
384   int res;
385   int_f_void_t f;
386
387   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
388     f = (int_f_void_t)ps->function;
389     res = (*f)();
390     xbt_dynar_push_as(pair->prop_ato, int, res);
391   }
392
393   /*xbt_dict_t rdv_points = SIMIX_get_rdv_points();
394
395     xbt_dict_cursor_t cursor_dict = NULL;
396     char *key;
397     char *data;
398     xbt_fifo_item_t item;
399     smx_action_t action;
400
401     xbt_dict_foreach(rdv_points, cursor_dict, key, data){
402     smx_rdv_t new_rdv = xbt_new0(s_smx_rvpoint_t, 1);
403     new_rdv->name = strdup(((smx_rdv_t)data)->name);
404     new_rdv->comm_fifo = xbt_fifo_new();
405     xbt_fifo_foreach(((smx_rdv_t)data)->comm_fifo, item, action, smx_action_t) {
406     smx_action_t a = xbt_new0(s_smx_action_t, 1);
407     memcpy(a, action, sizeof(s_smx_action_t));
408     xbt_fifo_push(new_rdv->comm_fifo, a);
409     XBT_INFO("New action (type = %d, state = %d) in mailbox \"%s\"", action->type, action->state, key);
410     if(action->type==2)
411     XBT_INFO("Type of communication : %d, Ref count = %d", action->comm.type, action->comm.refcount);
412     }
413     //new_rdv->comm_fifo = xbt_fifo_copy(((smx_rdv_t)data)->comm_fifo);
414     xbt_dict_set(pair->rdv_points, new_rdv->name, new_rdv, NULL);
415     }*/
416  
417   xbt_dynar_push(reached_pairs, &pair); 
418
419   MC_UNSET_RAW_MEM;
420   
421 }
422
423
424 int reached_hash(xbt_state_t st){
425
426
427   if(xbt_dynar_is_empty(reached_pairs_hash)){
428
429     return 0;
430
431   }else{
432
433     MC_SET_RAW_MEM;
434
435     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
436     MC_take_snapshot_liveness(sn);
437
438     int j;
439     unsigned int hash_regions[sn->num_reg];
440     for(j=0; j<sn->num_reg; j++){
441       hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
442     }
443
444
445     /* Get values of propositional symbols */
446     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
447     unsigned int cursor = 0;
448     xbt_propositional_symbol_t ps = NULL;
449     int res;
450     int_f_void_t f;
451
452     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
453       f = (int_f_void_t)ps->function;
454       res = (*f)();
455       xbt_dynar_push_as(prop_ato, int, res);
456     }
457
458     mc_pair_reached_hash_t pair_test = NULL;
459
460     int region_diff = 0;
461
462     cursor = 0;
463
464     xbt_dynar_foreach(reached_pairs_hash, cursor, pair_test){
465
466       if(automaton_state_compare(pair_test->automaton_state, st) == 0){
467         if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
468           for(j=0 ; j< sn->num_reg ; j++){
469             if(hash_regions[j] != pair_test->hash_regions[j]){
470               region_diff++;
471             }
472           }
473           if(region_diff == 0){
474             MC_free_snapshot(sn);
475             xbt_dynar_reset(prop_ato);
476             xbt_free(prop_ato);
477             MC_UNSET_RAW_MEM;
478             return 1;
479           }else{
480             XBT_INFO("Different snapshot");
481           }
482         }else{
483           XBT_INFO("Different values of propositional symbols");
484         }
485       }else{
486         XBT_INFO("Different automaton state");
487       }
488
489       region_diff = 0;
490     }
491     
492     MC_free_snapshot(sn);
493     xbt_dynar_reset(prop_ato);
494     xbt_free(prop_ato);
495     MC_UNSET_RAW_MEM;
496     return 0;
497     
498   }
499 }
500
501 void set_pair_reached_hash(xbt_state_t st){
502  
503   MC_SET_RAW_MEM;
504
505   mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
506   MC_take_snapshot_liveness(sn);
507  
508   mc_pair_reached_hash_t pair = NULL;
509   pair = xbt_new0(s_mc_pair_reached_hash_t, 1);
510   pair->automaton_state = st;
511   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
512   pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
513   
514   int i;
515
516   for(i=0 ; i< sn->num_reg ; i++){
517     pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
518   }
519   
520   /* Get values of propositional symbols */
521   unsigned int cursor = 0;
522   xbt_propositional_symbol_t ps = NULL;
523   int res;
524   int_f_void_t f;
525
526   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
527     f = (int_f_void_t)ps->function;
528     res = (*f)();
529     xbt_dynar_push_as(pair->prop_ato, int, res);
530   }
531   
532   xbt_dynar_push(reached_pairs_hash, &pair);
533
534   MC_free_snapshot(sn);
535   
536   MC_UNSET_RAW_MEM;
537     
538 }
539
540
541 int visited(xbt_state_t st, int sc){
542
543
544   if(xbt_dynar_is_empty(visited_pairs)){
545
546     return 0;
547
548   }else{
549
550     MC_SET_RAW_MEM;
551
552     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
553     MC_take_snapshot_liveness(sn);
554
555     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
556
557     /* Get values of propositional symbols */
558     unsigned int cursor = 0;
559     xbt_propositional_symbol_t ps = NULL;
560     int res;
561     int_f_void_t f;
562
563     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
564       f = (int_f_void_t)ps->function;
565       res = (*f)();
566       xbt_dynar_push_as(prop_ato, int, res);
567     }
568
569     cursor = 0;
570     mc_pair_visited_t pair_test = NULL;
571
572     xbt_dynar_foreach(visited_pairs, cursor, pair_test){
573       if(pair_test->search_cycle == sc) {
574         if(automaton_state_compare(pair_test->automaton_state, st) == 0){
575           if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
576             if(snapshot_compare(pair_test->system_state, sn) == 0){
577       
578               MC_free_snapshot(sn);
579               xbt_dynar_reset(prop_ato);
580               xbt_free(prop_ato);
581               MC_UNSET_RAW_MEM;
582     
583               return 1;
584   
585             }else{
586               XBT_INFO("Different snapshot");
587             }
588           }else{
589             XBT_INFO("Different values of propositional symbols"); 
590           }
591         }else{
592           XBT_INFO("Different automaton state");
593         }
594       }else{
595         XBT_INFO("Different value of search_cycle");
596       }
597     }
598
599
600     MC_free_snapshot(sn);
601     xbt_dynar_reset(prop_ato);
602     xbt_free(prop_ato);
603     MC_UNSET_RAW_MEM;
604     return 0;
605     
606   }
607 }
608
609
610 int visited_hash(xbt_state_t st, int sc){
611
612
613   if(xbt_dynar_is_empty(visited_pairs_hash)){
614
615     return 0;
616
617   }else{
618
619     MC_SET_RAW_MEM;
620
621     mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
622     MC_take_snapshot_liveness(sn);
623
624     int j;
625     unsigned int hash_regions[sn->num_reg];
626     for(j=0; j<sn->num_reg; j++){
627       hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
628     }
629
630     
631     /* Get values of propositional symbols */
632     xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
633     unsigned int cursor = 0;
634     xbt_propositional_symbol_t ps = NULL;
635     int res;
636     int_f_void_t f;
637
638     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
639       f = (int_f_void_t)ps->function;
640       res = (*f)();
641       xbt_dynar_push_as(prop_ato, int, res);
642     }
643
644     mc_pair_visited_hash_t pair_test = NULL;
645
646     int region_diff = 0;
647     cursor = 0;
648
649     xbt_dynar_foreach(visited_pairs_hash, cursor, pair_test){
650   
651       if(pair_test->search_cycle == sc) {
652         if(automaton_state_compare(pair_test->automaton_state, st) == 0){
653           if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
654             for(j=0 ; j< sn->num_reg ; j++){
655               if(hash_regions[j] != pair_test->hash_regions[j]){
656                 region_diff++;
657               }
658             }
659             if(region_diff == 0){
660               MC_free_snapshot(sn);
661               xbt_dynar_reset(prop_ato);
662               xbt_free(prop_ato);
663               MC_UNSET_RAW_MEM;
664               return 1;
665             }else{
666               //XBT_INFO("Different snapshot");
667             }
668           }else{
669             //XBT_INFO("Different values of propositional symbols"); 
670           }
671         }else{
672           //XBT_INFO("Different automaton state");
673         }
674       }else{
675         //XBT_INFO("Different value of search_cycle");
676       }
677       
678       region_diff = 0;
679     }
680     
681     MC_free_snapshot(sn);
682     xbt_dynar_reset(prop_ato);
683     xbt_free(prop_ato);
684     MC_UNSET_RAW_MEM;
685     return 0;
686     
687   }
688 }
689
690 void set_pair_visited_hash(xbt_state_t st, int sc){
691  
692   MC_SET_RAW_MEM;
693
694   mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
695   MC_take_snapshot_liveness(sn);
696  
697   mc_pair_visited_hash_t pair = NULL;
698   pair = xbt_new0(s_mc_pair_visited_hash_t, 1);
699   pair->automaton_state = st;
700   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
701   pair->search_cycle = sc;
702   pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
703   
704   int i;
705
706   for(i=0 ; i< sn->num_reg ; i++){
707     pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
708   }
709   
710   /* Get values of propositional symbols */
711   unsigned int cursor = 0;
712   xbt_propositional_symbol_t ps = NULL;
713   int res;
714   int_f_void_t f;
715
716   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
717     f = (int_f_void_t)ps->function;
718     res = (*f)();
719     xbt_dynar_push_as(pair->prop_ato, int, res);
720   }
721   
722   xbt_dynar_push(visited_pairs_hash, &pair);
723
724   MC_free_snapshot(sn);
725   
726   MC_UNSET_RAW_MEM;
727     
728 }
729
730 void set_pair_visited(xbt_state_t st, int sc){
731
732  
733   MC_SET_RAW_MEM;
734  
735   mc_pair_visited_t pair = NULL;
736   pair = xbt_new0(s_mc_pair_visited_t, 1);
737   pair->automaton_state = st;
738   pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
739   pair->search_cycle = sc;
740   pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
741   MC_take_snapshot_liveness(pair->system_state);
742
743
744   /* Get values of propositional symbols */
745   unsigned int cursor = 0;
746   xbt_propositional_symbol_t ps = NULL;
747   int res;
748   int_f_void_t f;
749
750   xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
751     f = (int_f_void_t)ps->function;
752     res = (*f)();
753     xbt_dynar_push_as(pair->prop_ato, int, res);
754   }
755   
756   xbt_dynar_push(visited_pairs, &pair);
757   
758   MC_UNSET_RAW_MEM;
759   
760   
761 }
762
763 void MC_pair_delete(mc_pair_t pair){
764   xbt_free(pair->graph_state->proc_status);
765   xbt_free(pair->graph_state);
766   xbt_free(pair);
767 }
768
769
770
771 int MC_automaton_evaluate_label(xbt_exp_label_t l){
772   
773   switch(l->type){
774   case 0 : {
775     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
776     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
777     return (left_res || right_res);
778   }
779   case 1 : {
780     int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
781     int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
782     return (left_res && right_res);
783   }
784   case 2 : {
785     int res = MC_automaton_evaluate_label(l->u.exp_not);
786     return (!res);
787   }
788   case 3 : { 
789     unsigned int cursor = 0;
790     xbt_propositional_symbol_t p = NULL;
791     int_f_void_t f;
792     xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, p){
793       if(strcmp(p->pred, l->u.predicat) == 0){
794         f = (int_f_void_t)p->function;
795         return (*f)();
796       }
797     }
798     return -1;
799   }
800   case 4 : {
801     return 2;
802   }
803   default : 
804     return -1;
805   }
806 }
807
808
809 /********************* Double-DFS stateless *******************/
810
811 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
812   xbt_free(pair->graph_state->proc_status);
813   xbt_free(pair->graph_state);
814   xbt_free(pair);
815 }
816
817 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r){
818   mc_pair_stateless_t p = NULL;
819   p = xbt_new0(s_mc_pair_stateless_t, 1);
820   p->automaton_state = st;
821   p->graph_state = sg;
822   p->requests = r;
823   mc_stats_pair->expanded_pairs++;
824   return p;
825 }
826
827 void MC_ddfs_init(void){
828
829   XBT_INFO("**************************************************");
830   XBT_INFO("Double-DFS init");
831   XBT_INFO("**************************************************");
832
833   mc_pair_stateless_t mc_initial_pair = NULL;
834   mc_state_t initial_graph_state = NULL;
835   smx_process_t process; 
836
837  
838   MC_wait_for_requests();
839
840   MC_SET_RAW_MEM;
841
842   initial_graph_state = MC_state_pair_new();
843   xbt_swag_foreach(process, simix_global->process_list){
844     if(MC_process_is_enabled(process)){
845       MC_state_interleave_process(initial_graph_state, process);
846     }
847   }
848
849   reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
850   //reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
851   //visited_pairs = xbt_dynar_new(sizeof(mc_pair_visited_t), NULL);
852   //visited_pairs_hash = xbt_dynar_new(sizeof(mc_pair_visited_hash_t), NULL);
853   successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
854
855   /* Save the initial state */
856   initial_snapshot_liveness = xbt_new0(s_mc_snapshot_t, 1);
857   MC_take_snapshot_liveness(initial_snapshot_liveness);
858
859   MC_UNSET_RAW_MEM; 
860
861   unsigned int cursor = 0;
862   xbt_state_t state;
863
864   xbt_dynar_foreach(_mc_property_automaton->states, cursor, state){
865     if(state->type == -1){
866       
867       MC_SET_RAW_MEM;
868       mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
869       xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
870       MC_UNSET_RAW_MEM;
871       
872       if(cursor != 0){
873         MC_restore_snapshot(initial_snapshot_liveness);
874         MC_UNSET_RAW_MEM;
875       }
876
877       MC_ddfs(0);
878
879     }else{
880       if(state->type == 2){
881       
882         MC_SET_RAW_MEM;
883         mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
884         xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
885         MC_UNSET_RAW_MEM;
886
887         set_pair_reached(state);
888         //set_pair_reached_hash(state);
889
890         if(cursor != 0){
891           MC_restore_snapshot(initial_snapshot_liveness);
892           MC_UNSET_RAW_MEM;
893         }
894   
895         MC_ddfs(1);
896   
897       }
898     }
899   } 
900
901 }
902
903
904 void MC_ddfs(int search_cycle){
905
906   smx_process_t process;
907   mc_pair_stateless_t current_pair = NULL;
908
909   if(xbt_fifo_size(mc_stack_liveness) == 0)
910     return;
911
912
913   /* Get current pair */
914   current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
915
916   /* Update current state in buchi automaton */
917   _mc_property_automaton->current_state = current_pair->automaton_state;
918
919  
920   XBT_INFO("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness), search_cycle);
921   XBT_INFO("Pair : graph=%p, automaton=%p(%s), %u interleave", current_pair->graph_state, current_pair->automaton_state, current_pair->automaton_state->id, MC_state_interleave_size(current_pair->graph_state));
922  
923   mc_stats_pair->visited_pairs++;
924
925   //sleep(1);
926
927   int value;
928   mc_state_t next_graph_state = NULL;
929   smx_simcall_t req = NULL;
930   char *req_str;
931
932   xbt_transition_t transition_succ;
933   unsigned int cursor = 0;
934   int res;
935
936   mc_pair_stateless_t next_pair = NULL;
937   mc_pair_stateless_t pair_succ;
938   
939   if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){
940
941     //set_pair_visited(current_pair->automaton_state, search_cycle);
942     //set_pair_visited_hash(current_pair->automaton_state, search_cycle);
943
944     //XBT_INFO("Visited pairs : %lu", xbt_dynar_length(visited_pairs));
945     //XBT_INFO("Visited pairs : %lu", xbt_dynar_length(visited_pairs_hash));
946
947     if(current_pair->requests > 0){
948
949       while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
950    
951         /* Debug information */
952
953         MC_SET_RAW_MEM;
954         req_str = MC_request_to_string(req, value);
955         XBT_INFO("Execute: %s", req_str);
956         xbt_free(req_str);
957         MC_UNSET_RAW_MEM;
958
959         MC_state_set_executed_request(current_pair->graph_state, req, value);   
960
961         /* Answer the request */
962         SIMIX_simcall_pre(req, value);
963
964         /* Wait for requests (schedules processes) */
965         MC_wait_for_requests();
966
967
968         MC_SET_RAW_MEM;
969
970         /* Create the new expanded graph_state */
971         next_graph_state = MC_state_pair_new();
972
973         /* Get enabled process and insert it in the interleave set of the next graph_state */
974         xbt_swag_foreach(process, simix_global->process_list){
975           if(MC_process_is_enabled(process)){
976             MC_state_interleave_process(next_graph_state, process);
977           }
978         }
979
980         xbt_dynar_reset(successors);
981
982         MC_UNSET_RAW_MEM;
983
984
985         cursor= 0;
986         xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
987
988           res = MC_automaton_evaluate_label(transition_succ->label);
989
990           if(res == 1){ // enabled transition in automaton
991             MC_SET_RAW_MEM;
992             next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
993             xbt_dynar_push(successors, &next_pair);
994             MC_UNSET_RAW_MEM;
995           }
996
997         }
998
999         cursor = 0;
1000    
1001         xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1002       
1003           res = MC_automaton_evaluate_label(transition_succ->label);
1004   
1005           if(res == 2){ // true transition in automaton
1006             MC_SET_RAW_MEM;
1007             next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1008             xbt_dynar_push(successors, &next_pair);
1009             MC_UNSET_RAW_MEM;
1010           }
1011
1012         }
1013
1014         cursor = 0; 
1015   
1016         xbt_dynar_foreach(successors, cursor, pair_succ){
1017
1018           if(search_cycle == 1){
1019
1020             if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
1021           
1022               if(reached(pair_succ->automaton_state)){
1023                 //if(reached_hash(pair_succ->automaton_state)){
1024         
1025                 XBT_INFO("Next pair (depth = %d, %u interleave) already reached !", xbt_fifo_size(mc_stack_liveness) + 1, MC_state_interleave_size(pair_succ->graph_state));
1026
1027                 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1028                 XBT_INFO("|             ACCEPTANCE CYCLE            |");
1029                 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1030                 XBT_INFO("Counter-example that violates formula :");
1031                 MC_show_stack_liveness(mc_stack_liveness);
1032                 MC_dump_stack_liveness(mc_stack_liveness);
1033                 MC_print_statistics_pairs(mc_stats_pair);
1034                 exit(0);
1035
1036               }else{
1037
1038                 XBT_INFO("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1039         
1040                 set_pair_reached(pair_succ->automaton_state);
1041                 //set_pair_reached_hash(pair_succ->automaton_state);
1042
1043                 XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1044                 //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1045
1046                 MC_SET_RAW_MEM;
1047                 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1048                 MC_UNSET_RAW_MEM;
1049     
1050                 MC_ddfs(search_cycle);
1051
1052               }
1053
1054             }else{
1055
1056               //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1057                 //if(!visited(pair_succ->automaton_state, search_cycle)){
1058     
1059                 MC_SET_RAW_MEM;
1060                 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1061                 MC_UNSET_RAW_MEM;
1062     
1063                 MC_ddfs(search_cycle);
1064     
1065                 /*}else{
1066
1067                 XBT_INFO("Next pair already visited ! ");
1068
1069                 }*/
1070         
1071             }
1072
1073           }else{
1074     
1075             if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1076
1077               XBT_INFO("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1078       
1079               set_pair_reached(pair_succ->automaton_state); 
1080               //set_pair_reached_hash(pair_succ->automaton_state);
1081
1082               search_cycle = 1;
1083
1084               XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1085               //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1086
1087             }
1088
1089             //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1090               //if(!visited(pair_succ->automaton_state, search_cycle)){
1091         
1092               MC_SET_RAW_MEM;
1093               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1094               MC_UNSET_RAW_MEM;
1095         
1096               MC_ddfs(search_cycle);
1097         
1098               /*}else{
1099
1100               XBT_INFO("Next pair already visited ! ");
1101
1102               }*/
1103
1104           }
1105
1106    
1107           /* Restore system before checking others successors */
1108           if(cursor != (xbt_dynar_length(successors) - 1))
1109             MC_replay_liveness(mc_stack_liveness, 1);
1110   
1111     
1112         }
1113
1114         if(MC_state_interleave_size(current_pair->graph_state) > 0){
1115           XBT_INFO("Backtracking to depth %d", xbt_fifo_size(mc_stack_liveness));
1116           MC_replay_liveness(mc_stack_liveness, 0);
1117         }
1118       }
1119
1120  
1121     }else{  /*No request to execute, search evolution in Büchi automaton */
1122
1123       MC_SET_RAW_MEM;
1124
1125       /* Create the new expanded graph_state */
1126       next_graph_state = MC_state_pair_new();
1127
1128       xbt_dynar_reset(successors);
1129
1130       MC_UNSET_RAW_MEM;
1131
1132
1133       cursor= 0;
1134       xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1135
1136         res = MC_automaton_evaluate_label(transition_succ->label);
1137
1138         if(res == 1){ // enabled transition in automaton
1139           MC_SET_RAW_MEM;
1140           next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1141           xbt_dynar_push(successors, &next_pair);
1142           MC_UNSET_RAW_MEM;
1143         }
1144
1145       }
1146
1147       cursor = 0;
1148    
1149       xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
1150       
1151         res = MC_automaton_evaluate_label(transition_succ->label);
1152   
1153         if(res == 2){ // true transition in automaton
1154           MC_SET_RAW_MEM;
1155           next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
1156           xbt_dynar_push(successors, &next_pair);
1157           MC_UNSET_RAW_MEM;
1158         }
1159
1160       }
1161
1162       cursor = 0; 
1163      
1164       xbt_dynar_foreach(successors, cursor, pair_succ){
1165
1166         if(search_cycle == 1){
1167
1168           if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){ 
1169
1170             if(reached(pair_succ->automaton_state)){
1171               //if(reached_hash(pair_succ->automaton_state)){
1172
1173               XBT_INFO("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
1174         
1175               XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1176               XBT_INFO("|             ACCEPTANCE CYCLE            |");
1177               XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
1178               XBT_INFO("Counter-example that violates formula :");
1179               MC_show_stack_liveness(mc_stack_liveness);
1180               MC_dump_stack_liveness(mc_stack_liveness);
1181               MC_print_statistics_pairs(mc_stats_pair);
1182               exit(0);
1183
1184             }else{
1185
1186               XBT_INFO("Next pair (depth = %d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1187         
1188               set_pair_reached(pair_succ->automaton_state);
1189               //set_pair_reached_hash(pair_succ->automaton_state);
1190     
1191               XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1192               //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1193
1194               MC_SET_RAW_MEM;
1195               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1196               MC_UNSET_RAW_MEM;
1197         
1198               MC_ddfs(search_cycle);
1199
1200             }
1201
1202           }else{
1203
1204             //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1205               //if(!visited(pair_succ->automaton_state, search_cycle)){
1206
1207               MC_SET_RAW_MEM;
1208               xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1209               MC_UNSET_RAW_MEM;
1210         
1211               MC_ddfs(search_cycle);
1212         
1213               /*}else{
1214
1215               XBT_INFO("Next pair already visited ! ");
1216
1217               }*/
1218           }
1219       
1220
1221         }else{
1222       
1223           if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1224
1225             set_pair_reached(pair_succ->automaton_state);
1226             //set_pair_reached_hash(pair_succ->automaton_state);
1227             
1228             search_cycle = 1;
1229
1230             XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1231             //XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1232
1233           }
1234
1235           //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1236             //if(!visited(pair_succ->automaton_state, search_cycle)){
1237
1238             MC_SET_RAW_MEM;
1239             xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1240             MC_UNSET_RAW_MEM;
1241       
1242             MC_ddfs(search_cycle);
1243       
1244             /*}else{
1245
1246             XBT_INFO("Next pair already visited ! ");
1247
1248             }*/
1249
1250         }
1251
1252         /* Restore system before checking others successors */
1253         if(cursor != xbt_dynar_length(successors) - 1)
1254           MC_replay_liveness(mc_stack_liveness, 1);
1255
1256    
1257       }
1258            
1259     }
1260     
1261   }else{
1262     
1263     XBT_INFO("Max depth reached");
1264
1265   }
1266
1267   if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){
1268     XBT_INFO("Pair (graph=%p, automaton =%p, search_cycle = %d, depth = %d) shifted in stack, maximum depth reached", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1269   }else{
1270     XBT_INFO("Pair (graph=%p, automaton =%p, search_cycle = %d, depth = %d) shifted in stack", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1271   }
1272
1273   
1274   MC_SET_RAW_MEM;
1275   xbt_fifo_shift(mc_stack_liveness);
1276   if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
1277     xbt_dynar_pop(reached_pairs, NULL);
1278     //xbt_dynar_pop(reached_pairs_hash, NULL);
1279   }
1280   MC_UNSET_RAW_MEM;
1281   
1282   
1283
1284 }
1285
1286
1287 #ifdef SIMGRID_TEST
1288
1289 XBT_TEST_SUITE("mc_liveness", "Model checking liveness properties");
1290 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(mc_liveness);
1291
1292 XBT_TEST_UNIT("snapshots_comparison", test_compare_snapshot, "Comparison of snapshots")
1293 {
1294
1295   MC_SET_RAW_MEM;
1296
1297   /* Save first snapshot */
1298   mc_snapshot_t snapshot1 = xbt_new0(s_mc_snapshot_t, 1);
1299   MC_take_snapshot_liveness(snapshot1);
1300
1301   /* Save second snapshot */
1302   mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1);
1303   MC_take_snapshot_liveness(snapshot2);
1304
1305   MC_UNSET_RAW_MEM;
1306
1307   xbt_test_assert(snapshot_compare(snapshot1, snapshot2) == 0, "Different consecutive snapshot");
1308   
1309
1310 }
1311
1312 XBT_TEST_UNIT("snapshots_comparison2", test2_compare_snapshot, "Comparison of snapshots with modification between")
1313 {
1314
1315   MC_SET_RAW_MEM;
1316
1317   /* Save first snapshot */
1318   mc_snapshot_t snapshot1 = xbt_new0(s_mc_snapshot_t, 1);
1319   MC_take_snapshot_liveness(snapshot1);
1320
1321   MC_UNSET_RAW_MEM;
1322
1323   void *test = snapshot1;
1324   test = (char*)test+1;
1325   char* t= strdup("toto");
1326   t=strdup("tat");
1327
1328   MC_SET_RAW_MEM;
1329
1330   /* Save second snapshot */
1331   mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1);
1332   MC_take_snapshot_liveness(snapshot2);
1333
1334   xbt_test_assert(snapshot_compare(snapshot1, snapshot2) != 0, "Same snapshot with new allocations");
1335
1336   MC_UNSET_RAW_MEM;
1337   
1338
1339 }
1340
1341 #endif