Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
code simplification in MC start sequence
[simgrid.git] / src / mc / checker / simgrid_mc.cpp
index 5394fbe..0c59749 100644 (file)
@@ -4,29 +4,15 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <exception>
-
-#include <cstdlib>
-#include <cstdio>
-#include <cstring>
-
-#include <utility>
-
-#include <unistd.h>
-
-#include <xbt/log.h>
-
 #include "simgrid/sg_config.hpp"
-#include "src/xbt_modinter.h"
-
 #include "src/mc/Session.hpp"
 #include "src/mc/checker/Checker.hpp"
-#include "src/mc/mc_base.h"
-#include "src/mc/mc_comm_pattern.hpp"
+#include "src/mc/mc_config.hpp"
 #include "src/mc/mc_exit.hpp"
-#include "src/mc/mc_private.hpp"
-#include "src/mc/mc_safety.hpp"
-#include "src/mc/remote/mc_protocol.h"
+
+#include <cstring>
+#include <memory>
+#include <unistd.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc");
 
@@ -67,24 +53,24 @@ int main(int argc, char** argv)
     xbt_log_init(&argc, argv);
     sg_config_init(&argc, argv);
 
-    std::unique_ptr<Session> session =
-      std::unique_ptr<Session>(Session::spawnvp(argv_copy[1], argv_copy+1));
+    simgrid::mc::session = new Session([argv_copy] {
+        execvp(argv_copy[1], argv_copy+1);
+      });
     delete[] argv_copy;
 
-    simgrid::mc::session = session.get();
-    std::unique_ptr<simgrid::mc::Checker> checker = createChecker(*session);
+    std::unique_ptr<simgrid::mc::Checker> checker = createChecker(*simgrid::mc::session);
     int res = SIMGRID_MC_EXIT_SUCCESS;
     try {
       checker->run();
-    } catch (simgrid::mc::DeadlockError& de) {
+    } catch (const simgrid::mc::DeadlockError&) {
       res = SIMGRID_MC_EXIT_DEADLOCK;
-    } catch (simgrid::mc::TerminationError& te) {
+    } catch (const simgrid::mc::TerminationError&) {
       res = SIMGRID_MC_EXIT_NON_TERMINATION;
-    } catch (simgrid::mc::LivenessError& le) {
+    } catch (const simgrid::mc::LivenessError&) {
       res = SIMGRID_MC_EXIT_LIVENESS;
     }
     checker = nullptr;
-    session->close();
+    simgrid::mc::session->close();
     return res;
   }
   catch(std::exception& e) {