Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 13 Mar 2016 20:08:20 +0000 (21:08 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Sun, 13 Mar 2016 20:08:20 +0000 (21:08 +0100)
54 files changed:
doc/doxygen/platform.doc
examples/smpi/NAS/ep.c
examples/smpi/NAS/nas_common.c
examples/smpi/NAS/nas_common.h
include/simgrid/s4u/actor.hpp
src/mc/Channel.cpp [new file with mode: 0644]
src/mc/Channel.hpp [new file with mode: 0644]
src/mc/Client.cpp [new file with mode: 0644]
src/mc/Client.hpp [new file with mode: 0644]
src/mc/ModelChecker.cpp
src/mc/PageStore.cpp
src/mc/Process.cpp
src/mc/Process.hpp
src/mc/RegionSnapshot.cpp
src/mc/Variable.hpp
src/mc/mc_base.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_client.cpp [deleted file]
src/mc/mc_client.h [deleted file]
src/mc/mc_client_api.cpp
src/mc/mc_comm_determinism.cpp
src/mc/mc_comm_pattern.cpp
src/mc/mc_compare.cpp
src/mc/mc_config.cpp
src/mc/mc_diff.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_global.cpp
src/mc/mc_ignore.cpp [deleted file]
src/mc/mc_liveness.cpp
src/mc/mc_memory.cpp
src/mc/mc_protocol.cpp
src/mc/mc_protocol.h
src/mc/mc_record.cpp
src/mc/mc_request.cpp
src/mc/mc_safety.cpp
src/mc/mc_smx.cpp
src/mc/mc_state.cpp
src/mc/mc_visited.cpp
src/s4u/s4u_actor.cpp
src/simix/smx_global.cpp
src/simix/smx_process.cpp
src/surf/network_constant.cpp
src/surf/network_constant.hpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/ptask_L07.cpp
src/surf/sg_platf.cpp
src/surf/surf_routing.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/log.c
teshsuite/smpi/CMakeLists.txt
tools/cmake/DefinePackages.cmake
tools/cmake/Modules/FindValgrind.cmake
tools/cmake/Tests.cmake

index db37632..d639610 100644 (file)
@@ -1301,7 +1301,7 @@ can only occur as a child of \ref pf_routing_tag_route "&lt;route/&gt;"
 | Attribute name  | Mandatory | Values | Description                                                   |
 | --------------- | --------- | ------ | -----------                                                   |
 | id              | yes       | String | The identifier of the link that should be added to the route. |
-| direction       | maybe     | UP\|DOWN | If the link referenced by \c id has been declared as \ref pf_sharing_policy_fullduplex "FULLDUPLEX", this indicates which direction the route traverses through this link: UP or DOWN. If you don't use FULLDUPLEX, this attribute has no effect.
+| direction       | maybe     | UP\|DOWN | If the link referenced by \c id has been declared as \ref pf_sharing_policy_fullduplex "FULLDUPLEX", this indicates which direction the route traverses through this link: UP or DOWN. If you don't use FULLDUPLEX, do not use this attribute or SimGrid will not find the right link.
 
 #### Example Files ####
 
index 33aa77e..81707f2 100644 (file)
@@ -62,7 +62,7 @@ int main(int argc, char **argv) {
      * string (for printing). Have to strip off the decimal point put in there by the floating point print statement
      * (internal file) */
     fprintf(stdout," NAS Parallel Benchmarks 3.2 -- EP Benchmark");
-    sprintf(size,"%zu",(unsigned long)pow(2,m+1));
+    sprintf(size,"%lu",(unsigned long)pow(2,m+1));
     //size = size.replace('.', ' ');
     fprintf(stdout," Number of random numbers generated: %s\n",size);
     fprintf(stdout," Number of active processes: %d\n",no_nodes);
@@ -193,7 +193,7 @@ int main(int argc, char **argv) {
         t2   = sqrt(-2. * log(t1) / t1);
         t3   = (x1 * t2);
         t4   = (x2 * t2);
-        l    = (int)(abs(t3) > abs(t4) ? abs(t3) : abs(t4));
+        l    = (int)(fabs(t3) > fabs(t4) ? fabs(t3) : fabs(t4));
         q[l] = q[l] + 1.;
         sx   = sx + t3;
         sy   = sy + t4;
@@ -269,8 +269,8 @@ int main(int argc, char **argv) {
     fprintf(stdout,("sy_verify = " + sy_verify_value);
     */
     if(verified) {
-      sx_err = abs((sx - sx_verify_value)/sx_verify_value);
-      sy_err = abs((sy - sy_verify_value)/sy_verify_value);
+      sx_err = fabs((sx - sx_verify_value)/sx_verify_value);
+      sy_err = fabs((sy - sy_verify_value)/sy_verify_value);
       /*
       fprintf(stdout,("sx_err = " + sx_err);
       fprintf(stdout,("sy_err = " + sx_err);
index cda03cc..c0d7073 100644 (file)
@@ -101,8 +101,8 @@ double timer_read(int n)
 double vranlc(int n, double x, double a, double *y)
 {
   int i;
-  long  i246m1=0x00003FFFFFFFFFFF;
-  long  LLx, Lx, La;
+  uint64_t  i246m1=0x00003FFFFFFFFFFF;
+  uint64_t  LLx, Lx, La;
   double d2m46;
 
 // This doesn't work, because the compiler does the calculation in 32 bits and overflows. No standard way (without
@@ -111,8 +111,8 @@ double vranlc(int n, double x, double a, double *y)
 
   d2m46=pow(0.5,46);
 
-  Lx = (long)x;
-  La = (long)a;
+  Lx = (uint64_t)x;
+  La = (uint64_t)a;
   //fprintf(stdout,("================== Vranlc ================");
   //fprintf(stdout,("Before Loop: Lx = " + Lx + ", La = " + La);
   LLx = Lx;
index a264f21..c77f058 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <math.h>
 #include "mpi.h"
 
index 680bcd6..9860051 100644 (file)
@@ -49,7 +49,7 @@ public:
   virtual int main(int argc, char **argv);
 
   /** The Actor that is currently running */
-  static Actor *current();
+  static Actor &self();
   /** Retrieves the actor that have the given PID (or NULL if not existing) */
   //static Actor *byPid(int pid); not implemented
 
diff --git a/src/mc/Channel.cpp b/src/mc/Channel.cpp
new file mode 100644 (file)
index 0000000..b368eaf
--- /dev/null
@@ -0,0 +1,53 @@
+/* Copyright (c) 2015-2016. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* 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 <errno.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <xbt/log.h>
+
+#include "src/mc/Channel.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_Channel, mc, "MC interprocess communication");
+
+namespace simgrid {
+namespace mc {
+
+Channel::~Channel()
+{
+  if (this->socket_ >=0)
+    close(this->socket_);
+}
+
+int Channel::send(const void* message, size_t size) const
+{
+  XBT_DEBUG("Protocol [%s] send %s",
+    MC_mode_name(mc_mode),
+    MC_message_type_name(*(e_mc_message_type*) message));
+
+  while (::send(this->socket_, message, size, 0) == -1)
+    if (errno == EINTR)
+      continue;
+    else
+      return errno;
+  return 0;
+}
+
+ssize_t Channel::receive(void* message, size_t size, bool block) const
+{
+  int res = recv(this->socket_, message, size, block ? 0 : MSG_DONTWAIT);
+  if (res != -1)
+    XBT_DEBUG("Protocol [%s] received %s",
+      MC_mode_name(mc_mode),
+      MC_message_type_name(*(e_mc_message_type*) message));
+  return res;
+}
+
+}
+}
diff --git a/src/mc/Channel.hpp b/src/mc/Channel.hpp
new file mode 100644 (file)
index 0000000..61514ad
--- /dev/null
@@ -0,0 +1,81 @@
+/* Copyright (c) 2015-2016. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* 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. */
+
+#ifndef SIMGRID_MC_CHANNEL_HPP
+#define SIMGRID_MC_CHANNEL_HPP
+
+#include <unistd.h>
+
+#include <type_traits>
+
+#include "src/mc/mc_protocol.h"
+
+namespace simgrid {
+namespace mc {
+
+class Channel {
+  int socket_ = -1;
+  template<class M>
+  static constexpr bool messageType()
+  {
+    return std::is_class<M>::value && std::is_trivial<M>::value;
+  }
+public:
+
+  Channel() {}
+  Channel(int sock) : socket_(sock) {}
+  ~Channel();
+
+  // No copy:
+  Channel(Channel const&) = delete;
+  Channel& operator=(Channel const&) = delete;
+
+  // Move:
+  Channel(Channel&& that) : socket_(that.socket_)
+  {
+    that.socket_ = -1;
+  }
+  Channel& operator=(Channel&& that)
+  {
+    this->socket_ = that.socket_;
+    that.socket_ = -1;
+    return *this;
+  }
+
+  // Send
+  int send(const void* message, size_t size) const;
+  int send(e_mc_message_type type) const
+  {
+    s_mc_message message = { type };
+    return this->send(&message, sizeof(message));
+  }
+  template<class M>
+  typename std::enable_if< messageType<M>(), int >::type
+  send(M const& m) const
+  {
+    return this->send(&m, sizeof(M));
+  }
+
+  // Receive
+  ssize_t receive(void* message, size_t size, bool block = true) const;
+  template<class M>
+  typename std::enable_if< messageType<M>(), ssize_t >::type
+  receive(M& m) const
+  {
+    return this->receive(&m, sizeof(M));
+  }
+
+  int getSocket() const
+  {
+    return socket_;
+  }
+
+};
+
+}
+}
+
+#endif
diff --git a/src/mc/Client.cpp b/src/mc/Client.cpp
new file mode 100644 (file)
index 0000000..38ebb68
--- /dev/null
@@ -0,0 +1,245 @@
+/* Copyright (c) 2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* 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 <cstdlib>
+#include <cerrno>
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/socket.h>
+
+#include <xbt/log.h>
+#include <xbt/sysdep.h>
+#include <xbt/mmalloc.h>
+
+#include "src/internal_config.h"
+
+#include "src/mc/mc_protocol.h"
+#include "src/mc/Client.hpp"
+
+// We won't need those once the separation MCer/MCed is complete:
+#include "src/mc/mc_ignore.h"
+#include "src/mc/mc_private.h" // MC_deadlock_check()
+#include "src/mc/mc_smx.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic");
+
+namespace simgrid {
+namespace mc {
+
+std::unique_ptr<Client> Client::client_;
+
+Client* Client::initialize()
+{
+  // We are not in MC mode:
+  // TODO, handle this more gracefully.
+  if (!getenv(MC_ENV_SOCKET_FD))
+    return nullptr;
+
+  // Do not break if we are called multiple times:
+  if (client_)
+    return client_.get();
+
+  // Check and set the mode:
+  if (mc_mode != MC_MODE_NONE)
+    abort();
+  mc_mode = MC_MODE_CLIENT;
+
+  // Fetch socket from MC_ENV_SOCKET_FD:
+  char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
+  if (!fd_env)
+    xbt_die("No MC socket passed in the environment");
+  int fd = xbt_str_parse_int(fd_env, bprintf("Variable %s should contain a number but contains '%%s'", MC_ENV_SOCKET_FD));
+  XBT_DEBUG("Model-checked application found socket FD %i", fd);
+
+  // Check the socket type/validity:
+  int type;
+  socklen_t socklen = sizeof(type);
+  if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0)
+    xbt_die("Could not check socket type");
+  if (type != SOCK_DGRAM)
+    xbt_die("Unexpected socket type %i", type);
+  XBT_DEBUG("Model-checked application found expected socket type");
+
+  client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
+
+  // Wait for the model-checker:
+  if (ptrace(PTRACE_TRACEME, 0, nullptr, NULL) == -1 || raise(SIGSTOP) != 0)
+    xbt_die("Could not wait for the model-checker");
+
+  client_->handleMessages();
+  return client_.get();
+}
+
+void Client::handleMessages()
+{
+  while (1) {
+    XBT_DEBUG("Waiting messages from model-checker");
+
+    char message_buffer[MC_MESSAGE_LENGTH];
+    ssize_t s;
+
+    if ((s = channel_.receive(&message_buffer, sizeof(message_buffer))) < 0)
+      xbt_die("Could not receive commands from the model-checker");
+
+    s_mc_message_t message;
+    if ((size_t) s < sizeof(message))
+      xbt_die("Received message is too small");
+    memcpy(&message, message_buffer, sizeof(message));
+    switch (message.type) {
+
+    case MC_MESSAGE_DEADLOCK_CHECK:
+      {
+        int result = MC_deadlock_check();
+        s_mc_int_message_t answer;
+        answer.type = MC_MESSAGE_DEADLOCK_CHECK_REPLY;
+        answer.value = result;
+        if (channel_.send(answer))
+          xbt_die("Could not send response");
+      }
+      break;
+
+    case MC_MESSAGE_CONTINUE:
+      return;
+
+    case MC_MESSAGE_SIMCALL_HANDLE:
+      {
+        s_mc_simcall_handle_message_t message;
+        if (s != sizeof(message))
+          xbt_die("Unexpected size for SIMCALL_HANDLE");
+        memcpy(&message, message_buffer, sizeof(message));
+        smx_process_t process = SIMIX_process_from_PID(message.pid);
+        if (!process)
+          xbt_die("Invalid pid %lu", (unsigned long) message.pid);
+        SIMIX_simcall_handle(&process->simcall, message.value);
+        if (channel_.send(MC_MESSAGE_WAITING))
+          xbt_die("Could not send MESSAGE_WAITING to model-checker");
+      }
+      break;
+
+    case MC_MESSAGE_RESTORE:
+      {
+        s_mc_restore_message_t message;
+        if (s != sizeof(message))
+          xbt_die("Unexpected size for SIMCALL_HANDLE");
+        memcpy(&message, message_buffer, sizeof(message));
+        smpi_really_switch_data_segment(message.index);
+      }
+      break;
+
+    default:
+      xbt_die("%s received unexpected message %s (%i)",
+        MC_mode_name(mc_mode),
+        MC_message_type_name(message.type),
+        message.type
+      );
+    }
+  }
+}
+
+void Client::mainLoop(void)
+{
+  while (1) {
+    if (channel_.send(MC_MESSAGE_WAITING))
+      xbt_die("Could not send WAITING mesage to model-checker");
+    this->handleMessages();
+    simgrid::mc::wait_for_requests();
+  }
+}
+
+void Client::reportAssertionFailure(const char* description)
+{
+  if (channel_.send(MC_MESSAGE_ASSERTION_FAILED))
+    xbt_die("Could not send assertion to model-checker");
+  this->handleMessages();
+}
+
+void Client::ignoreMemory(void* addr, std::size_t size)
+{
+  s_mc_ignore_memory_message_t message;
+  message.type = MC_MESSAGE_IGNORE_MEMORY;
+  message.addr = (std::uintptr_t) addr;
+  message.size = size;
+  if (channel_.send(message))
+    xbt_die("Could not send IGNORE_MEMORY mesage to model-checker");
+}
+
+void Client::ignoreHeap(void* address, std::size_t size)
+{
+  xbt_mheap_t heap = mmalloc_get_current_heap();
+
+  s_mc_ignore_heap_message_t message;
+  message.type = MC_MESSAGE_IGNORE_HEAP;
+  message.address = address;
+  message.size = size;
+  message.block =
+   ((char *) address -
+    (char *) heap->heapbase) / BLOCKSIZE + 1;
+  if (heap->heapinfo[message.block].type == 0) {
+    message.fragment = -1;
+    heap->heapinfo[message.block].busy_block.ignore++;
+  } else {
+    message.fragment =
+        ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >>
+        heap->heapinfo[message.block].type;
+    heap->heapinfo[message.block].busy_frag.ignore[message.fragment]++;
+  }
+
+  if (channel_.send(message))
+    xbt_die("Could not send ignored region to MCer");
+}
+
+void Client::unignoreHeap(void* address, std::size_t size)
+{
+  s_mc_ignore_memory_message_t message;
+  message.type = MC_MESSAGE_UNIGNORE_HEAP;
+  message.addr = (std::uintptr_t) address;
+  message.size = size;
+  if (channel_.send(message))
+    xbt_die("Could not send IGNORE_HEAP mesasge to model-checker");
+}
+
+void Client::declareSymbol(const char *name, int* value)
+{
+  s_mc_register_symbol_message_t message;
+  message.type = MC_MESSAGE_REGISTER_SYMBOL;
+  if (strlen(name) + 1 > sizeof(message.name))
+    xbt_die("Symbol is too long");
+  strncpy(message.name, name, sizeof(message.name));
+  message.callback = nullptr;
+  message.data = value;
+  if (channel_.send(message))
+    xbt_die("Could send REGISTER_SYMBOL message to model-checker");
+}
+
+void Client::declareStack(void *stack, size_t size, smx_process_t process, ucontext_t* context)
+{
+  xbt_mheap_t heap = mmalloc_get_current_heap();
+
+  s_stack_region_t region;
+  memset(&region, 0, sizeof(region));
+  region.address = stack;
+  region.context = context;
+  region.size = size;
+  region.block =
+      ((char *) stack -
+       (char *) heap->heapbase) / BLOCKSIZE + 1;
+#if HAVE_SMPI
+  if (smpi_privatize_global_variables && process)
+    region.process_index = smpi_process_index_of_smx_process(process);
+  else
+#endif
+  region.process_index = -1;
+
+  s_mc_stack_region_message_t message;
+  message.type = MC_MESSAGE_STACK_REGION;
+  message.stack_region = region;
+  if (channel_.send(message))
+    xbt_die("Coule not send STACK_REGION to model-checker");
+}
+
+}
+}
diff --git a/src/mc/Client.hpp b/src/mc/Client.hpp
new file mode 100644 (file)
index 0000000..69248bc
--- /dev/null
@@ -0,0 +1,63 @@
+/* Copyright (c) 2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* 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. */
+
+#ifndef SIMGRID_MC_CLIENT_H
+#define SIMGRID_MC_CLIENT_H
+
+#include <cstddef>
+
+#include <memory>
+
+#include <xbt/base.h>
+
+#include <simgrid/simix.h>
+
+#include "src/mc/mc_protocol.h"
+#include "src/mc/Channel.hpp"
+
+namespace simgrid {
+namespace mc {
+
+class XBT_PUBLIC() Client {
+private:
+  bool active_ = false;
+  Channel channel_;
+  static std::unique_ptr<Client> client_;
+public:
+  Client();
+  Client(int fd) : active_(true), channel_(fd) {}
+  void handleMessages();
+  Channel const& getChannel() const { return channel_; }
+  Channel& getChannel() { return channel_; }
+  void mainLoop(void);
+  void reportAssertionFailure(const char* description = nullptr);
+  void ignoreMemory(void* addr, std::size_t size);
+  void ignoreHeap(void* addr, std::size_t size);
+  void unignoreHeap(void* addr, std::size_t size);
+  void declareSymbol(const char *name, int* value);
+  void declareStack(void *stack, size_t size, smx_process_t process, ucontext_t* context);
+
+  // Singleton :/
+  // TODO, remove the singleton antipattern.
+  static Client* initialize();
+  static Client* get()
+  {
+    return client_.get();
+  }
+};
+
+}
+}
+
+SG_BEGIN_DECL()
+
+#if HAVE_MC
+void MC_ignore(void* addr, std::size_t size);
+#endif
+
+SG_END_DECL()
+
+#endif
index 636f3ec..bc69fbe 100644 (file)
 #include "src/mc/mc_exit.h"
 #include "src/mc/mc_liveness.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ModelChecker, mc, "ModelChecker");
 
-}
-
 ::simgrid::mc::ModelChecker* mc_model_checker = nullptr;
 
 using simgrid::mc::remote;
@@ -92,7 +88,7 @@ void ModelChecker::start()
   // Prepare data for poll:
 
   struct pollfd* socket_pollfd = &fds_[SOCKET_FD_INDEX];
-  socket_pollfd->fd = process_->socket();;
+  socket_pollfd->fd = process_->getChannel().getSocket();
   socket_pollfd->events = POLLIN;
   socket_pollfd->revents = 0;
 
@@ -177,7 +173,7 @@ void ModelChecker::shutdown()
 
 void ModelChecker::resume(simgrid::mc::Process& process)
 {
-  int res = process.send_message(MC_MESSAGE_CONTINUE);
+  int res = process.getChannel().send(MC_MESSAGE_CONTINUE);
   if (res)
     throw simgrid::xbt::errno_error(res);
   process.cache_flags = (mc_process_cache_flags_t) 0;
@@ -314,7 +310,7 @@ bool ModelChecker::handle_events()
 
   if (socket_pollfd->revents) {
     if (socket_pollfd->revents & POLLIN) {
-      ssize_t size = MC_receive_message(socket_pollfd->fd, buffer, sizeof(buffer), MSG_DONTWAIT);
+      ssize_t size = process_->getChannel().receive(buffer, sizeof(buffer), false);
       if (size == -1 && errno != EAGAIN)
         throw simgrid::xbt::errno_error(errno);
       return handle_message(buffer, size);
@@ -437,7 +433,7 @@ void ModelChecker::simcall_handle(simgrid::mc::Process& process, unsigned long p
   m.type  = MC_MESSAGE_SIMCALL_HANDLE;
   m.pid   = pid;
   m.value = value;
-  process.send_message(m);
+  process.getChannel().send(m);
   process.cache_flags = (mc_process_cache_flags_t) 0;
   while (process.running())
     if (!this->handle_events())
index 3289157..9b196b8 100644 (file)
@@ -15,8 +15,6 @@
 
 #include "src/mc/mc_mmu.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_page_snapshot, mc,
                                 "Logging specific to mc_page_snapshot");
 
@@ -230,5 +228,3 @@ XBT_TEST_UNIT("base", test_mc_page_store, "Test adding/removing pages in the sto
 }
 
 #endif /* SIMGRID_TEST */
-
-}
index 6bf24dc..3f06a40 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_process, mc,
                                 "MC process information");
 
-}
-
 // ***** Helper stuff
 
 namespace simgrid {
@@ -205,7 +201,7 @@ int open_vm(pid_t pid, int flags)
 // ***** Process
 
 Process::Process(pid_t pid, int sockfd) :
-   AddressSpace(this),pid_(pid), socket_(sockfd), running_(true)
+   AddressSpace(this), pid_(pid), channel_(sockfd), running_(true)
 {}
 
 void Process::init()
@@ -237,12 +233,6 @@ void Process::init()
 
 Process::~Process()
 {
-  if (this->socket_ >= 0 && close(this->socket_) < 0)
-    xbt_die("Could not close communication socket");
-
-  this->maestro_stack_start_ = nullptr;
-  this->maestro_stack_end_ = nullptr;
-
   if (this->memory_file >= 0)
     close(this->memory_file);
 
@@ -250,13 +240,8 @@ Process::~Process()
     unw_destroy_addr_space(this->unw_underlying_addr_space);
     _UPT_destroy(this->unw_underlying_context);
   }
-  this->unw_underlying_context = nullptr;
-  this->unw_underlying_addr_space = nullptr;
 
   unw_destroy_addr_space(this->unw_addr_space);
-  this->unw_addr_space = nullptr;
-
-  this->cache_flags = MC_PROCESS_CACHE_FLAG_NONE;
 
   if (this->clear_refs_fd_ >= 0)
     close(this->clear_refs_fd_);
@@ -688,9 +673,16 @@ void Process::ignore_local_variable(const char *var_name, const char *frame_name
 std::vector<simgrid::mc::SimixProcessInformation>& Process::simix_processes()
 {
   xbt_assert(mc_mode != MC_MODE_CLIENT);
-  MC_process_smx_refresh(&mc_model_checker->process());
+  this->refresh_simix();
   return smx_process_infos;
 }
 
+std::vector<simgrid::mc::SimixProcessInformation>& Process::old_simix_processes()
+{
+  xbt_assert(mc_mode != MC_MODE_CLIENT);
+  this->refresh_simix();
+  return smx_old_process_infos;
+}
+
 }
 }
index cd090fc..36ef994 100644 (file)
@@ -22,9 +22,8 @@
 #include <xbt/dynar.h>
 #include <xbt/mmalloc.h>
 
-#if HAVE_MC
 #include "src/xbt/mmalloc/mmprivate.h"
-#endif
+#include "src/mc/Channel.hpp"
 
 #include <simgrid/simix.h>
 #include "src/simix/popping_private.h"
@@ -82,6 +81,19 @@ struct IgnoredHeapRegion {
 };
 
 /** Representation of a process
+ *
+ *  This class is mixing a lot of differents responsabilities and is tied
+ *  to SIMIX. It should probably split into different classes.
+ *
+ *  Responsabilities:
+ *
+ *  - reading from the process memory (`AddressSpace`);
+ *  - accessing the system state of the porcess (heap, â€¦);
+ *  - storing the SIMIX state of the process;
+ *  - privatization;
+ *  - communication with the model-checked process;
+ *  - stack unwinding;
+ *  - etc.
  */
 class Process final : public AddressSpace {
 public:
@@ -134,6 +146,9 @@ public:
     return this->heap_info.data();
   }
 
+  Channel const& getChannel() const { return channel_; }
+  Channel& getChannel() { return channel_; }
+
   std::vector<IgnoredRegion> const& ignored_regions() const
   {
     return ignored_regions_;
@@ -157,25 +172,6 @@ public:
     running_ = false;
   }
 
-  template<class M>
-  typename std::enable_if< std::is_class<M>::value && std::is_trivial<M>::value, int >::type
-  send_message(M const& m)
-  {
-    return MC_protocol_send(this->socket_, &m, sizeof(M));
-  }
-
-  int send_message(e_mc_message_type message_id)
-  {
-    return MC_protocol_send_simple_message(this->socket_, message_id);
-  }
-
-  template<class M>
-  typename std::enable_if< std::is_class<M>::value && std::is_trivial<M>::value, ssize_t >::type
-  receive_message(M& m)
-  {
-    return MC_receive_message(this->socket_, &m, sizeof(M), 0);
-  }
-
   void reset_soft_dirty();
   void read_pagemap(uint64_t* pagemap, size_t start_page, size_t page_count);
 
@@ -213,17 +209,18 @@ public:
   void unignore_heap(void *address, size_t size);
 
   void ignore_local_variable(const char *var_name, const char *frame_name);
-  int socket() { return socket_; }
   std::vector<simgrid::mc::SimixProcessInformation>& simix_processes();
+  std::vector<simgrid::mc::SimixProcessInformation>& old_simix_processes();
 
 private:
   void init_memory_map_info();
   void refresh_heap();
   void refresh_malloc_info();
+  void refresh_simix();
 
 private:
   pid_t pid_ = -1;
-  int socket_ = -1;
+  Channel channel_;
   bool running_ = false;
   std::vector<simgrid::xbt::VmMap> memory_map_;
   RemotePtr<void> maestro_stack_start_, maestro_stack_end_;
index 0c80a3b..fc74d88 100644 (file)
 #include "src/mc/ChunkedData.hpp"
 #include "src/mc/RegionSnapshot.hpp"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_RegionSnaphot, mc,
                                 "Logging specific to region snapshots");
 
-}
-
 namespace simgrid {
 namespace mc {
 
index 7e04621..a4f048a 100644 (file)
@@ -21,15 +21,24 @@ namespace mc {
 class Variable {
 public:
   Variable() {}
-  unsigned dwarf_offset = 0; /* Global offset of the field. */
-  int global = 0;
+  std::uint32_t id = 0;
+  bool global = false;
   std::string name;
   unsigned type_id = 0;
   simgrid::mc::Type* type = nullptr;
-  // Use either of:
-  simgrid::dwarf::LocationList location_list;
+
+  /** Address of the variable -if it is fixed) */
   void* address = nullptr;
+
+  /** Description of the location of the variable if it's not fixed */
+  simgrid::dwarf::LocationList location_list;
+
+  /** Offset of validity of the variable (DW_AT_start_scope)
+   *
+   *  This variable is not valid since the beginning of its scope.
+   */
   std::size_t start_scope = 0;
+
   simgrid::mc::ObjectInformation* object_info = nullptr;
 };
 
index dd609ad..f68fc96 100644 (file)
 using simgrid::mc::remote;
 #endif
 
-extern "C" {
-
 XBT_LOG_NEW_CATEGORY(mc, "All MC categories");
 
-}
-
 int MC_random(int min, int max)
 {
   xbt_assert(mc_mode != MC_MODE_SERVER);
index 99b11bc..1c0c1ce 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc,
                                 "Logging specific to mc_checkpoint");
 
-}
-
 namespace simgrid {
 namespace mc {
 
@@ -607,7 +603,7 @@ void restore_snapshot_regions(mc_snapshot_t snapshot)
     s_mc_restore_message message;
     message.type = MC_MESSAGE_RESTORE;
     message.index = snapshot->privatization_index;
-    mc_model_checker->process().send_message(message);
+    mc_model_checker->process().getChannel().send(message);
   }
 #endif
 }
diff --git a/src/mc/mc_client.cpp b/src/mc/mc_client.cpp
deleted file mode 100644 (file)
index cb82224..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* 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 <cstdlib>
-#include <cerrno>
-
-#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <sys/socket.h>
-
-#include <xbt/log.h>
-#include <xbt/sysdep.h>
-#include <xbt/mmalloc.h>
-
-#include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
-
-// We won't need those once the separation MCer/MCed is complete:
-#include "src/mc/mc_ignore.h"
-#include "src/mc/mc_private.h" // MC_deadlock_check()
-#include "src/mc/mc_smx.h"
-
-extern "C" {
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client, mc, "MC client logic");
-
-mc_client_t mc_client;
-
-void MC_client_init(void)
-{
-  if (mc_mode != MC_MODE_NONE)
-    return;
-  if (!getenv(MC_ENV_SOCKET_FD))
-    return;
-  mc_mode = MC_MODE_CLIENT;
-
-  if (mc_client) {
-    XBT_WARN("MC_client_init called more than once.");
-    return;
-  }
-
-  char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
-  if (!fd_env)
-    xbt_die("MC socket not found");
-
-  int fd = xbt_str_parse_int(fd_env,bprintf("Variable %s should contain a number but contains '%%s'", MC_ENV_SOCKET_FD));
-  XBT_DEBUG("Model-checked application found socket FD %i", fd);
-
-  int type;
-  socklen_t socklen = sizeof(type);
-  if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &type, &socklen) != 0)
-    xbt_die("Could not check socket type");
-  if (type != SOCK_DGRAM)
-    xbt_die("Unexpected socket type %i", type);
-  XBT_DEBUG("Model-checked application found expected socket type");
-
-  mc_client = xbt_new0(s_mc_client_t, 1);
-  mc_client->fd = fd;
-  mc_client->active = 1;
-
-  // Waiting for the model-checker:
-  if (ptrace(PTRACE_TRACEME, 0, nullptr, NULL) == -1 || raise(SIGSTOP) != 0)
-    xbt_die("Could not wait for the model-checker");
-  MC_client_handle_messages();
-}
-
-void MC_client_send_message(void* message, size_t size)
-{
-  if (MC_protocol_send(mc_client->fd, message, size))
-    xbt_die("Could not send message %i", (int) ((mc_message_t)message)->type);
-}
-
-void MC_client_send_simple_message(e_mc_message_type type)
-{
-  if (MC_protocol_send_simple_message(mc_client->fd, type))
-    xbt_die("Could not send message %i", type);
-}
-
-void MC_client_handle_messages(void)
-{
-  while (1) {
-    XBT_DEBUG("Waiting messages from model-checker");
-
-    char message_buffer[MC_MESSAGE_LENGTH];
-    ssize_t s;
-    if ((s = MC_receive_message(mc_client->fd, &message_buffer, sizeof(message_buffer), 0)) < 0)
-      xbt_die("Could not receive commands from the model-checker");
-
-    s_mc_message_t message;
-    if ((size_t) s < sizeof(message))
-      xbt_die("Received message is too small");
-    memcpy(&message, message_buffer, sizeof(message));
-    switch (message.type) {
-
-    case MC_MESSAGE_DEADLOCK_CHECK:
-      {
-        int result = MC_deadlock_check();
-        s_mc_int_message_t answer;
-        answer.type = MC_MESSAGE_DEADLOCK_CHECK_REPLY;
-        answer.value = result;
-        if (MC_protocol_send(mc_client->fd, &answer, sizeof(answer)))
-          xbt_die("Could not send response");
-      }
-      break;
-
-    case MC_MESSAGE_CONTINUE:
-      return;
-
-    case MC_MESSAGE_SIMCALL_HANDLE:
-      {
-        s_mc_simcall_handle_message_t message;
-        if (s != sizeof(message))
-          xbt_die("Unexpected size for SIMCALL_HANDLE");
-        memcpy(&message, message_buffer, sizeof(message));
-        smx_process_t process = SIMIX_process_from_PID(message.pid);
-        if (!process)
-          xbt_die("Invalid pid %lu", (unsigned long) message.pid);
-        SIMIX_simcall_handle(&process->simcall, message.value);
-        MC_protocol_send_simple_message(mc_client->fd, MC_MESSAGE_WAITING);
-      }
-      break;
-
-    case MC_MESSAGE_RESTORE:
-      {
-        s_mc_restore_message_t message;
-        if (s != sizeof(message))
-          xbt_die("Unexpected size for SIMCALL_HANDLE");
-        memcpy(&message, message_buffer, sizeof(message));
-        smpi_really_switch_data_segment(message.index);
-      }
-      break;
-
-    default:
-      xbt_die("%s received unexpected message %s (%i)",
-        MC_mode_name(mc_mode),
-        MC_message_type_name(message.type),
-        message.type
-      );
-    }
-  }
-}
-
-void MC_client_main_loop(void)
-{
-  while (1) {
-    MC_protocol_send_simple_message(mc_client->fd, MC_MESSAGE_WAITING);
-    MC_client_handle_messages();
-    simgrid::mc::wait_for_requests();
-  }
-}
-
-}
diff --git a/src/mc/mc_client.h b/src/mc/mc_client.h
deleted file mode 100644 (file)
index 0f1fc22..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* 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. */
-
-#ifndef SIMGRID_MC_CLIENT_H
-#define SIMGRID_MC_CLIENT_H
-
-#include <cstddef>
-
-#include <xbt/base.h>
-#include "src/mc/mc_protocol.h"
-
-SG_BEGIN_DECL()
-
-typedef struct s_mc_client {
-  int active;
-  int fd;
-} s_mc_client_t, *mc_client_t;
-
-extern XBT_PRIVATE mc_client_t mc_client;
-
-XBT_PRIVATE void MC_client_init(void);
-XBT_PRIVATE void MC_client_handle_messages(void);
-XBT_PRIVATE void MC_client_send_message(void* message, std::size_t size);
-XBT_PRIVATE void MC_client_send_simple_message(e_mc_message_type type);
-
-#if HAVE_MC
-void MC_ignore(void* addr, std::size_t size);
-#endif
-
-void MC_client_main_loop(void);
-
-SG_END_DECL()
-
-#endif
index 9433798..9f6c575 100644 (file)
@@ -13,7 +13,7 @@
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_ignore.h"
 #include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/mc/ModelChecker.hpp"
 
 /** \file mc_client_api.cpp
  *  communicate with the MC (declared in modelchecker.h).
  */
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc,
   "Public API for the model-checked application");
 
-}
-
 // MC_random() is in mc_base.cpp
 
 void MC_assert(int prop)
 {
-  if (MC_is_active() && !prop) {
-    MC_client_send_simple_message(MC_MESSAGE_ASSERTION_FAILED);
-    MC_client_handle_messages();
-  }
+  if (MC_is_active() && !prop)
+    simgrid::mc::Client::get()->reportAssertionFailure();
 }
 
 void MC_cut(void)
 {
-  user_max_depth_reached = 1;
+  // FIXME, We want to do this in the model-checker:
+  // user_max_depth_reached = 1;
+  xbt_die("MC_cut() not implemented");
 }
 
 void MC_ignore(void* addr, size_t size)
