Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into MC_LTL
[simgrid.git] / src / mc / mc_global.c
index a1d46eb..e093b3d 100644 (file)
@@ -30,7 +30,10 @@ mc_stats_t mc_stats = NULL;
 xbt_fifo_t mc_stack_liveness_stateful = NULL;
 mc_stats_pair_t mc_stats_pair = NULL;
 xbt_fifo_t mc_stack_liveness_stateless = NULL;
+mc_snapshot_t initial_snapshot_liveness = NULL;
 
+xbt_automaton_t automaton;
+char *prog_name;
 
 /**
  *  \brief Initialize the model-checker data structures
@@ -116,12 +119,12 @@ void MC_init_liveness_stateful(xbt_automaton_t a){
 
   MC_UNSET_RAW_MEM;
 
-  MC_ddfs_stateful_init(a);
+  //MC_ddfs_stateful_init(a);
   //MC_dpor2_init(a);
   //MC_dpor3_init(a);
 }
 
-void MC_init_liveness_stateless(xbt_automaton_t a){
+void MC_init_liveness_stateless(xbt_automaton_t a, char *prgm){
 
   XBT_DEBUG("Start init mc");
   
@@ -142,7 +145,10 @@ void MC_init_liveness_stateless(xbt_automaton_t a){
 
   MC_UNSET_RAW_MEM;
 
-  MC_ddfs_stateless_init(a);
+  automaton = a;
+  prog_name = strdup(prgm);
+
+  MC_ddfs_stateless_init();
 
   
 }
@@ -167,8 +173,8 @@ void MC_modelcheck_liveness_stateful(xbt_automaton_t a){
   MC_exit_liveness();
 }
 
-void MC_modelcheck_liveness_stateless(xbt_automaton_t a){
-  MC_init_liveness_stateless(a);
+void MC_modelcheck_liveness_stateless(xbt_automaton_t a, char *prgm){
+  MC_init_liveness_stateless(a, prgm);
   MC_exit_liveness();
 }
 
@@ -176,7 +182,8 @@ void MC_exit_liveness(void)
 {
   MC_print_statistics_pairs(mc_stats_pair);
   //xbt_free(mc_time);
-  MC_memory_exit();
+  //MC_memory_exit();
+  exit(0);
 }
 
 
@@ -203,7 +210,7 @@ void MC_wait_for_requests(void)
   smx_req_t req;
   unsigned int iter;
 
-  while (xbt_dynar_length(simix_global->process_to_run)) {
+  while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
     SIMIX_process_runall();
     xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
       req = &process->request;
@@ -295,7 +302,7 @@ void MC_replay_liveness(xbt_fifo_t stack, int all_stack)
   XBT_DEBUG("**** Begin Replay ****");
 
   /* Restore the initial state */
-  MC_restore_snapshot(initial_snapshot);
+  MC_restore_snapshot(initial_snapshot_liveness);
   /* At the moment of taking the snapshot the raw heap was set, so restoring
    * it will set it back again, we have to unset it to continue  */
   MC_UNSET_RAW_MEM;