Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use (const) references with range-based for loops.
[simgrid.git] / src / mc / remote / RemoteClient.cpp
index 6046e09..74ffde1 100644 (file)
@@ -5,10 +5,10 @@
 
 #define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */
 
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
+#include <cassert>
+#include <cerrno>
+#include <cstddef>
+#include <cstdint>
 
 #include <sys/ptrace.h>
 
@@ -105,7 +105,7 @@ static bool is_simgrid_lib(const char* libname)
 
 static bool is_filtered_lib(const char* libname)
 {
-  for (const char* filtered_lib : filtered_libraries)
+  for (const char* const& filtered_lib : filtered_libraries)
     if (strcmp(libname, filtered_lib) == 0)
       return true;
   return false;
@@ -427,7 +427,7 @@ void RemoteClient::read_variable(const char* name, void* target, size_t size) co
   simgrid::mc::Variable* var = this->find_variable(name);
   xbt_assert(var->address, "No simple location for this variable");
   xbt_assert(var->type->full_type, "Partial type for %s, cannot check size", name);
-  xbt_assert((size_t)var->type->full_type->byte_size == size, "Unexpected size for %s (expected %zi, was %zi)", name,
+  xbt_assert((size_t)var->type->full_type->byte_size == size, "Unexpected size for %s (expected %zu, was %zu)", name,
              size, (size_t)var->type->full_type->byte_size);
   this->read_bytes(target, size, remote(var->address));
 }
@@ -673,5 +673,15 @@ void RemoteClient::dumpStack()
   unw_destroy_addr_space(as);
   return;
 }
+
+bool RemoteClient::actor_is_enabled(aid_t pid)
+{
+  s_mc_message_actor_enabled msg{MC_MESSAGE_ACTOR_ENABLED, pid};
+  process()->getChannel().send(msg);
+  char buff[MC_MESSAGE_LENGTH];
+  ssize_t received = process()->getChannel().receive(buff, MC_MESSAGE_LENGTH, true);
+  xbt_assert(received == sizeof(s_mc_message_int), "Unexpected size in answer to ACTOR_ENABLED");
+  return ((mc_message_int_t*)buff)->value;
+}
 }
 }