/* Liveness */
-xbt_fifo_t mc_stack_liveness_stateful = NULL;
mc_stats_pair_t mc_stats_pair = NULL;
-xbt_fifo_t mc_stack_liveness_stateless = NULL;
+xbt_fifo_t mc_stack_liveness = NULL;
+mc_snapshot_t initial_snapshot_liveness = NULL;
+
+xbt_automaton_t automaton;
+char *prog_name;
+
+static void MC_init_liveness(xbt_automaton_t a, char *prgm);
+static void MC_assert_pair(int prop);
/**
}
-void MC_init_liveness_stateful(xbt_automaton_t a){
-
- XBT_DEBUG("Start init mc");
-
- mc_time = xbt_new0(double, simix_process_maxpid);
-
- /* Initialize the data structures that must be persistent across every
- iteration of the model-checker (in RAW memory) */
-
- MC_SET_RAW_MEM;
-
- /* Initialize statistics */
- mc_stats_pair = xbt_new0(s_mc_stats_pair_t, 1);
- //mc_stats = xbt_new0(s_mc_stats_t, 1);
-
- XBT_DEBUG("Creating snapshot_stack");
-
- /* Create exploration stack */
- mc_stack_liveness_stateful = xbt_fifo_new();
-
-
- MC_UNSET_RAW_MEM;
-
- MC_ddfs_stateful_init(a);
- //MC_dpor2_init(a);
- //MC_dpor3_init(a);
-}
-
-void MC_init_liveness_stateless(xbt_automaton_t a){
+static void MC_init_liveness(xbt_automaton_t a, char *prgm){
XBT_DEBUG("Start init mc");
XBT_DEBUG("Creating stack");
/* Create exploration stack */
- mc_stack_liveness_stateless = xbt_fifo_new();
+ mc_stack_liveness = xbt_fifo_new();
MC_UNSET_RAW_MEM;
- MC_ddfs_stateless_init(a);
+ automaton = a;
+ prog_name = strdup(prgm);
+
+ MC_ddfs_init();
}
MC_exit();
}
-void MC_modelcheck_liveness_stateful(xbt_automaton_t a){
- MC_init_liveness_stateful(a);
- MC_exit_liveness();
-}
-void MC_modelcheck_liveness_stateless(xbt_automaton_t a){
- MC_init_liveness_stateless(a);
+void MC_modelcheck_liveness(xbt_automaton_t a, char *prgm){
+ MC_init_liveness(a, prgm);
MC_exit_liveness();
}
{
MC_print_statistics_pairs(mc_stats_pair);
//xbt_free(mc_time);
- MC_memory_exit();
+ //MC_memory_exit();
+ exit(0);
}
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;
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;
}
}
-void MC_show_stack_liveness_stateful(xbt_fifo_t stack){
- int value;
- mc_pair_t pair;
- xbt_fifo_item_t item;
- smx_req_t req;
- char *req_str = NULL;
-
- for (item = xbt_fifo_get_last_item(stack);
- (item ? (pair = (mc_pair_t) (xbt_fifo_get_item_content(item)))
- : (NULL)); item = xbt_fifo_get_prev_item(item)) {
- req = MC_state_get_executed_request(pair->graph_state, &value);
- if(req){
- req_str = MC_request_to_string(req, value);
- XBT_INFO("%s", req_str);
- xbt_free(req_str);
- }
- }
-}
-
-void MC_dump_stack_liveness_stateful(xbt_fifo_t stack){
- mc_pair_t pair;
- MC_SET_RAW_MEM;
- while ((pair = (mc_pair_t) xbt_fifo_pop(stack)) != NULL)
- MC_pair_delete(pair);
- MC_UNSET_RAW_MEM;
-}
-
-void MC_show_stack_liveness_stateless(xbt_fifo_t stack){
+void MC_show_stack_liveness(xbt_fifo_t stack){
int value;
mc_pair_stateless_t pair;
xbt_fifo_item_t item;
}
}
-void MC_dump_stack_liveness_stateless(xbt_fifo_t stack){
+void MC_dump_stack_liveness(xbt_fifo_t stack){
mc_pair_stateless_t pair;
MC_SET_RAW_MEM;
}
}
-void MC_assert_pair_stateful(int prop){
- if (MC_IS_ENABLED && !prop) {
- XBT_INFO("**************************");
- XBT_INFO("*** PROPERTY NOT VALID ***");
- XBT_INFO("**************************");
- //XBT_INFO("Counter-example execution trace:");
- MC_show_stack_liveness_stateful(mc_stack_liveness_stateful);
- //MC_dump_snapshot_stack(mc_snapshot_stack);
- MC_print_statistics_pairs(mc_stats_pair);
- xbt_abort();
- }
-}
-void MC_assert_pair_stateless(int prop){
+static void MC_assert_pair(int prop){
if (MC_IS_ENABLED && !prop) {
XBT_INFO("**************************");
XBT_INFO("*** PROPERTY NOT VALID ***");
XBT_INFO("**************************");
//XBT_INFO("Counter-example execution trace:");
- MC_show_stack_liveness_stateless(mc_stack_liveness_stateless);
+ MC_show_stack_liveness(mc_stack_liveness);
//MC_dump_snapshot_stack(mc_snapshot_stack);
MC_print_statistics_pairs(mc_stats_pair);
xbt_abort();