@@ -49,12 +45,7 @@ void MC_ignore(void* addr, size_t size)
   xbt_assert(mc_mode != MC_MODE_SERVER);
   if (mc_mode != MC_MODE_CLIENT)
     return;
-
-  s_mc_ignore_memory_message_t message;
-  message.type = MC_MESSAGE_IGNORE_MEMORY;
-  message.addr = (std::uintptr_t) addr;
-  message.size = size;
-  MC_client_send_message(&message, sizeof(message));
+  simgrid::mc::Client::get()->ignoreMemory(addr, size);
 }
 
 void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void))
@@ -73,13 +64,43 @@ void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
   xbt_assert(mc_mode != MC_MODE_SERVER);
   if (mc_mode != MC_MODE_CLIENT)
     return;
+  simgrid::mc::Client::get()->declareSymbol(name, value);
+}
+
+/** @brief Register a stack in the model checker
+ *
+ *  The stacks are allocated in the heap. The MC handle them especially
+ *  when we analyse/compare the content of the heap so it must be told where
+ *  they are with this function.
+ *
+ *  @param stack
+ *  @param process Process owning the stack
+ *  @param context
+ *  @param size    Size of the stack
+ */
+void MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size)
+{
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+  simgrid::mc::Client::get()->declareStack(stack, size, process, context);
+}
+
+void MC_ignore_global_variable(const char *name)
+{
+  // TODO, send a message to the model_checker
+  xbt_die("Unimplemented");
+}
+
+void MC_ignore_heap(void *address, size_t size)
+{
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+  simgrid::mc::Client::get()->ignoreHeap(address, size);
+}
 
