1 /* Copyright (c) 2008-2012 Da SimGrid Team. All rights reserved. */
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. */
6 #include "mc_private.h"
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
11 "Logging specific to algorithms for liveness properties verification");
13 xbt_dynar_t reached_pairs;
14 xbt_dynar_t successors;
16 int create_dump(int pair)
18 // Try to enable core dumps
19 struct rlimit core_limit;
20 core_limit.rlim_cur = RLIM_INFINITY;
21 core_limit.rlim_max = RLIM_INFINITY;
23 if(setrlimit(RLIMIT_CORE, &core_limit) < 0)
24 fprintf(stderr, "setrlimit: %s\nWarning: core dumps may be truncated or non-existant\n", strerror(errno));
29 // We are the child process -- run the actual program
34 // An error occurred, shouldn't happen
39 // We are the parent process -- wait for the child process to exit
42 if(WIFSIGNALED(status) && WCOREDUMP(status)){
43 char *core_name = malloc(20);
44 sprintf(core_name,"core_%d", pair);
45 rename("core", core_name);
53 void MC_print_comparison_times_statistics(mc_comparison_times_t ct){
55 XBT_DEBUG("Comparisons done : %d", ct->nb_comparisons);
57 double total, min, max;
60 if(xbt_dynar_length(ct->chunks_used_comparison_times) > 0){
64 min = xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double);
65 while(cursor < xbt_dynar_length(ct->chunks_used_comparison_times) - 1){
66 total += xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double);
67 if(xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double) > max)
68 max = xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double);
69 if(xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double) < min)
70 min = xbt_dynar_get_as(ct->chunks_used_comparison_times, cursor, double);
73 XBT_DEBUG("Chunks used comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->chunks_used_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->chunks_used_comparison_times), max, min);
76 if(xbt_dynar_length(ct->stacks_sizes_comparison_times) > 0){
80 min = xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double);
81 while(cursor < xbt_dynar_length(ct->stacks_sizes_comparison_times) - 1){
82 total += xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double);
83 if(xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double) > max)
84 max = xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double);
85 if(xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double) < min)
86 min = xbt_dynar_get_as(ct->stacks_sizes_comparison_times, cursor, double);
89 XBT_DEBUG("Stacks sizes comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->stacks_sizes_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->stacks_sizes_comparison_times), max, min);
92 if(xbt_dynar_length(ct->program_data_segment_comparison_times) > 0){
96 min = xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double);
97 while(cursor < xbt_dynar_length(ct->program_data_segment_comparison_times) - 1){
98 total += xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double);
99 if(xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double) > max)
100 max = xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double);
101 if(xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double) < min)
102 min = xbt_dynar_get_as(ct->program_data_segment_comparison_times, cursor, double);
105 XBT_DEBUG("Program data/bss segments comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->program_data_segment_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->program_data_segment_comparison_times), max, min);
108 if(xbt_dynar_length(ct->libsimgrid_data_segment_comparison_times) > 0){
112 min = xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double);
113 while(cursor < xbt_dynar_length(ct->libsimgrid_data_segment_comparison_times) - 1){
114 total += xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double);
115 if(xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double) > max)
116 max = xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double);
117 if(xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double) < min)
118 min = xbt_dynar_get_as(ct->libsimgrid_data_segment_comparison_times, cursor, double);
121 XBT_DEBUG("Libsimgrid data/bss segments comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->libsimgrid_data_segment_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->libsimgrid_data_segment_comparison_times), max, min);
124 if(xbt_dynar_length(ct->heap_comparison_times) > 0){
128 min = xbt_dynar_get_as(ct->heap_comparison_times, cursor, double);
129 while(cursor < xbt_dynar_length(ct->heap_comparison_times) - 1){
130 total += xbt_dynar_get_as(ct->heap_comparison_times, cursor, double);
131 if(xbt_dynar_get_as(ct->heap_comparison_times, cursor, double) > max)
132 max = xbt_dynar_get_as(ct->heap_comparison_times, cursor, double);
133 if(xbt_dynar_get_as(ct->heap_comparison_times, cursor, double) < min)
134 min = xbt_dynar_get_as(ct->heap_comparison_times, cursor, double);
137 XBT_DEBUG("Heap comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->heap_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->heap_comparison_times), max, min);
140 if(xbt_dynar_length(ct->stacks_comparison_times) > 0){
144 min = xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double);
145 while(cursor < xbt_dynar_length(ct->stacks_comparison_times) - 1){
146 total += xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double);
147 if(xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double) > max)
148 max = xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double);
149 if(xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double) < min)
150 min = xbt_dynar_get_as(ct->stacks_comparison_times, cursor, double);
153 XBT_DEBUG("Stacks comparison -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->stacks_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->stacks_comparison_times), max, min);
156 if(xbt_dynar_length(ct->snapshot_comparison_times) > 0){
160 min = xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double);
161 while(cursor < xbt_dynar_length(ct->snapshot_comparison_times) - 1){
162 total += xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double);
163 if(xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double) > max)
164 max = xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double);
165 if(xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double) < min)
166 min = xbt_dynar_get_as(ct->snapshot_comparison_times, cursor, double);
169 XBT_DEBUG("Snapshot comparison (Whole funnel) -- Different states : %lu/%d, time (in seconds) : average = %lf, max = %lf, min = %lf", xbt_dynar_length(ct->snapshot_comparison_times), ct->nb_comparisons, total/xbt_dynar_length(ct->snapshot_comparison_times), max, min);
174 mc_comparison_times_t new_comparison_times(){
175 mc_comparison_times_t ct = NULL;
176 ct = xbt_new0(s_mc_comparison_times_t, 1);
177 ct->nb_comparisons = 0;
178 ct->snapshot_comparison_times = xbt_dynar_new(sizeof(double), NULL);
179 ct->chunks_used_comparison_times = xbt_dynar_new(sizeof(double), NULL);
180 ct->stacks_sizes_comparison_times = xbt_dynar_new(sizeof(double), NULL);
181 ct->program_data_segment_comparison_times = xbt_dynar_new(sizeof(double), NULL);
182 ct->libsimgrid_data_segment_comparison_times = xbt_dynar_new(sizeof(double), NULL);
183 ct->heap_comparison_times = xbt_dynar_new(sizeof(double), NULL);
184 ct->stacks_comparison_times = xbt_dynar_new(sizeof(double), NULL);
188 int reached(xbt_state_t st){
190 raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
194 mc_pair_reached_t new_pair = NULL;
195 new_pair = xbt_new0(s_mc_pair_reached_t, 1);
196 new_pair->nb = xbt_dynar_length(reached_pairs) + 1;
197 new_pair->automaton_state = st;
198 new_pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
199 new_pair->comparison_times = new_comparison_times();
200 new_pair->system_state = MC_take_snapshot_liveness();
202 /* Get values of propositional symbols */
205 unsigned int cursor = 0;
206 xbt_propositional_symbol_t ps = NULL;
207 xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
208 f = (int_f_void_t)ps->function;
210 xbt_dynar_push_as(new_pair->prop_ato, int, res);
215 if(xbt_dynar_is_empty(reached_pairs)/* || !compare*/){
218 /* New pair reached */
219 xbt_dynar_push(reached_pairs, &new_pair);
232 mc_pair_reached_t pair_test = NULL;
234 xbt_dynar_foreach(reached_pairs, cursor, pair_test){
235 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug))
236 XBT_DEBUG("****** Pair reached #%d ******", pair_test->nb);
237 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
238 if(propositional_symbols_compare_value(pair_test->prop_ato, new_pair->prop_ato) == 0){
239 if(snapshot_compare(new_pair->system_state, pair_test->system_state, new_pair->comparison_times, pair_test->comparison_times) == 0){
249 XBT_INFO("Different values of propositional symbols");
252 XBT_INFO("Different automaton state");
254 if(pair_test->comparison_times != NULL && XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
255 XBT_DEBUG("*** Comparison times statistics ***");
256 MC_print_comparison_times_statistics(pair_test->comparison_times);
260 /* New pair reached */
261 xbt_dynar_push(reached_pairs, &new_pair);
276 void set_pair_reached(xbt_state_t st){
278 raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
282 mc_pair_reached_t pair = NULL;
283 pair = xbt_new0(s_mc_pair_reached_t, 1);
284 pair->nb = xbt_dynar_length(reached_pairs) + 1;
285 pair->automaton_state = st;
286 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
287 pair->comparison_times = new_comparison_times();
288 pair->system_state = MC_take_snapshot_liveness();
290 /* Get values of propositional symbols */
291 unsigned int cursor = 0;
292 xbt_propositional_symbol_t ps = NULL;
296 xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, ps){
297 f = (int_f_void_t)ps->function;
299 xbt_dynar_push_as(pair->prop_ato, int, res);
302 xbt_dynar_push(reached_pairs, &pair);
311 void MC_pair_delete(mc_pair_t pair){
312 xbt_free(pair->graph_state->proc_status);
313 xbt_free(pair->graph_state);
319 int MC_automaton_evaluate_label(xbt_exp_label_t l){
323 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
324 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
325 return (left_res || right_res);
328 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
329 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
330 return (left_res && right_res);
333 int res = MC_automaton_evaluate_label(l->u.exp_not);
337 unsigned int cursor = 0;
338 xbt_propositional_symbol_t p = NULL;
340 xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, p){
341 if(strcmp(p->pred, l->u.predicat) == 0){
342 f = (int_f_void_t)p->function;
357 /********************* Double-DFS stateless *******************/
359 void pair_stateless_free(mc_pair_stateless_t pair){
360 xbt_free(pair->graph_state->system_state);
361 xbt_free(pair->graph_state->proc_status);
362 xbt_free(pair->graph_state);
366 void pair_stateless_free_voidp(void *p){
367 pair_stateless_free((mc_pair_stateless_t) * (void **) p);
370 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r){
371 mc_pair_stateless_t p = NULL;
372 p = xbt_new0(s_mc_pair_stateless_t, 1);
373 p->automaton_state = st;
376 mc_stats_pair->expanded_pairs++;
380 void pair_reached_free(mc_pair_reached_t pair){
382 pair->automaton_state = NULL;
383 xbt_dynar_free(&(pair->prop_ato));
384 MC_free_snapshot(pair->system_state);
389 void pair_reached_free_voidp(void *p){
390 pair_reached_free((mc_pair_reached_t) * (void **) p);
393 void MC_ddfs_init(void){
395 raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
397 XBT_INFO("**************************************************");
398 XBT_INFO("Double-DFS init");
399 XBT_INFO("**************************************************");
401 mc_pair_stateless_t mc_initial_pair = NULL;
402 mc_state_t initial_graph_state = NULL;
403 smx_process_t process;
406 MC_wait_for_requests();
410 initial_graph_state = MC_state_pair_new();
411 xbt_swag_foreach(process, simix_global->process_list){
412 if(MC_process_is_enabled(process)){
413 MC_state_interleave_process(initial_graph_state, process);
417 reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), pair_reached_free_voidp);
418 successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
420 /* Save the initial state */
421 initial_state_liveness->initial_snapshot = MC_take_snapshot_liveness();
425 unsigned int cursor = 0;
428 xbt_dynar_foreach(_mc_property_automaton->states, cursor, state){
429 if(state->type == -1){
432 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
433 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
437 MC_restore_snapshot(initial_state_liveness->initial_snapshot);
444 if(state->type == 2){
447 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
448 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
451 set_pair_reached(state);
454 MC_restore_snapshot(initial_state_liveness->initial_snapshot);
473 void MC_ddfs(int search_cycle){
475 raw_mem_set = (mmalloc_get_current_heap() == raw_heap);
477 smx_process_t process;
478 mc_pair_stateless_t current_pair = NULL;
480 if(xbt_fifo_size(mc_stack_liveness) == 0)
484 /* Get current pair */
485 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
487 /* Update current state in buchi automaton */
488 _mc_property_automaton->current_state = current_pair->automaton_state;
491 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness), search_cycle);
493 mc_stats_pair->visited_pairs++;
498 mc_state_t next_graph_state = NULL;
499 smx_simcall_t req = NULL;
502 xbt_transition_t transition_succ;
503 unsigned int cursor = 0;
506 mc_pair_stateless_t next_pair = NULL;
507 mc_pair_stateless_t pair_succ;
509 mc_pair_stateless_t remove_pair;
510 mc_pair_reached_t remove_pair_reached;
512 if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){
514 if(current_pair->requests > 0){
516 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
518 /* Debug information */
520 req_str = MC_request_to_string(req, value);
521 XBT_DEBUG("Execute: %s", req_str);
524 MC_state_set_executed_request(current_pair->graph_state, req, value);
526 /* Answer the request */
527 SIMIX_simcall_pre(req, value);
529 /* Wait for requests (schedules processes) */
530 MC_wait_for_requests();
534 /* Create the new expanded graph_state */
535 next_graph_state = MC_state_pair_new();
537 /* Get enabled process and insert it in the interleave set of the next graph_state */
539 xbt_swag_foreach(process, simix_global->process_list){
540 if(MC_process_is_enabled(process)){
541 XBT_DEBUG("Process %lu enabled with simcall : %d", process->pid, (&process->simcall)->call);
545 xbt_swag_foreach(process, simix_global->process_list){
546 if(MC_process_is_enabled(process)){
547 MC_state_interleave_process(next_graph_state, process);
551 xbt_dynar_reset(successors);
557 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
559 res = MC_automaton_evaluate_label(transition_succ->label);
561 if(res == 1){ // enabled transition in automaton
563 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
564 xbt_dynar_push(successors, &next_pair);
572 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
574 res = MC_automaton_evaluate_label(transition_succ->label);
576 if(res == 2){ // true transition in automaton
578 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
579 xbt_dynar_push(successors, &next_pair);
587 xbt_dynar_foreach(successors, cursor, pair_succ){
589 if(search_cycle == 1){
591 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
593 if(reached(pair_succ->automaton_state)){
595 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));
597 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
598 XBT_INFO("| ACCEPTANCE CYCLE |");
599 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
600 XBT_INFO("Counter-example that violates formula :");
601 MC_show_stack_liveness(mc_stack_liveness);
602 MC_dump_stack_liveness(mc_stack_liveness);
603 MC_print_statistics_pairs(mc_stats_pair);
608 XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair (%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->automaton_state->id);
610 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
613 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
616 MC_ddfs(search_cycle);
623 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
626 MC_ddfs(search_cycle);
632 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
634 XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair (%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->automaton_state->id);
636 set_pair_reached(pair_succ->automaton_state);
640 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
645 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
648 MC_ddfs(search_cycle);
653 /* Restore system before checking others successors */
654 if(cursor != (xbt_dynar_length(successors) - 1))
655 MC_replay_liveness(mc_stack_liveness, 1);
660 if(MC_state_interleave_size(current_pair->graph_state) > 0){
661 XBT_DEBUG("Backtracking to depth %d", xbt_fifo_size(mc_stack_liveness));
662 MC_replay_liveness(mc_stack_liveness, 0);
669 XBT_DEBUG("No more request to execute in this state, search evolution in Büchi Automaton.");
673 /* Create the new expanded graph_state */
674 next_graph_state = MC_state_pair_new();
676 xbt_dynar_reset(successors);
682 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
684 res = MC_automaton_evaluate_label(transition_succ->label);
686 if(res == 1){ // enabled transition in automaton
688 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
689 xbt_dynar_push(successors, &next_pair);
697 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
699 res = MC_automaton_evaluate_label(transition_succ->label);
701 if(res == 2){ // true transition in automaton
703 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
704 xbt_dynar_push(successors, &next_pair);
712 xbt_dynar_foreach(successors, cursor, pair_succ){
714 if(search_cycle == 1){
716 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
718 if(reached(pair_succ->automaton_state)){
720 XBT_INFO("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
722 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
723 XBT_INFO("| ACCEPTANCE CYCLE |");
724 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
725 XBT_INFO("Counter-example that violates formula :");
726 MC_show_stack_liveness(mc_stack_liveness);
727 MC_dump_stack_liveness(mc_stack_liveness);
728 MC_print_statistics_pairs(mc_stats_pair);
733 XBT_INFO("Next pair (depth = %d) -> Acceptance pair (%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->automaton_state->id);
735 XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
738 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
741 MC_ddfs(search_cycle);
748 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
751 MC_ddfs(search_cycle);
758 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
760 set_pair_reached(pair_succ->automaton_state);
764 XBT_INFO("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
769 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
772 MC_ddfs(search_cycle);
776 /* Restore system before checking others successors */
777 if(cursor != xbt_dynar_length(successors) - 1)
778 MC_replay_liveness(mc_stack_liveness, 1);
786 XBT_DEBUG("Max depth reached");
790 if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){
791 XBT_DEBUG("Pair (depth = %d) shifted in stack, maximum depth reached", xbt_fifo_size(mc_stack_liveness) );
793 XBT_DEBUG("Pair (depth = %d) shifted in stack", xbt_fifo_size(mc_stack_liveness) );
798 remove_pair = xbt_fifo_shift(mc_stack_liveness);
799 xbt_fifo_remove(mc_stack_liveness, remove_pair);
801 if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
802 remove_pair_reached = xbt_dynar_pop_as(reached_pairs, mc_pair_reached_t);
803 pair_reached_free(remove_pair_reached);
804 remove_pair_reached = NULL;