Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
BasicGuide handle next_transition if asked to
[simgrid.git] / src / mc / explo / Exploration.cpp
index e4e5639..0e44b04 100644 (file)
@@ -5,7 +5,11 @@
 
 #include "src/mc/explo/Exploration.hpp"
 #include "src/mc/mc_config.hpp"
+#include "src/mc/mc_exit.hpp"
 #include "src/mc/mc_private.hpp"
+#include "src/mc/sosp/RemoteProcessMemory.hpp"
+
+#include <sys/wait.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_explo, mc, "Generic exploration algorithm of the model-checker");
 
@@ -57,6 +61,50 @@ void Exploration::log_state()
   }
 }
 
+void Exploration::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 (not xbt_log_no_loc)
+    XBT_INFO("%s core dump was generated by the system.", WCOREDUMP(status) ? "A" : "No");
+
+  XBT_INFO("Counter-example execution trace:");
+  for (auto const& s : get_textual_trace())
+    XBT_INFO("  %s", s.c_str());
+  XBT_INFO("You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with "
+           "--cfg=model-check/replay:'%s'",
+           get_record_trace().to_string().c_str());
+  log_state();
+  if (xbt_log_no_loc) {
+    XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
+  } else {
+    XBT_INFO("Stack trace:");
+    get_remote_app().get_remote_process_memory().dump_stack();
+  }
+
+  get_remote_app().get_remote_process_memory().terminate();
+  system_exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
+}
+void Exploration::report_assertion_failure()
+{
+  XBT_INFO("**************************");
+  XBT_INFO("*** PROPERTY NOT VALID ***");
+  XBT_INFO("**************************");
+  XBT_INFO("Counter-example execution trace:");
+  for (auto const& s : get_textual_trace())
+    XBT_INFO("  %s", s.c_str());
+  XBT_INFO("You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with "
+           "--cfg=model-check/replay:'%s'",
+           get_record_trace().to_string().c_str());
+  log_state();
+  system_exit(SIMGRID_MC_EXIT_SAFETY);
+}
+
 void Exploration::system_exit(int status)
 {
   get_remote_app().shutdown();