-  s_mc_register_symbol_message_t message;
-  message.type = MC_MESSAGE_REGISTER_SYMBOL;
-  if (strlen(name) + 1 > sizeof(message.name))
-    xbt_die("Symbol is too long");
-  strncpy(message.name, name, sizeof(message.name));
-  message.callback = nullptr;
-  message.data = value;
-  MC_client_send_message(&message, sizeof(message));
+void MC_remove_ignore_heap(void *address, size_t size)
+{
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
+  simgrid::mc::Client::get()->unignoreHeap(address, size);
 }
index f1119d2..4cca3ce 100644 (file)
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_smx.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/mc/mc_exit.h"
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc,
                                 "Logging specific to MC communication determinism detection");
 
+extern "C" {
+
 /********** Global variables **********/
 
 xbt_dynar_t initial_communications_pattern;
@@ -468,7 +468,7 @@ int MC_modelcheck_comm_determinism(void)
 
   if (mc_mode == MC_MODE_CLIENT)
     // This will move somehwere else:
-    MC_client_handle_messages();
+    simgrid::mc::Client::get()->handleMessages();
 
   /* Create exploration stack */
   mc_stack = xbt_fifo_new();
index 0a5ff5e..3c89669 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_pattern, mc,
                                 "Logging specific to MC communication patterns");
 
