Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Replay: Make error message more verbose
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 30 Mar 2018 09:15:29 +0000 (11:15 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 9 Apr 2018 13:05:58 +0000 (15:05 +0200)
src/smpi/internals/smpi_replay.cpp

index 1aca704..2d03b91 100644 (file)
@@ -16,6 +16,7 @@
 #include <memory>
 #include <numeric>
 #include <unordered_map>
+#include <sstream>
 #include <vector>
 
 using simgrid::s4u::Actor;
@@ -28,12 +29,18 @@ static MPI_Datatype MPI_DEFAULT_TYPE;
 
 #define CHECK_ACTION_PARAMS(action, mandatory, optional)                                                               \
   {                                                                                                                    \
-    if (action.size() < static_cast<unsigned long>(mandatory + 2))                                                     \
+    if (action.size() < static_cast<unsigned long>(mandatory + 2)) {                                                     \
+      std::stringstream ss; \
+      for (const auto& elem : action) { \
+        ss << elem << " "; \
+      } \
       THROWF(arg_error, 0, "%s replay failed.\n"                                                                       \
                            "%zu items were given on the line. First two should be process_id and action.  "            \
                            "This action needs after them %lu mandatory arguments, and accepts %lu optional ones. \n"   \
+                           "The full line that was given is:\n   %s\n" \
                            "Please contact the Simgrid team if support is needed",                                     \
-             __func__, action.size(), static_cast<unsigned long>(mandatory), static_cast<unsigned long>(optional));    \
+             __func__, action.size(), static_cast<unsigned long>(mandatory), static_cast<unsigned long>(optional), ss.str().c_str());    \
+    }\
   }
 
 static void log_timed_action(simgrid::xbt::ReplayAction& action, double clock)