Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More helpful error message when someone needs --cfg=model-check/setenv
[simgrid.git] / src / mc / api / RemoteApp.cpp
index 6cf19b0a42d3be40333d638319ffb9e34dfa056d..0371d517485c8b339160ecbf702fad0f6975ea80 100644 (file)
@@ -7,6 +7,7 @@
 #include "src/internal_config.h" // HAVE_SMPI
 #include "src/mc/explo/Exploration.hpp"
 #include "src/mc/mc_config.hpp"
+#include "xbt/asserts.h"
 #if HAVE_SMPI
 #include "smpi/smpi.h"
 #include "src/smpi/include/private.hpp"
@@ -87,7 +88,13 @@ static void run_child_process(int socket, const std::vector<char*>& args)
              "Unable to find a binary to exec on the command line. Did you only pass config flags?");
 
   execvp(args[i], args.data() + i);
-  xbt_die("The model-checked process failed to exec(%s): %s", args[i], strerror(errno));
+  XBT_CRITICAL("The model-checked process failed to exec(%s): %s.\n"
+               "        Make sure that your binary exists on disk and is executable.",
+               args[i], strerror(errno));
+  if (strchr(args[i], '=') != nullptr)
+    XBT_CRITICAL("If you want to pass command-line parameters, please use --cfg=model-check/setenv:%s", args[i]);
+
+  xbt_die("Aborting now.");
 }
 
 RemoteApp::RemoteApp(const std::vector<char*>& args)
@@ -165,10 +172,11 @@ void RemoteApp::get_actors_status(std::map<aid_t, ActorState>& whereto) const
              to_c_str(answer.type), (int)answer.type, (int)received, (int)MessageType::ACTORS_STATUS_REPLY,
              (int)sizeof(answer));
 
-  s_mc_message_actors_status_one_t status[answer.count];
+  std::vector<s_mc_message_actors_status_one_t> status(answer.count);
   if (answer.count > 0) {
-    received = model_checker_->channel().receive(&status, sizeof(status));
-    xbt_assert(static_cast<size_t>(received) == sizeof(status));
+    size_t size = status.size() * sizeof(s_mc_message_actors_status_one_t);
+    received    = model_checker_->channel().receive(status.data(), size);
+    xbt_assert(static_cast<size_t>(received) == size);
   }
 
   whereto.clear();