+extern "C" {
+
 mc_comm_pattern_t MC_comm_pattern_dup(mc_comm_pattern_t comm)
 {
   mc_comm_pattern_t res = xbt_new0(s_mc_comm_pattern_t, 1);
index 232feec..8aaaefb 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, xbt,
                                 "Logging specific to mc_compare in mc");
 
-}
-
 namespace simgrid {
 namespace mc {
 
index a0ddac8..5644684 100644 (file)
 
 #include "src/mc/mc_record.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_config, mc,
                                 "Configuration of MC");
 
-}
-
 #if HAVE_MC
 namespace simgrid {
 namespace mc {
index f7e1e8e..e877474 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_diff, xbt,
                                 "Logging specific to mc_diff in mc");
 
+extern "C" {
+
 /*********************************** Heap comparison ***********************************/
 /***************************************************************************************/
 
index 7942ae2..247d3fe 100644 (file)
@@ -714,7 +714,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
 
   std::unique_ptr<simgrid::mc::Variable> variable =
     std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
-  variable->dwarf_offset = dwarf_dieoffset(die);
+  variable->id = dwarf_dieoffset(die);
   variable->global = frame == nullptr;     // Can be override base on DW_AT_location
   variable->object_info = info;
 
@@ -740,12 +740,12 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
         xbt_die(
           "Could not read location expression in DW_AT_location "
           "of variable <%" PRIx64 ">%s",
-          (uint64_t) variable->dwarf_offset,
+          (uint64_t) variable->id,
           variable->name.c_str());
       }
 
       if (len == 1 && expr[0].atom == DW_OP_addr) {
-        variable->global = 1;
+        variable->global = true;
         uintptr_t offset = (uintptr_t) expr[0].number;
         uintptr_t base = (uintptr_t) info->base_address();
         variable->address = (void *) (base + offset);
@@ -767,7 +767,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
     xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location "
             "in <%" PRIx64 ">%s",
             form, form, (int) form_class, (int) form_class,
-            (uint64_t) variable->dwarf_offset,
+            (uint64_t) variable->id,
             variable->name.c_str());
   }
 
