get_exploration()->get_record_trace().to_string().c_str());
exploration_->log_state();
- this->exit(SIMGRID_MC_EXIT_SAFETY);
+ exploration_->system_exit(SIMGRID_MC_EXIT_SAFETY);
default:
xbt_die("Unexpected message from model-checked application");
return true;
}
-/** Terminate the model-checker application */
-void ModelChecker::exit(int status)
-{
- get_exploration()->get_remote_app().shutdown();
- ::exit(status);
-}
-
void ModelChecker::handle_waitpid()
{
XBT_DEBUG("Check for wait event");
if (WIFSIGNALED(status)) {
MC_report_crash(exploration_, status);
this->get_remote_process_memory().terminate();
- this->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
+ exploration_->system_exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
}
}
#endif
else if (WIFSIGNALED(status)) {
MC_report_crash(exploration_, status);
this->get_remote_process_memory().terminate();
- this->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
+ exploration_->system_exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
} else if (WIFEXITED(status)) {
XBT_DEBUG("Child process is over");
this->get_remote_process_memory().terminate();
/** Let the application take a transition. A new Transition is created iff the last parameter is true */
Transition* handle_simcall(aid_t aid, int times_considered, bool new_transition);
- /* Interactions with the simcall observer */
- XBT_ATTRIB_NORETURN void exit(int status);
-
Exploration* get_exploration() const { return exploration_; }
void set_exploration(Exploration* exploration) { exploration_ = exploration; }
XBT_INFO("*********************************************************");
XBT_INFO("%s", send_diff.c_str());
exploration_.log_state();
- mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+ exploration_.system_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
} else if (_sg_mc_comms_determinism && (not send_deterministic && not recv_deterministic)) {
XBT_INFO("****************************************************");
XBT_INFO("***** Non-deterministic communications pattern *****");
if (not recv_diff.empty())
XBT_INFO("%s", recv_diff.c_str());
exploration_.log_state();
- mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+ exploration_.system_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
}
}
}
}
}
+void Exploration::system_exit(int status)
+{
+ get_remote_app().shutdown();
+ ::exit(status);
+}
+
}; // namespace simgrid::mc
/** Main function of this algorithm */
virtual void run() = 0;
+ /** Kill the application and the model-checker (which exits with `status`)*/
+ XBT_ATTRIB_NORETURN void system_exit(int status);
+
/* These methods are callbacks called by the model-checking engine
* to get and display information about the current state of the
* model-checking algorithm: */