-
-void MC_show_non_termination(void){
- XBT_INFO("******************************************");
- XBT_INFO("*** NON-PROGRESSIVE CYCLE DETECTED ***");
- XBT_INFO("******************************************");
- XBT_INFO("Counter-example execution trace:");
- MC_dump_stack_safety(mc_stack);
- MC_print_statistics(mc_stats);
-}
-
-void MC_print_statistics(mc_stats_t stats)
-{
- if(_sg_mc_comms_determinism) {
- if (!initial_global_state->recv_deterministic && initial_global_state->send_deterministic){
- XBT_INFO("******************************************************");
- XBT_INFO("**** Only-send-deterministic communication pattern ****");
- XBT_INFO("******************************************************");
- XBT_INFO("%s", initial_global_state->recv_diff);
- }else if(!initial_global_state->send_deterministic && initial_global_state->recv_deterministic) {
- XBT_INFO("******************************************************");
- XBT_INFO("**** Only-recv-deterministic communication pattern ****");
- XBT_INFO("******************************************************");
- XBT_INFO("%s", initial_global_state->send_diff);
- }
- }
-
- if (stats->expanded_pairs == 0) {
- XBT_INFO("Expanded states = %lu", stats->expanded_states);
- XBT_INFO("Visited states = %lu", stats->visited_states);
- } else {
- XBT_INFO("Expanded pairs = %lu", stats->expanded_pairs);
- XBT_INFO("Visited pairs = %lu", stats->visited_pairs);
- }
- XBT_INFO("Executed transitions = %lu", stats->executed_transitions);
- if ((_sg_mc_dot_output_file != nullptr) && (_sg_mc_dot_output_file[0] != '\0')) {
- fprintf(dot_output, "}\n");
- fclose(dot_output);
- }
- if (initial_global_state != nullptr && (_sg_mc_comms_determinism || _sg_mc_send_determinism)) {
- XBT_INFO("Send-deterministic : %s", !initial_global_state->send_deterministic ? "No" : "Yes");
- if (_sg_mc_comms_determinism)
- XBT_INFO("Recv-deterministic : %s", !initial_global_state->recv_deterministic ? "No" : "Yes");
- }
- if (getenv("SIMGRID_MC_SYSTEM_STATISTICS")){
- int ret=system("free");
- if(ret!=0)XBT_WARN("system call did not return 0, but %d",ret);
- }
-}
-
-void MC_automaton_load(const char *file)
-{
- if (simgrid::mc::property_automaton == nullptr)
- simgrid::mc::property_automaton = xbt_automaton_new();
-
- xbt_automaton_load(simgrid::mc::property_automaton, file);
-}
-
-static void MC_dump_stacks(FILE* file)
-{
- int nstack = 0;
- for (auto const& stack : mc_model_checker->process().stack_areas()) {
-
- fprintf(file, "Stack %i:\n", nstack);
-
- int nframe = 0;
- char buffer[100];
-
- simgrid::mc::UnwindContext context;
- unw_context_t raw_context =
- mc_model_checker->process().read<unw_context_t>(
- simgrid::mc::remote((unw_context_t *)stack.context));
- context.initialize(&mc_model_checker->process(), &raw_context);
-
- unw_cursor_t cursor = context.cursor();
-
- unw_word_t off;
- do {
- const char * name = !unw_get_proc_name(&cursor, buffer, 100, &off) ? buffer : "?";
-#if defined(__x86_64__)
- unw_word_t rip = 0;
- unw_word_t rsp = 0;
- unw_get_reg(&cursor, UNW_X86_64_RIP, &rip);
- unw_get_reg(&cursor, UNW_X86_64_RSP, &rsp);
- fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n",
- nframe, name, (std::uint64_t) rip, (std::uint64_t) rsp);
-#else
- fprintf(file, " %i: %s\n", nframe, name);
-#endif
- ++nframe;
- } while(unw_step(&cursor));
-
- ++nstack;
- }
-}
-#endif
-
-double MC_process_clock_get(smx_process_t process)
-{
- if (simgrid::mc::processes_time.empty())
- return 0;
- if (process != nullptr)
- return simgrid::mc::processes_time[process->pid];
- return -1;
-}
-
-void MC_process_clock_add(smx_process_t process, double amount)
-{
- simgrid::mc::processes_time[process->pid] += amount;
-}
-
-#if HAVE_MC
-void MC_report_assertion_error(void)
-{
- XBT_INFO("**************************");
- XBT_INFO("*** PROPERTY NOT VALID ***");
- XBT_INFO("**************************");
- XBT_INFO("Counter-example execution trace:");
- MC_record_dump_path(mc_stack);
- MC_dump_stack_safety(mc_stack);
- MC_print_statistics(mc_stats);
-}
-
-void MC_report_crash(int status)
-{
- XBT_INFO("**************************");
- XBT_INFO("** CRASH IN THE PROGRAM **");
- XBT_INFO("**************************");
- if (WIFSIGNALED(status))
- XBT_INFO("From signal: %s", strsignal(WTERMSIG(status)));
- else if (WIFEXITED(status))
- XBT_INFO("From exit: %i", WEXITSTATUS(status));
- if (WCOREDUMP(status))
- XBT_INFO("A core dump was generated by the system.");
- else
- XBT_INFO("No core dump was generated by the system.");
- XBT_INFO("Counter-example execution trace:");
- MC_record_dump_path(mc_stack);
- MC_dump_stack_safety(mc_stack);
- MC_print_statistics(mc_stats);
-}
-
-#endif