index b84e5eb..d47939e 100644 (file)
 
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
-
-extern "C" {
+#include "src/mc/Client.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc,
                                 "Logging specific to MC (global)");
 
-}
-
 e_mc_mode_t mc_mode;
 
 namespace simgrid {
@@ -144,7 +140,7 @@ void MC_run()
 {
   mc_mode = MC_MODE_CLIENT;
   MC_init();
-  MC_client_main_loop();
+  simgrid::mc::Client::get()->mainLoop();
 }
 
 void MC_exit(void)
@@ -159,10 +155,10 @@ int MC_deadlock_check()
 {
   if (mc_mode == MC_MODE_SERVER) {
     int res;
-    if ((res = mc_model_checker->process().send_message(MC_MESSAGE_DEADLOCK_CHECK)))
+    if ((res = mc_model_checker->process().getChannel().send(MC_MESSAGE_DEADLOCK_CHECK)))
       xbt_die("Could not check deadlock state");
     s_mc_int_message_t message;
-    ssize_t s = mc_model_checker->process().receive_message(message);
+    ssize_t s = mc_model_checker->process().getChannel().receive(message);
     if (s == -1)
       xbt_die("Could not receive message");
     if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
diff --git a/src/mc/mc_ignore.cpp b/src/mc/mc_ignore.cpp
deleted file mode 100644 (file)
index e04d7fc..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* 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 "src/internal_config.h"
-#include "src/mc/mc_private.h"
-#include "src/smpi/private.h"
-#include "src/mc/mc_snapshot.h"
-#include "src/mc/mc_ignore.h"
-#include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
-
-extern "C" {
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ignore, mc,
-                                "Logging specific to MC ignore mechanism");
-
-// ***** Model-checked
-
-void MC_ignore_heap(void *address, size_t size)
-{
-  if (mc_mode != MC_MODE_CLIENT)
-    return;
-
-  xbt_mheap_t heap = mmalloc_get_current_heap();
-
-  s_mc_ignore_heap_message_t message;
-  message.type = MC_MESSAGE_IGNORE_HEAP;
-  message.address = address;
-  message.size = size;
-  message.block =
-   ((char *) address -
-    (char *) heap->heapbase) / BLOCKSIZE + 1;
-  if (heap->heapinfo[message.block].type == 0) {
-    message.fragment = -1;
-    heap->heapinfo[message.block].busy_block.ignore++;
-  } else {
-    message.fragment =
-        ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >>
-        heap->heapinfo[message.block].type;
-    heap->heapinfo[message.block].busy_frag.ignore[message.fragment]++;
-  }
-
-  if (MC_protocol_send(mc_client->fd, &message, sizeof(message)))
-    xbt_die("Could not send ignored region to MCer");
-}
-
-void MC_remove_ignore_heap(void *address, size_t size)
-{
-  if (mc_mode != MC_MODE_CLIENT)
-    return;
-
-  s_mc_ignore_memory_message_t message;
-  message.type = MC_MESSAGE_UNIGNORE_HEAP;
-  message.addr = (std::uintptr_t) address;
-  message.size = size;
-  MC_client_send_message(&message, sizeof(message));
-}
-
-void MC_ignore_global_variable(const char *name)
-{
-  // TODO, send a message to the model_checker
-  xbt_die("Unimplemented");
-}
-
-/** @brief Register a stack in the model checker
- *
- *  The stacks are allocated in the heap. The MC handle them especially
- *  when we analyse/compare the content of the heap so it must be told where
- *  they are with this function.
- *
- *  @param stack
- *  @param process Process owning the stack
- *  @param context
- *  @param size    Size of the stack
- */
-void MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size)
-{
-  if (mc_mode != MC_MODE_CLIENT)
-    return;
-
-  xbt_mheap_t heap = mmalloc_get_current_heap();
-
-  s_stack_region_t region;
-  memset(&region, 0, sizeof(region));
-  region.address = stack;
-  region.context = context;
-  region.size = size;
-  region.block =
-      ((char *) stack -
-       (char *) heap->heapbase) / BLOCKSIZE + 1;
-#if HAVE_SMPI
-  if (smpi_privatize_global_variables && process)
-    region.process_index = smpi_process_index_of_smx_process(process);
-  else
-#endif
-  region.process_index = -1;
-
-  s_mc_stack_region_message_t message;
-  message.type = MC_MESSAGE_STACK_REGION;
-  message.stack_region = region;
-  MC_client_send_message(&message, sizeof(message));
-}
-
-}
index 718fe43..bce2296 100644 (file)
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_smx.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/mc/mc_replay.h"
 #include "src/mc/mc_safety.h"
 #include "src/mc/mc_exit.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
                                 "Logging specific to algorithms for liveness properties verification");
 
