Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add operation to plugin doc
[simgrid.git] / src / mc / explo / Exploration.cpp
index 6efe84181fffe982e08568793acf932bf428c70b..124c413f9af75243f6ebcee35685fe13db6c5323 100644 (file)
@@ -5,10 +5,11 @@
 
 #include "src/mc/explo/Exploration.hpp"
 #include "src/mc/mc_config.hpp"
+#include "src/mc/mc_environ.h"
 #include "src/mc/mc_exit.hpp"
 #include "src/mc/mc_private.hpp"
 
-#if SIMGRID_HAVE_MC
+#if SIMGRID_HAVE_STATEFUL_MC
 #include "src/mc/sosp/RemoteProcessMemory.hpp"
 #endif
 
@@ -62,20 +63,31 @@ void Exploration::log_state()
     dot_output("}\n");
     fclose(dot_output_);
   }
-  if (getenv("SIMGRID_MC_SYSTEM_STATISTICS")) {
+  if (getenv(MC_ENV_SYSTEM_STATISTICS)) {
     int ret = system("free");
     if (ret != 0)
       XBT_WARN("Call to system(free) did not return 0, but %d", ret);
   }
 }
-
+// Make our tests fully reproducible despite the subtle differences of strsignal() across archs
+static const char* signal_name(int status)
+{
+  switch (WTERMSIG(status)) {
+    case SIGABRT: // FreeBSD uses "Abort trap" as a strsignal for SIGABRT
+      return "Aborted";
+    case SIGSEGV: // MacOSX uses "Segmentation fault: 11" for SIGKILL
+      return "Segmentation fault";
+    default:
+      return strsignal(WTERMSIG(status));
+  }
+}
 XBT_ATTRIB_NORETURN void Exploration::report_crash(int status)
 {
   XBT_INFO("**************************");
   XBT_INFO("** CRASH IN THE PROGRAM **");
   XBT_INFO("**************************");
-  if (WIFSIGNALED(status)) // FreeBSD use "Abort trap" as a strsignal for SIGABRT that is part of our tests
-    XBT_INFO("From signal: %s", WTERMSIG(status) == SIGABRT ? "Aborted" : strsignal(WTERMSIG(status)));
+  if (WIFSIGNALED(status))
+    XBT_INFO("From signal: %s", signal_name(status));
   else if (WIFEXITED(status))
     XBT_INFO("From exit: %i", WEXITSTATUS(status));
   if (not xbt_log_no_loc)
@@ -91,7 +103,7 @@ XBT_ATTRIB_NORETURN void Exploration::report_crash(int status)
   if (xbt_log_no_loc) {
     XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
   } else {
-#if SIMGRID_HAVE_MC
+#if SIMGRID_HAVE_STATEFUL_MC
     const auto* memory = get_remote_app().get_remote_process_memory();
     if (memory) {
       XBT_INFO("Stack trace:");