-}
-
 /********* Global variables *********/
 
 xbt_dynar_t acceptance_pairs;
index 5a452f6..1db534b 100644 (file)
 #include "mc/mc.h"
 #include "src/mc/mc_private.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc,
                                 "Logging specific to MC (memory)");
 
+extern "C" {
+
 /* Initialize the model-checker memory subsystem */
 /* It creates the two heap regions: std_heap and mc_heap */
 void MC_memory_init()
index 027bdda..b19f993 100644 (file)
 #include <xbt/log.h>
 
 #include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
-
-extern "C" {
+#include "src/mc/Client.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_protocol, mc, "Generic MC protocol logic");
 
-int MC_protocol_send(int socket, const void* message, std::size_t size)
-{
-  XBT_DEBUG("Protocol [%s] send %s",
-    MC_mode_name(mc_mode),
-    MC_message_type_name(*(e_mc_message_type*) message));
-
-  while (send(socket, message, size, 0) == -1)
-    if (errno == EINTR)
-      continue;
-    else
-      return errno;
-  return 0;
-}
-
-int MC_protocol_send_simple_message(int socket, e_mc_message_type type)
-{
-  s_mc_message_t message;
-  message.type = type;
-  return MC_protocol_send(socket, &message, sizeof(message));
-}
-
-ssize_t MC_receive_message(int socket, void* message, size_t size, int options)
-{
-  int res = recv(socket, message, size, options);
-  if (res != -1)
-    XBT_DEBUG("Protocol [%s] received %s",
-      MC_mode_name(mc_mode),
-      MC_message_type_name(*(e_mc_message_type*) message));
-  return res;
-}
-
 const char* MC_message_type_name(e_mc_message_type type)
 {
   switch(type) {
@@ -97,5 +64,3 @@ const char* MC_mode_name(e_mc_mode_t mode)
     return "?";
   }
 }
-
-}
index bd6fd13..b48902b 100644 (file)
@@ -114,10 +114,6 @@ typedef struct s_mc_restore_message {
   int index;
 } s_mc_restore_message_t, *mc_restore_message_t;
 
-XBT_PRIVATE int MC_protocol_send(int socket, const void* message, size_t size);
-XBT_PRIVATE int MC_protocol_send_simple_message(int socket, e_mc_message_type type);
-XBT_PRIVATE ssize_t MC_receive_message(int socket, void* message, size_t size, int options);
-
 XBT_PRIVATE const char* MC_message_type_name(e_mc_message_type type);
 XBT_PRIVATE const char* MC_mode_name(e_mc_mode_t mode);
 
index 216356d..494f961 100644 (file)
 #include "src/mc/mc_liveness.h"
 #endif
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_record, mc,
   " Logging specific to MC record/replay facility");
 
+extern "C" {
+
 char* MC_record_path = nullptr;
 
 void MC_record_replay(mc_record_item_t start, std::size_t len)
index d6be451..9500f33 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc,
                                 "Logging specific to MC (request)");
 
-}
-
 static char *pointer_to_string(void *pointer);
 static char *buff_size_to_string(size_t size);
 
index 74fde12..b9ffea3 100644 (file)
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_smx.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/mc/mc_exit.h"
 
 #include "src/xbt/mmalloc/mmprivate.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_safety, mc,
                                 "Logging specific to MC safety verification ");
 
-}
-
 namespace simgrid {
 namespace mc {
 
index ef15f63..0436185 100644 (file)
@@ -71,29 +71,35 @@ static void MC_process_refresh_simix_process_list(
   assert(i == swag.count);
 }
 
-void MC_process_smx_refresh(simgrid::mc::Process* process)
+namespace simgrid {
+namespace mc {
+
+void Process::refresh_simix()
 {
   xbt_assert(mc_mode == MC_MODE_SERVER);
-  if (process->cache_flags & MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES)
+  if (this->cache_flags & MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES)
     return;
 
   // TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global`
 
   // simix_global_p = REMOTE(simix_global);
   smx_global_t simix_global_p;
-  process->read_variable("simix_global", &simix_global_p, sizeof(simix_global_p));
+  this->read_variable("simix_global", &simix_global_p, sizeof(simix_global_p));
 
   // simix_global = REMOTE(*simix_global)
   s_smx_global_t simix_global;
-  process->read_bytes(&simix_global, sizeof(simix_global),
+  this->read_bytes(&simix_global, sizeof(simix_global),
     remote(simix_global_p));
 
   MC_process_refresh_simix_process_list(
-    process, process->smx_process_infos, simix_global.process_list);
+    this, this->smx_process_infos, simix_global.process_list);
   MC_process_refresh_simix_process_list(
-    process, process->smx_old_process_infos, simix_global.process_to_destroy);
+    this, this->smx_old_process_infos, simix_global.process_to_destroy);
 
-  process->cache_flags |= MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES;
+  this->cache_flags |= MC_PROCESS_CACHE_FLAG_SIMIX_PROCESSES;
+}
+
+}
 }
 
 /** Get the issuer of a simcall (`req->issuer`)
@@ -110,16 +116,14 @@ smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req)
   if (mc_mode == MC_MODE_CLIENT)
     return req->issuer;
 
-  MC_process_smx_refresh(&mc_model_checker->process());
-
   // This is the address of the smx_process in the MCed process:
   void* address = req->issuer;
 
   // Lookup by address:
-  for (auto& p : mc_model_checker->process().smx_process_infos)
+  for (auto& p : mc_model_checker->process().simix_processes())
     if (p.address == address)
       return &p.copy;
-  for (auto& p : mc_model_checker->process().smx_old_process_infos)
+  for (auto& p : mc_model_checker->process().old_simix_processes())
     if (p.address == address)
       return &p.copy;
 
index 510a7de..741ba37 100644 (file)
 
 using simgrid::mc::remote;
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc,
                                 "Logging specific to MC (state)");
 
+extern "C" {
+
 /**
  * \brief Creates a state data structure used by the exploration algorithm
  */
index 590b3cf..e87f274 100644 (file)
 #include "src/mc/Process.hpp"
 #include "src/mc/mc_smx.h"
 
-extern "C" {
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_visited, mc,
                                 "Logging specific to state equaity detection mechanisms");
 
-}
-
 namespace simgrid {
 namespace mc {
 
@@ -56,9 +52,8 @@ VisitedState::VisitedState()
     process->get_heap()->heaplimit,
     process->get_malloc_info());
 
-  MC_process_smx_refresh(&mc_model_checker->process());
   this->nb_processes =
-    mc_model_checker->process().smx_process_infos.size();
+    mc_model_checker->process().simix_processes().size();
 
   this->num = mc_stats->expanded_states;
   this->other_num = -1;
@@ -81,9 +76,8 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state, xb
     process->get_heap()->heaplimit,
     process->get_malloc_info());
 
-  MC_process_smx_refresh(&mc_model_checker->process());
   this->nb_processes =
-    mc_model_checker->process().smx_process_infos.size();
+    mc_model_checker->process().simix_processes().size();
 
   this->automaton_state = automaton_state;
   this->num = pair_num;
index 4e7594c..e1358a5 100644 (file)
@@ -44,13 +44,13 @@ int s4u::Actor::main(int argc, char **argv) {
   fprintf(stderr,"Error: You should override the method main(int, char**) in Actor class %s\n",getName());
   return 0;
 }
-s4u::Actor *s4u::Actor::current()
+s4u::Actor &s4u::Actor::self()
 {
   smx_process_t smx_proc = SIMIX_process_self();
   simgrid::s4u::Actor* res = (simgrid::s4u::Actor*) SIMIX_process_self_get_data();
   if (res == NULL) // The smx_process was not created by S4U (but by deployment?). Embed it in a S4U object
     res = new Actor(smx_proc);
-  return res;
+  return *res;
 }
 
 void s4u::Actor::setAutoRestart(bool autorestart) {
index b48faf5..0b705ad 100644 (file)
@@ -21,7 +21,7 @@
 #if HAVE_MC
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 
 #include <stdlib.h>
 #include "src/mc/mc_protocol.h"
@@ -266,7 +266,7 @@ void SIMIX_global_init(int *argc, char **argv)
 #if HAVE_MC
   // The communication initialization is done ASAP.
   // We need to communicate  initialization of the different layers to the model-checker.
-  MC_client_init();
+  simgrid::mc::Client::initialize();
 #endif
 
   if (_sg_cfg_exit_asap)
index 0215582..81e6ab5 100644 (file)
@@ -11,7 +11,7 @@
 #include "xbt/dict.h"
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
-#include "src/mc/mc_client.h"
+#include "src/mc/Client.hpp"
 #include "src/simix/smx_private.hpp"
 #include "src/msg/msg_private.h"
 
index ce90e8a..d5601f0 100644 (file)
@@ -19,15 +19,19 @@ void surf_network_model_init_Constant()
 
   routing_model_create(NULL);
 
-  simgrid::surf::on_link.connect([](sg_platf_link_cbarg_t link){
-    xbt_die("There is no link in the Constant network model. "
-        "Please remove any link from your platform (and switch to routing='None')");
-  });
+  simgrid::surf::on_link.connect(netlink_parse_init);
 }
 
 namespace simgrid {
   namespace surf {
 
+    Link* NetworkConstantModel::createLink(const char *name, double bw, double lat, e_surf_link_sharing_policy_t policy,
+        xbt_dict_t properties) {
+
+      xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
+          "Please remove any link from your platform (and switch to routing='None')", name);
+    }
+
     double NetworkConstantModel::next_occuring_event(double /*now*/)
     {
       NetworkConstantAction *action = NULL;
index 9848e7a..a15b173 100644 (file)
@@ -34,8 +34,7 @@ namespace simgrid {
       bool next_occuring_event_isIdempotent() override {return true;}
       void updateActionsState(double now, double delta) override;
 
-      Link* createLink(const char *name, double bw, double lat, e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override
-        { DIE_IMPOSSIBLE; }
+      Link* createLink(const char *name, double bw, double lat, e_surf_link_sharing_policy_t policy, xbt_dict_t properties) override;
     };
 
     /**********
index b53f312..6034eae 100644 (file)
@@ -102,38 +102,25 @@ namespace simgrid {
 }
 
 void netlink_parse_init(sg_platf_link_cbarg_t link){
-  if (link->policy == SURF_LINK_FULLDUPLEX) {
-    char *link_id;
-    link_id = bprintf("%s_UP", link->id);
-    Link *l = surf_network_model->createLink(link_id, link->bandwidth, link->latency,
-        link->policy, link->properties);
-    if (link->latency_trace)
-      l->setLatencyTrace(link->latency_trace);
-    if (link->bandwidth_trace)
-      l->setBandwidthTrace(link->bandwidth_trace);
-    if (link->state_trace)
-      l->setStateTrace(link->state_trace);
+  std::vector<char*> names;
 
-    xbt_free(link_id);
-    link_id = bprintf("%s_DOWN", link->id);
-    l = surf_network_model->createLink(link_id, link->bandwidth, link->latency,
-        link->policy, link->properties);
-    if (link->latency_trace)
-      l->setLatencyTrace(link->latency_trace);
-    if (link->bandwidth_trace)
-      l->setBandwidthTrace(link->bandwidth_trace);
-    if (link->state_trace)
-      l->setStateTrace(link->state_trace);
-    xbt_free(link_id);
+  if (link->policy == SURF_LINK_FULLDUPLEX) {
+    names.push_back(bprintf("%s_UP", link->id));
+    names.push_back(bprintf("%s_DOWN", link->id));
   } else {
-    Link *l=surf_network_model->createLink(link->id, link->bandwidth, link->latency,
-        link->policy, link->properties);
+    names.push_back(xbt_strdup(link->id));
+  }
+  for (auto link_name : names) {
+    Link *l = surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy, link->properties);
+
     if (link->latency_trace)
       l->setLatencyTrace(link->latency_trace);
     if (link->bandwidth_trace)
       l->setBandwidthTrace(link->bandwidth_trace);
     if (link->state_trace)
       l->setStateTrace(link->state_trace);
+
+    xbt_free(link_name);
   }
 }
 
index 8a583d1..3064e7d 100644 (file)
@@ -17,7 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ns3);
 
 int NS3_EXTENSION_ID;
 
-xbt_dynar_t IPV4addr;
+xbt_dynar_t IPV4addr = xbt_dynar_new(sizeof(char*),free);
 static double time_to_next_flow_completion = -1;
 
 extern xbt_dict_t dict_socket;
@@ -37,11 +37,7 @@ static void parse_ns3_add_link(sg_platf_link_cbarg_t link)
 {
   XBT_DEBUG("NS3_ADD_LINK '%s'",link->id);
 
-  if(!IPV4addr)
-    IPV4addr = xbt_dynar_new(sizeof(char*),free);
-
-  Link *l = surf_network_model->createLink(link->id, link->bandwidth, link->latency,
-      link->policy, link->properties);
+  Link *l = surf_network_model->createLink(link->id, link->bandwidth, link->latency, link->policy, link->properties);
   if (link->bandwidth_trace)
     l->setBandwidthTrace(link->latency_trace);
   if (link->latency_trace)
@@ -210,7 +206,7 @@ static void define_callbacks_ns3(void)
 {
   simgrid::s4u::Host::onCreation.connect(simgrid_ns3_add_host);
   simgrid::surf::netcardCreatedCallbacks.connect(simgrid_ns3_add_router);
-  simgrid::surf::on_link.connect (&parse_ns3_add_link);
+  simgrid::surf::on_link.connect (parse_ns3_add_link);
   simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
   simgrid::surf::asCreatedCallbacks.connect(parse_ns3_add_AS);
   simgrid::surf::on_postparse.connect(&create_ns3_topology); //get_one_link_routes
index 408873c..b94e7ce 100644 (file)
@@ -20,13 +20,6 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg);
 /**************************************/
 /*** Resource Creation & Destruction **/
 /**************************************/
-
-static void ptask_netlink_parse_init(sg_platf_link_cbarg_t link)
-{
-  netlink_parse_init(link);
-  current_property_set = NULL;
-}
-
 void surf_host_model_init_ptask_L07(void)
 {
   XBT_CINFO(xbt_cfg,"Switching to the L07 model to handle parallel tasks.");
@@ -34,7 +27,7 @@ void surf_host_model_init_ptask_L07(void)
   xbt_assert(!surf_network_model, "network model type already defined");
 
   // Define the callbacks to parse the XML
-  simgrid::surf::on_link.connect(ptask_netlink_parse_init);
+  simgrid::surf::on_link.connect(netlink_parse_init);
 
   surf_host_model = new simgrid::surf::HostL07Model();
   xbt_dynar_push(all_existing_models, &surf_host_model);
index 55010c7..3adc2e1 100644 (file)
@@ -425,6 +425,75 @@ void routing_cluster_add_backbone(simgrid::surf::Link* bb) {
   XBT_DEBUG("Add a backbone to AS '%s'", current_routing->name());
 }
 
+void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
+{
+  int start, end, i;
+  char *groups , *host_id , *link_id = NULL;
+  unsigned int iter;
+  xbt_dynar_t radical_elements;
+  xbt_dynar_t radical_ends;
+
+  //Make all hosts
+  radical_elements = xbt_str_split(cabinet->radical, ",");
+  xbt_dynar_foreach(radical_elements, iter, groups) {
+
+    radical_ends = xbt_str_split(groups, "-");
+    start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
+
+    switch (xbt_dynar_length(radical_ends)) {
+    case 1:
+      end = start;
+      break;
+    case 2:
+      end = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 1, char *));
+      break;
+    default:
+      surf_parse_error("Malformed radical");
+      break;
+    }
+    s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER;
+    memset(&host, 0, sizeof(host));
+    host.pstate        = 0;
+    host.core_amount   = 1;
+
+    s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
+    memset(&link, 0, sizeof(link));
+    link.policy    = SURF_LINK_FULLDUPLEX;
+    link.latency   = cabinet->lat;
+    link.bandwidth = cabinet->bw;
+
+    s_sg_platf_host_link_cbarg_t host_link = SG_PLATF_HOST_LINK_INITIALIZER;
+    memset(&host_link, 0, sizeof(host_link));
+
+    for (i = start; i <= end; i++) {
+      host_id                      = bprintf("%s%d%s",cabinet->prefix,i,cabinet->suffix);
+      link_id                      = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
+      host.id                      = host_id;
+      link.id                      = link_id;
+      host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
+      xbt_dynar_push(host.speed_peak,&cabinet->speed);
+      sg_platf_new_host(&host);
+      xbt_dynar_free(&host.speed_peak);
+      sg_platf_new_link(&link);
+
+      char* link_up       = bprintf("%s_UP",link_id);
+      char* link_down     = bprintf("%s_DOWN",link_id);
+      host_link.id        = host_id;
+      host_link.link_up   = link_up;
+      host_link.link_down = link_down;
+      sg_platf_new_hostlink(&host_link);
+
+      free(host_id);
+      free(link_id);
+      free(link_up);
+      free(link_down);
+    }
+
+    xbt_dynar_free(&radical_ends);
+  }
+  xbt_dynar_free(&radical_elements);
+}
+
 void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
 {
   xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL),
@@ -667,15 +736,13 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   link.latency = peer->lat;
 
   char* link_up = bprintf("%s_UP",link_id);
-  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_up,
-            peer->bw_out, peer->lat);
+  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_up, peer->bw_out, peer->lat);
   link.id = link_up;
   link.bandwidth = peer->bw_out;
   sg_platf_new_link(&link);
 
   char* link_down = bprintf("%s_DOWN",link_id);
-  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_down,
-            peer->bw_in, peer->lat);
+  XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_down, peer->bw_in, peer->lat);
   link.id = link_down;
   link.bandwidth = peer->bw_in;
   sg_platf_new_link(&link);
index 4dba6f1..69ab7ea 100644 (file)
@@ -136,75 +136,6 @@ void routing_model_create(Link *loopback)
 /* ************************************************************************** */
 /* ************************* GENERIC PARSE FUNCTIONS ************************ */
 
-void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
-{
-  int start, end, i;
-  char *groups , *host_id , *link_id = NULL;
-  unsigned int iter;
-  xbt_dynar_t radical_elements;
-  xbt_dynar_t radical_ends;
-
-  //Make all hosts
-  radical_elements = xbt_str_split(cabinet->radical, ",");
-  xbt_dynar_foreach(radical_elements, iter, groups) {
-
-    radical_ends = xbt_str_split(groups, "-");
-    start = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 0, char *));
-
-    switch (xbt_dynar_length(radical_ends)) {
-    case 1:
-      end = start;
-      break;
-    case 2:
-      end = surf_parse_get_int(xbt_dynar_get_as(radical_ends, 1, char *));
-      break;
-    default:
-      surf_parse_error("Malformed radical");
-      break;
-    }
-    s_sg_platf_host_cbarg_t host = SG_PLATF_HOST_INITIALIZER;
-    memset(&host, 0, sizeof(host));
-    host.pstate        = 0;
-    host.core_amount   = 1;
-
-    s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
-    memset(&link, 0, sizeof(link));
-    link.policy    = SURF_LINK_FULLDUPLEX;
-    link.latency   = cabinet->lat;
-    link.bandwidth = cabinet->bw;
-
-    s_sg_platf_host_link_cbarg_t host_link = SG_PLATF_HOST_LINK_INITIALIZER;
-    memset(&host_link, 0, sizeof(host_link));
-
-    for (i = start; i <= end; i++) {
-      host_id                      = bprintf("%s%d%s",cabinet->prefix,i,cabinet->suffix);
-      link_id                      = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
-      host.id                      = host_id;
-      link.id                      = link_id;
-      host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
-      xbt_dynar_push(host.speed_peak,&cabinet->speed);
-      sg_platf_new_host(&host);
-      xbt_dynar_free(&host.speed_peak);
-      sg_platf_new_link(&link);
-
-      char* link_up       = bprintf("%s_UP",link_id);
-      char* link_down     = bprintf("%s_DOWN",link_id);
-      host_link.id        = host_id;
-      host_link.link_up   = link_up;
-      host_link.link_down = link_down;
-      sg_platf_new_hostlink(&host_link);
-
-      free(host_id);
-      free(link_id);
-      free(link_up);
-      free(link_down);
-    }
-
-    xbt_dynar_free(&radical_ends);
-  }
-  xbt_dynar_free(&radical_elements);
-}
-
 static void check_disk_attachment()
 {
   xbt_lib_cursor_t cursor;
index 1547bc6..4640bf0 100644 (file)
@@ -20,8 +20,7 @@
 
 #include "src/surf/xml/platf_private.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf,
-                                "Logging specific to the SURF parsing module");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_parse, surf, "Logging specific to the SURF parsing module");
 #undef CLEANUP
 int ETag_surfxml_include_state(void);
 
index 8701f99..1428f70 100644 (file)
@@ -627,7 +627,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(mc_diff);
   XBT_LOG_CONNECT(mc_dwarf);
   XBT_LOG_CONNECT(mc_hash);
-  XBT_LOG_CONNECT(mc_ignore);
   XBT_LOG_CONNECT(mc_liveness);
   XBT_LOG_CONNECT(mc_memory);
   XBT_LOG_CONNECT(mc_page_snapshot);
index 3b0ba5f..51b69e4 100644 (file)
@@ -71,7 +71,6 @@ if(enable_smpi)
   foreach (SCATTER ompi mpich ompi_basic_linear ompi_binomial mvapich2 mvapich2_two_level_binomial mvapich2_two_level_direct impi)
     ADD_TESH(tesh-smpi-coll-scatter-${SCATTER} --cfg smpi/scatter:${SCATTER} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/coll-scatter --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/coll-scatter coll-scatter.tesh)
   endforeach()
-endif()
 
 # Extra allreduce test: large automatic
 ADD_TESH(tesh-smpi-coll-allreduce-large --cfg smpi/allreduce:ompi_ring_segmented --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/coll-allreduce --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/coll-allreduce coll-allreduce-large.tesh)
@@ -84,6 +83,8 @@ ADD_TESH(tesh-smpi-cluster-types --cfg smpi/alltoall:mvapich2 --setenv bindir=${
 ADD_TESH_FACTORIES(tesh-smpi-broken  "thread"   --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong broken_hostfiles.tesh)
 ADD_TESH(tesh-smpi-replay-ti-tracing            --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pt2pt-pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pt2pt-pingpong TI_output.tesh)
 
+endif()
+
 set(teshsuite_src ${teshsuite_src}                                                                         PARENT_SCOPE)
 set(tesh_files    ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/coll-allreduce-large.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/coll-allreduce/coll-allreduce-automatic.tesh
index ef11ae1..0979e0c 100644 (file)
@@ -549,6 +549,10 @@ set(MC_SRC
   src/mc/RemotePtr.hpp
   src/mc/AddressSpace.hpp
   src/mc/AddressSpace.cpp
+  src/mc/Channel.cpp
+  src/mc/Channel.hpp
+  src/mc/Client.cpp
+  src/mc/Client.hpp
   src/mc/Frame.hpp
   src/mc/Frame.cpp
   src/mc/ModelChecker.hpp
@@ -589,7 +593,6 @@ set(MC_SRC
   src/mc/mc_dwarf_tagnames.cpp
   src/mc/mc_hash.hpp
   src/mc/mc_hash.cpp
-  src/mc/mc_ignore.cpp
   src/mc/mc_ignore.h
   src/mc/mc_mmalloc.h
   src/mc/mc_liveness.h
@@ -607,9 +610,7 @@ set(MC_SRC
   src/mc/mc_state.h
   src/mc/mc_state.cpp
   src/mc/mc_visited.cpp
-  src/mc/mc_client.cpp
   src/mc/mc_client_api.cpp
-  src/mc/mc_client.h
   src/mc/mc_protocol.h
   src/mc/mc_protocol.cpp
   src/mc/mc_smx.h
index bc33a8d..6283f84 100644 (file)
@@ -24,7 +24,7 @@ if(VALGRIND_EXE)
   string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" NEW_VALGRIND_VERSION "${VALGRIND_VERSION}")
   if(NEW_VALGRIND_VERSION)
     message(STATUS "Valgrind version: ${NEW_VALGRIND_VERSION}")
-    execute_process(COMMAND "${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/generate_memcheck_tests.pl ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/tools/cmake/Tests.cmake > ${CMAKE_HOME_DIRECTORY}/tools/cmake/memcheck_tests.cmake")
+    execute_process(COMMAND ${CMAKE_HOME_DIRECTORY}/tools/cmake/scripts/generate_memcheck_tests.pl ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/tools/cmake/Tests.cmake OUTPUT_FILE ${CMAKE_BINARY_DIR}/memcheck_tests.cmake)
     set(MEMORYCHECK_COMMAND_OPTIONS "--trace-children=yes --trace-children-skip=/usr/bin/*,/bin/* --leak-check=full --show-reachable=yes --track-origins=no --read-var-info=no --num-callers=20 --suppressions=${CMAKE_HOME_DIRECTORY}/tools/simgrid.supp ${VALGRIND_EXTRA_COMMAND_OPTIONS} ")
     message(STATUS "Valgrind options: ${MEMORYCHECK_COMMAND_OPTIONS}")
   else()
index 238503e..4f776c8 100644 (file)
@@ -175,5 +175,5 @@ ADD_TEST(testall                                 ${CMAKE_BINARY_DIR}/testall)
 
 IF(enable_memcheck)
   INCLUDE(FindValgrind)
-  INCLUDE(${CMAKE_HOME_DIRECTORY}/tools/cmake/memcheck_tests.cmake)
+  INCLUDE(${CMAKE_BINARY_DIR}/memcheck_tests.cmake)
 ENDIF()