Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: rename remote/RemoteClient -> remote/RemoteClientMemory and remove networking...
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 6 May 2020 23:21:19 +0000 (01:21 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 6 May 2020 23:21:19 +0000 (01:21 +0200)
24 files changed:
src/mc/AddressSpace.hpp
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/Session.cpp
src/mc/VisitedState.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/compare.cpp
src/mc/inspect/ObjectInformation.hpp
src/mc/inspect/mc_dwarf.cpp
src/mc/inspect/mc_unw.cpp
src/mc/inspect/mc_unw.hpp
src/mc/inspect/mc_unw_vmread.cpp
src/mc/mc_base.cpp
src/mc/mc_forward.hpp
src/mc/mc_smx.cpp
src/mc/mc_smx.hpp
src/mc/remote/RemoteClientMemory.cpp [moved from src/mc/remote/RemoteClient.cpp with 87% similarity]
src/mc/remote/RemoteClientMemory.hpp [moved from src/mc/remote/RemoteClient.hpp with 91% similarity]
src/mc/sosp/Snapshot.cpp
src/mc/sosp/Snapshot.hpp
src/mc/sosp/Snapshot_test.cpp
teshsuite/mc/dwarf-expression/dwarf-expression.cpp
teshsuite/mc/dwarf/dwarf.cpp
tools/cmake/DefinePackages.cmake

index c67ecb8..00be2d0 100644 (file)
@@ -84,17 +84,17 @@ public:
  */
 class AddressSpace {
 private:
-  RemoteClient* process_;
+  RemoteClientMemory* process_;
 
 public:
-  explicit AddressSpace(RemoteClient* process) : process_(process) {}
+  explicit AddressSpace(RemoteClientMemory* process) : process_(process) {}
   virtual ~AddressSpace() = default;
 
   /** The process of this address space
    *
    *  This is where we can get debug informations, memory layout, etc.
    */
-  simgrid::mc::RemoteClient* process() const { return process_; }
+  simgrid::mc::RemoteClientMemory* process() const { return process_; }
 
   /** Read data from the address space
    *
index f1e89a9..d00907c 100644 (file)
@@ -10,7 +10,7 @@
 #include "src/mc/mc_config.hpp"
 #include "src/mc/mc_exit.hpp"
 #include "src/mc/mc_private.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 #include "xbt/automaton.hpp"
 #include "xbt/system_error.hpp"
 
@@ -32,7 +32,7 @@ using simgrid::mc::remote;
 namespace simgrid {
 namespace mc {
 
-ModelChecker::ModelChecker(std::unique_ptr<RemoteClient> process) : process_(std::move(process)) {}
+ModelChecker::ModelChecker(std::unique_ptr<RemoteClientMemory> process) : process_(std::move(process)) {}
 
 void ModelChecker::start()
 {
@@ -77,7 +77,7 @@ static const std::pair<const char*, const char*> ignored_local_variables[] = {
 
 void ModelChecker::setup_ignore()
 {
-  RemoteClient& process = this->process();
+  RemoteClientMemory& process = this->process();
   for (std::pair<const char*, const char*> const& var :
       ignored_local_variables)
     process.ignore_local_variable(var.first, var.second);
@@ -90,7 +90,7 @@ void ModelChecker::shutdown()
 {
   XBT_DEBUG("Shuting down model-checker");
 
-  RemoteClient* process = &this->process();
+  RemoteClientMemory* process = &this->process();
   if (process->running()) {
     XBT_DEBUG("Killing process");
     kill(process->pid(), SIGKILL);
@@ -98,7 +98,7 @@ void ModelChecker::shutdown()
   }
 }
 
-void ModelChecker::resume(RemoteClient& process)
+void ModelChecker::resume(RemoteClientMemory& process)
 {
   int res = process.get_channel().send(MC_MESSAGE_CONTINUE);
   if (res)
@@ -202,7 +202,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size)
     if (property_automaton == nullptr)
       property_automaton = xbt_automaton_new();
 
-    RemoteClient* process  = &this->process();
+    RemoteClientMemory* process = &this->process();
     RemotePtr<int> address = remote((int*)message.data);
     xbt::add_proposition(property_automaton, message.name, [process, address]() { return process->read(address); });
 
index e9741ec..4e75bf5 100644 (file)
@@ -25,15 +25,15 @@ class ModelChecker {
   std::set<std::string> hostnames_;
   // This is the parent snapshot of the current state:
   PageStore page_store_{500};
-  std::unique_ptr<RemoteClient> process_;
+  std::unique_ptr<RemoteClientMemory> process_;
   Checker* checker_ = nullptr;
 
 public:
   ModelChecker(ModelChecker const&) = delete;
   ModelChecker& operator=(ModelChecker const&) = delete;
-  explicit ModelChecker(std::unique_ptr<RemoteClient> process);
+  explicit ModelChecker(std::unique_ptr<RemoteClientMemory> process);
 
-  RemoteClient& process() { return *process_; }
+  RemoteClientMemory& process() { return *process_; }
   PageStore& page_store()
   {
     return page_store_;
@@ -46,7 +46,7 @@ public:
 
   void start();
   void shutdown();
-  void resume(simgrid::mc::RemoteClient& process);
+  void resume(simgrid::mc::RemoteClientMemory& process);
   void handle_events(int fd, short events);
   void wait_for_requests();
   void handle_simcall(Transition const& transition);
index 162dfc0..542f73c 100644 (file)
@@ -85,7 +85,7 @@ Session::Session(const std::function<void()>& code)
 
   xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?");
 
-  auto process = std::unique_ptr<simgrid::mc::RemoteClient>(new simgrid::mc::RemoteClient(pid, sockets[1]));
+  auto process = std::unique_ptr<simgrid::mc::RemoteClientMemory>(new simgrid::mc::RemoteClientMemory(pid, sockets[1]));
   model_checker_.reset(new simgrid::mc::ModelChecker(std::move(process)));
 
   mc_model_checker = model_checker_.get();
index e491e7c..b586034 100644 (file)
@@ -19,7 +19,7 @@ namespace mc {
 /** @brief Save the current state */
 VisitedState::VisitedState(unsigned long state_number) : num(state_number)
 {
-  simgrid::mc::RemoteClient* process = &(mc_model_checker->process());
+  simgrid::mc::RemoteClientMemory* process = &(mc_model_checker->process());
   this->heap_bytes_used = mmalloc_get_bytes_used_remote(
     process->get_heap()->heaplimit,
     process->get_malloc_info());
index 6a439c0..0afe206 100644 (file)
@@ -26,7 +26,7 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
                          std::shared_ptr<State> graph_state)
     : num(pair_num), automaton_state(automaton_state)
 {
-  RemoteClient* process = &(mc_model_checker->process());
+  RemoteClientMemory* process = &(mc_model_checker->process());
 
   this->graph_state = std::move(graph_state);
   if (this->graph_state->system_state_ == nullptr)
index c9a2579..1c0d462 100644 (file)
@@ -220,7 +220,7 @@ static bool heap_area_differ(StateComparator& state, const void* area1, const vo
 
 static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot1, const Snapshot& snapshot2)
 {
-  const RemoteClient& process = mc_model_checker->process();
+  const RemoteClientMemory& process = mc_model_checker->process();
 
   /* Check busy blocks */
   size_t i1 = 1;
@@ -448,7 +448,7 @@ static bool heap_area_differ_without_type(StateComparator& state, const void* re
                                           const Snapshot& snapshot1, const Snapshot& snapshot2,
                                           HeapLocationPairs* previous, int size, int check_ignore)
 {
-  const RemoteClient& process = mc_model_checker->process();
+  const RemoteClientMemory& process = mc_model_checker->process();
   const Region* heap_region1  = MC_get_heap_region(snapshot1);
   const Region* heap_region2  = MC_get_heap_region(snapshot2);
 
@@ -734,7 +734,7 @@ static Type* get_offset_type(void* real_base_address, Type* type, int offset, in
 static bool heap_area_differ(StateComparator& state, const void* area1, const void* area2, const Snapshot& snapshot1,
                              const Snapshot& snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level)
 {
-  const simgrid::mc::RemoteClient& process = mc_model_checker->process();
+  const simgrid::mc::RemoteClientMemory& process = mc_model_checker->process();
 
   ssize_t block1;
   ssize_t block2;
@@ -1202,7 +1202,7 @@ bool snapshot_equal(const Snapshot* s1, const Snapshot* s2)
   // TODO, make this a field of ModelChecker or something similar
   static StateComparator state_comparator;
 
-  const RemoteClient& process = mc_model_checker->process();
+  const RemoteClientMemory& process = mc_model_checker->process();
 
   if (s1->hash_ != s2->hash_) {
     XBT_VERB("(%d - %d) Different hash: 0x%" PRIx64 "--0x%" PRIx64, s1->num_state_, s2->num_state_, s1->hash_,
index 7f4ea9f..93fe918 100644 (file)
@@ -157,7 +157,7 @@ XBT_PRIVATE std::shared_ptr<ObjectInformation> createObjectInformation(std::vect
                                                                        const char* name);
 
 /** Augment the current module with informations about the other ones */
-XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteClient* process,
+XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteClientMemory* process,
                                               simgrid::mc::ObjectInformation* info);
 } // namespace mc
 } // namespace simgrid
index eb5f346..814449b 100644 (file)
@@ -13,7 +13,7 @@
 #include "src/mc/inspect/Variable.hpp"
 #include "src/mc/inspect/mc_dwarf.hpp"
 #include "src/mc/mc_private.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include <cinttypes>
 #include <cstdint>
@@ -1207,7 +1207,7 @@ std::shared_ptr<ObjectInformation> createObjectInformation(std::vector<xbt::VmMa
 
 /*************************************************************************/
 
-void postProcessObjectInformation(const RemoteClient* process, ObjectInformation* info)
+void postProcessObjectInformation(const RemoteClientMemory* process, ObjectInformation* info)
 {
   for (auto& t : info->types) {
     Type* type    = &(t.second);
index a51a8fb..f2403ec 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "src/mc/inspect/mc_unw.hpp"
 #include "src/mc/inspect/Frame.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include <cstring>
 
@@ -223,7 +223,7 @@ unw_addr_space_t UnwindContext::createUnwindAddressSpace()
   return unw_create_addr_space(&UnwindContext::accessors, BYTE_ORDER);
 }
 
-void UnwindContext::initialize(simgrid::mc::RemoteClient* process, unw_context_t* c)
+void UnwindContext::initialize(simgrid::mc::RemoteClientMemory* process, unw_context_t* c)
 {
   this->address_space_ = process;
   this->process_      = process;
index beb19d6..2f0bd18 100644 (file)
@@ -44,11 +44,11 @@ namespace mc {
 
 class UnwindContext {
   simgrid::mc::AddressSpace* address_space_ = nullptr;
-  simgrid::mc::RemoteClient* process_      = nullptr;
+  simgrid::mc::RemoteClientMemory* process_ = nullptr;
   unw_context_t unwind_context_;
 
 public:
-  void initialize(simgrid::mc::RemoteClient* process, unw_context_t* c);
+  void initialize(simgrid::mc::RemoteClientMemory* process, unw_context_t* c);
   unw_cursor_t cursor();
 
 private: // Methods and virtual table for libunwind
index 9601c0e..83048b3 100644 (file)
@@ -4,7 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/mc/inspect/mc_unw.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include <sys/types.h>
 #include <sys/uio.h>
index edb32c3..2d7942e 100644 (file)
@@ -16,7 +16,7 @@
 #if SIMGRID_HAVE_MC
 #include "src/mc/ModelChecker.hpp"
 #include "src/mc/Session.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 using simgrid::mc::remote;
 #endif
index 9264a37..680e3e3 100644 (file)
@@ -18,7 +18,7 @@ class PageStore;
 class ChunkedData;
 class ModelChecker;
 class AddressSpace;
-class RemoteClient;
+class RemoteClientMemory;
 class Snapshot;
 class ObjectInformation;
 class Member;
index f72a03b..f86501d 100644 (file)
@@ -31,7 +31,7 @@ static inline simgrid::mc::ActorInformation* actor_info_cast(smx_actor_t actor)
  *  @param target       Local vector (to be filled with copies of `s_smx_actor_t`)
  *  @param remote_dynar Address of the process dynar in the remote list
  */
-static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteClient* process,
+static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteClientMemory* process,
                                                  std::vector<simgrid::mc::ActorInformation>& target,
                                                  simgrid::mc::RemotePtr<s_xbt_dynar_t> remote_dynar)
 {
@@ -57,9 +57,9 @@ static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteClient
 namespace simgrid {
 namespace mc {
 
-void RemoteClient::refresh_simix()
+void RemoteClientMemory::refresh_simix()
 {
-  if (this->cache_flags_ & RemoteClient::cache_simix_processes)
+  if (this->cache_flags_ & RemoteClientMemory::cache_simix_processes)
     return;
 
   // TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global`
@@ -81,7 +81,7 @@ void RemoteClient::refresh_simix()
   MC_process_refresh_simix_actor_dynar(this, this->smx_dead_actors_infos,
                                        remote(simix_global.get_buffer()->dead_actors_vector));
 
-  this->cache_flags_ |= RemoteClient::cache_simix_processes;
+  this->cache_flags_ |= RemoteClientMemory::cache_simix_processes;
 }
 
 }
@@ -119,7 +119,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor)
   if (mc_model_checker == nullptr)
     return actor->get_host()->get_cname();
 
-  const simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClientMemory* process = &mc_model_checker->process();
 
   // Read the simgrid::xbt::string in the MCed process:
   simgrid::mc::ActorInformation* info     = actor_info_cast(actor);
@@ -134,7 +134,7 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor)
 
 const char* MC_smx_actor_get_name(smx_actor_t actor)
 {
-  const simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClientMemory* process = &mc_model_checker->process();
   if (mc_model_checker == nullptr)
     return actor->get_cname();
 
index 69049df..2fd8146 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_MC_SMX_HPP
 #define SIMGRID_MC_SMX_HPP
 
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 /** @file
  *  @brief (Cross-process, MCer/MCed) Access to SMX structures
similarity index 87%
rename from src/mc/remote/RemoteClient.cpp
rename to src/mc/remote/RemoteClientMemory.cpp
index 25bd083..e577795 100644 (file)
@@ -5,7 +5,7 @@
 
 #define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */
 
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include "src/mc/mc_smx.hpp"
 #include "src/mc/sosp/Snapshot.hpp"
@@ -109,8 +109,7 @@ static const std::vector<std::string> filtered_libraries = {
     "libsasl2",
     "libresolv",
     "libcrypt",
-    "libselinux"
-};
+    "libselinux"};
 
 static bool is_simgrid_lib(const std::string& libname)
 {
@@ -211,11 +210,12 @@ int open_vm(pid_t pid, int flags)
 
 // ***** Process
 
-RemoteClient::RemoteClient(pid_t pid, int sockfd) : AddressSpace(this), pid_(pid), channel_(sockfd), running_(true)
+RemoteClientMemory::RemoteClientMemory(pid_t pid, int sockfd)
+    : AddressSpace(this), pid_(pid), channel_(sockfd), running_(true)
 {
 }
 
-void RemoteClient::init()
+void RemoteClientMemory::init()
 {
   this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_);
   this->init_memory_map_info();
@@ -237,7 +237,7 @@ void RemoteClient::init()
   this->unw_underlying_context    = simgrid::unw::create_context(this->unw_underlying_addr_space, this->pid_);
 }
 
-RemoteClient::~RemoteClient()
+RemoteClientMemory::~RemoteClientMemory()
 {
   if (this->memory_file >= 0)
     close(this->memory_file);
@@ -257,13 +257,13 @@ RemoteClient::~RemoteClient()
  *  Do not use directly, this is used by the getters when appropriate
  *  in order to have fresh data.
  */
-void RemoteClient::refresh_heap()
+void RemoteClientMemory::refresh_heap()
 {
   // Read/dereference/refresh the std_heap pointer:
   if (not this->heap)
     this->heap.reset(new s_xbt_mheap_t());
   this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address));
-  this->cache_flags_ |= RemoteClient::cache_heap;
+  this->cache_flags_ |= RemoteClientMemory::cache_heap;
 }
 
 /** Refresh the information about the process
@@ -271,20 +271,20 @@ void RemoteClient::refresh_heap()
  *  Do not use directly, this is used by the getters when appropriate
  *  in order to have fresh data.
  * */
-void RemoteClient::refresh_malloc_info()
+void RemoteClientMemory::refresh_malloc_info()
 {
   // Refresh process->heapinfo:
-  if (this->cache_flags_ & RemoteClient::cache_malloc)
+  if (this->cache_flags_ & RemoteClientMemory::cache_malloc)
     return;
   size_t count = this->heap->heaplimit + 1;
   if (this->heap_info.size() < count)
     this->heap_info.resize(count);
   this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info), remote(this->heap->heapinfo));
-  this->cache_flags_ |= RemoteClient::cache_malloc;
+  this->cache_flags_ |= RemoteClientMemory::cache_malloc;
 }
 
 /** @brief Finds the range of the different memory segments and binary paths */
-void RemoteClient::init_memory_map_info()
+void RemoteClientMemory::init_memory_map_info()
 {
   XBT_DEBUG("Get debug information ...");
   this->maestro_stack_start_ = nullptr;
@@ -354,7 +354,7 @@ void RemoteClient::init_memory_map_info()
   XBT_DEBUG("Get debug information done !");
 }
 
-std::shared_ptr<simgrid::mc::ObjectInformation> RemoteClient::find_object_info(RemotePtr<void> addr) const
+std::shared_ptr<simgrid::mc::ObjectInformation> RemoteClientMemory::find_object_info(RemotePtr<void> addr) const
 {
   for (auto const& object_info : this->object_infos)
     if (addr.address() >= (std::uint64_t)object_info->start && addr.address() <= (std::uint64_t)object_info->end)
@@ -362,7 +362,7 @@ std::shared_ptr<simgrid::mc::ObjectInformation> RemoteClient::find_object_info(R
   return nullptr;
 }
 
-std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_exec(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteClientMemory::find_object_info_exec(RemotePtr<void> addr) const
 {
   for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
     if (addr.address() >= (std::uint64_t)info->start_exec && addr.address() <= (std::uint64_t)info->end_exec)
@@ -370,7 +370,7 @@ std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_exec(RemotePtr
   return nullptr;
 }
 
-std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_rw(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteClientMemory::find_object_info_rw(RemotePtr<void> addr) const
 {
   for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
     if (addr.address() >= (std::uint64_t)info->start_rw && addr.address() <= (std::uint64_t)info->end_rw)
@@ -378,7 +378,7 @@ std::shared_ptr<ObjectInformation> RemoteClient::find_object_info_rw(RemotePtr<v
   return nullptr;
 }
 
-simgrid::mc::Frame* RemoteClient::find_function(RemotePtr<void> ip) const
+simgrid::mc::Frame* RemoteClientMemory::find_function(RemotePtr<void> ip) const
 {
   std::shared_ptr<simgrid::mc::ObjectInformation> info = this->find_object_info_exec(ip);
   return info ? info->find_function((void*)ip.address()) : nullptr;
@@ -386,7 +386,7 @@ simgrid::mc::Frame* RemoteClient::find_function(RemotePtr<void> ip) const
 
 /** Find (one occurrence of) the named variable definition
  */
-const simgrid::mc::Variable* RemoteClient::find_variable(const char* name) const
+const simgrid::mc::Variable* RemoteClientMemory::find_variable(const char* name) const
 {
   // First lookup the variable in the executable shared object.
   // A global variable used directly by the executable code from a library
@@ -408,7 +408,7 @@ const simgrid::mc::Variable* RemoteClient::find_variable(const char* name) const
   return nullptr;
 }
 
-void RemoteClient::read_variable(const char* name, void* target, size_t size) const
+void RemoteClientMemory::read_variable(const char* name, void* target, size_t size) const
 {
   const simgrid::mc::Variable* var = this->find_variable(name);
   xbt_assert(var, "Variable %s not found", name);
@@ -419,7 +419,7 @@ void RemoteClient::read_variable(const char* name, void* target, size_t size) co
   this->read_bytes(target, size, remote(var->address));
 }
 
-std::string RemoteClient::read_string(RemotePtr<char> address) const
+std::string RemoteClientMemory::read_string(RemotePtr<char> address) const
 {
   if (not address)
     return {};
@@ -443,7 +443,8 @@ std::string RemoteClient::read_string(RemotePtr<char> address) const
   }
 }
 
-void* RemoteClient::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions /*options*/) const
+void* RemoteClientMemory::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
+                                     ReadOptions /*options*/) const
 {
   if (pread_whole(this->memory_file, buffer, size, (size_t)address.address()) < 0)
     xbt_die("Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_);
@@ -456,13 +457,13 @@ void* RemoteClient::read_bytes(void* buffer, std::size_t size, RemotePtr<void> a
  *  @param len      data size
  *  @param address  target process memory address (target)
  */
-void RemoteClient::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
+void RemoteClientMemory::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
 {
   if (pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) < 0)
     xbt_die("Write to process %lli failed", (long long)this->pid_);
 }
 
-void RemoteClient::clear_bytes(RemotePtr<void> address, size_t len)
+void RemoteClientMemory::clear_bytes(RemotePtr<void> address, size_t len)
 {
   pthread_once(&zero_buffer_flag, zero_buffer_init);
   while (len) {
@@ -473,7 +474,7 @@ void RemoteClient::clear_bytes(RemotePtr<void> address, size_t len)
   }
 }
 
-void RemoteClient::ignore_region(std::uint64_t addr, std::size_t size)
+void RemoteClientMemory::ignore_region(std::uint64_t addr, std::size_t size)
 {
   IgnoredRegion region;
   region.addr = addr;
@@ -484,7 +485,7 @@ void RemoteClient::ignore_region(std::uint64_t addr, std::size_t size)
     return;
   }
 
-  unsigned int cursor           = 0;
+  unsigned int cursor                 = 0;
   const IgnoredRegion* current_region = nullptr;
 
   int start = 0;
@@ -518,7 +519,7 @@ void RemoteClient::ignore_region(std::uint64_t addr, std::size_t size)
   ignored_regions_.insert(ignored_regions_.begin() + position, region);
 }
 
-void RemoteClient::ignore_heap(IgnoredHeapRegion const& region)
+void RemoteClientMemory::ignore_heap(IgnoredHeapRegion const& region)
 {
   if (ignored_heap_.empty()) {
     ignored_heap_.push_back(std::move(region));
@@ -533,7 +534,7 @@ void RemoteClient::ignore_heap(IgnoredHeapRegion const& region)
   // Binary search the position of insertion:
   size_type cursor;
   while (start <= end) {
-    cursor               = start + (end - start) / 2;
+    cursor                     = start + (end - start) / 2;
     auto const& current_region = ignored_heap_[cursor];
     if (current_region.address == region.address)
       return;
@@ -552,7 +553,7 @@ void RemoteClient::ignore_heap(IgnoredHeapRegion const& region)
   ignored_heap_.insert(ignored_heap_.begin() + cursor, region);
 }
 
-void RemoteClient::unignore_heap(void* address, size_t size)
+void RemoteClientMemory::unignore_heap(void* address, size_t size)
 {
   typedef std::vector<IgnoredHeapRegion>::size_type size_type;
 
@@ -562,7 +563,7 @@ void RemoteClient::unignore_heap(void* address, size_t size)
   // Binary search:
   size_type cursor;
   while (start <= end) {
-    cursor       = (start + end) / 2;
+    cursor             = (start + end) / 2;
     auto const& region = ignored_heap_[cursor];
     if (region.address < address)
       start = cursor + 1;
@@ -577,7 +578,7 @@ void RemoteClient::unignore_heap(void* address, size_t size)
   }
 }
 
-void RemoteClient::ignore_local_variable(const char* var_name, const char* frame_name)
+void RemoteClientMemory::ignore_local_variable(const char* var_name, const char* frame_name)
 {
   if (frame_name != nullptr && strcmp(frame_name, "*") == 0)
     frame_name = nullptr;
@@ -585,19 +586,19 @@ void RemoteClient::ignore_local_variable(const char* var_name, const char* frame
     info->remove_local_variable(var_name, frame_name);
 }
 
-std::vector<simgrid::mc::ActorInformation>& RemoteClient::actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteClientMemory::actors()
 {
   this->refresh_simix();
   return smx_actors_infos;
 }
 
-std::vector<simgrid::mc::ActorInformation>& RemoteClient::dead_actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteClientMemory::dead_actors()
 {
   this->refresh_simix();
   return smx_dead_actors_infos;
 }
 
-void RemoteClient::dump_stack()
+void RemoteClientMemory::dump_stack()
 {
   unw_addr_space_t as = unw_create_addr_space(&_UPT_accessors, BYTE_ORDER);
   if (as == nullptr) {
@@ -625,5 +626,5 @@ void RemoteClient::dump_stack()
   _UPT_destroy(context);
   unw_destroy_addr_space(as);
 }
-}
-}
+} // namespace mc
+} // namespace simgrid
similarity index 91%
rename from src/mc/remote/RemoteClient.hpp
rename to src/mc/remote/RemoteClientMemory.hpp
index 829d0ee..2ba817d 100644 (file)
@@ -49,7 +49,7 @@ struct IgnoredHeapRegion {
   std::size_t size;
 };
 
-/** The Model-Checked process, seen from the MCer perspective
+/** The Application's process memory, seen from the MCer perspective
  *
  *  This class is mixing a lot of different responsibilities and is tied
  *  to SIMIX. It should probably be split into different classes.
@@ -60,11 +60,10 @@ struct IgnoredHeapRegion {
  *  - accessing the system state of the process (heap, …);
  *  - storing the SIMIX state of the process;
  *  - privatization;
- *  - communication with the model-checked process;
  *  - stack unwinding;
  *  - etc.
  */
-class RemoteClient final : public AddressSpace {
+class RemoteClientMemory final : public AddressSpace {
 private:
   // Those flags are used to track down which cached information
   // is still up to date and which information needs to be updated.
@@ -74,14 +73,14 @@ private:
   static constexpr int cache_simix_processes = 4;
 
 public:
-  RemoteClient(pid_t pid, int sockfd);
-  ~RemoteClient();
+  RemoteClientMemory(pid_t pid, int sockfd);
+  ~RemoteClientMemory();
   void init();
 
-  RemoteClient(RemoteClient const&) = delete;
-  RemoteClient(RemoteClient&&)      = delete;
-  RemoteClient& operator=(RemoteClient const&) = delete;
-  RemoteClient& operator=(RemoteClient&&) = delete;
+  RemoteClientMemory(RemoteClientMemory const&) = delete;
+  RemoteClientMemory(RemoteClientMemory&&)      = delete;
+  RemoteClientMemory& operator=(RemoteClientMemory const&) = delete;
+  RemoteClientMemory& operator=(RemoteClientMemory&&) = delete;
 
   // Read memory:
   void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
@@ -116,18 +115,18 @@ public:
   // Heap access:
   xbt_mheap_t get_heap()
   {
-    if (not(this->cache_flags_ & RemoteClient::cache_heap))
+    if (not(this->cache_flags_ & RemoteClientMemory::cache_heap))
       this->refresh_heap();
     return this->heap.get();
   }
   const malloc_info* get_malloc_info()
   {
-    if (not(this->cache_flags_ & RemoteClient::cache_malloc))
+    if (not(this->cache_flags_ & RemoteClientMemory::cache_malloc))
       this->refresh_malloc_info();
     return this->heap_info.data();
   }
 
-  void clear_cache() { this->cache_flags_ = RemoteClient::cache_none; }
+  void clear_cache() { this->cache_flags_ = RemoteClientMemory::cache_none; }
 
   Channel const& get_channel() const { return channel_; }
   Channel& get_channel() { return channel_; }
@@ -230,7 +229,7 @@ public:
 
 private:
   /** State of the cache (which variables are up to date) */
-  int cache_flags_ = RemoteClient::cache_none;
+  int cache_flags_ = RemoteClientMemory::cache_none;
 
 public:
   /** Address of the heap structure in the MCed process. */
@@ -274,8 +273,7 @@ public:
   void* unw_underlying_context;
 };
 
-/** Open a FD to a remote process memory (`/dev/$pid/mem`)
- */
+/** Open a FD to a remote process memory (`/dev/$pid/mem`) */
 XBT_PRIVATE int open_vm(pid_t pid, int flags);
 } // namespace mc
 } // namespace simgrid
index 4cad251..62bc70d 100644 (file)
@@ -16,7 +16,7 @@ namespace mc {
 /************************************* Take Snapshot ************************************/
 /****************************************************************************************/
 
-void Snapshot::snapshot_regions(RemoteClient* process)
+void Snapshot::snapshot_regions(RemoteClientMemory* process)
 {
   snapshot_regions_.clear();
 
@@ -97,7 +97,7 @@ static std::vector<s_local_variable_t> get_local_variables_values(std::vector<s_
 
 static std::vector<s_mc_stack_frame_t> unwind_stack_frames(UnwindContext* stack_context)
 {
-  const RemoteClient* process = &mc_model_checker->process();
+  const RemoteClientMemory* process = &mc_model_checker->process();
   std::vector<s_mc_stack_frame_t> result;
 
   unw_cursor_t c = stack_context->cursor();
@@ -149,7 +149,7 @@ static std::vector<s_mc_stack_frame_t> unwind_stack_frames(UnwindContext* stack_
   return result;
 }
 
-void Snapshot::snapshot_stacks(RemoteClient* process)
+void Snapshot::snapshot_stacks(RemoteClientMemory* process)
 {
   for (auto const& stack : process->stack_areas()) {
     s_mc_snapshot_stack_t st;
@@ -197,7 +197,7 @@ static void snapshot_ignore_restore(const simgrid::mc::Snapshot* snapshot)
     snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
 }
 
-Snapshot::Snapshot(int num_state, RemoteClient* process) : AddressSpace(process), num_state_(num_state)
+Snapshot::Snapshot(int num_state, RemoteClientMemory* process) : AddressSpace(process), num_state_(num_state)
 {
   XBT_DEBUG("Taking snapshot %i", num_state);
 
@@ -272,7 +272,7 @@ Region* Snapshot::get_region(const void* addr, Region* hinted_region) const
     return get_region(addr);
 }
 
-void Snapshot::restore(RemoteClient* process)
+void Snapshot::restore(RemoteClientMemory* process)
 {
   XBT_DEBUG("Restore snapshot %i", num_state_);
 
index 233297d..a6a099b 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "src/mc/ModelChecker.hpp"
 #include "src/mc/inspect/mc_unw.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 #include "src/mc/sosp/Region.hpp"
 
 // ***** MC Snapshot
@@ -60,7 +60,7 @@ namespace mc {
 class XBT_PRIVATE Snapshot final : public AddressSpace {
 public:
   /* Initialization */
-  Snapshot(int num_state, RemoteClient* process = &mc_model_checker->process());
+  Snapshot(int num_state, RemoteClientMemory* process = &mc_model_checker->process());
   ~Snapshot() = default;
 
   /* Regular use */
@@ -74,7 +74,7 @@ public:
                    ReadOptions options = ReadOptions::none()) const override;
   Region* get_region(const void* addr) const;
   Region* get_region(const void* addr, Region* hinted_region) const;
-  void restore(RemoteClient* process);
+  void restore(RemoteClientMemory* process);
 
   // To be private
   int num_state_;
@@ -89,8 +89,8 @@ public:
 
 private:
   void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size);
-  void snapshot_regions(RemoteClient* process);
-  void snapshot_stacks(RemoteClient* process);
+  void snapshot_regions(RemoteClientMemory* process);
+  void snapshot_stacks(RemoteClientMemory* process);
 };
 } // namespace mc
 } // namespace simgrid
index f78365f..5ccd63e 100644 (file)
@@ -37,11 +37,11 @@ public:
     mc_model_checker = nullptr;
   }
 
-  static std::unique_ptr<simgrid::mc::RemoteClient> process;
+  static std::unique_ptr<simgrid::mc::RemoteClientMemory> process;
 };
 
 // static member variables init.
-std::unique_ptr<simgrid::mc::RemoteClient> snap_test_helper::process = nullptr;
+std::unique_ptr<simgrid::mc::RemoteClientMemory> snap_test_helper::process = nullptr;
 
 void snap_test_helper::init_memory(void* mem, size_t size)
 {
@@ -56,7 +56,7 @@ void snap_test_helper::Init()
   REQUIRE(xbt_pagesize == getpagesize());
   REQUIRE(1 << xbt_pagebits == xbt_pagesize);
 
-  process.reset(new simgrid::mc::RemoteClient(getpid(), -1));
+  process.reset(new simgrid::mc::RemoteClientMemory(getpid(), -1));
   process->init();
   mc_model_checker = new ::simgrid::mc::ModelChecker(std::move(process));
 }
index 65ec3f4..941aa71 100644 (file)
@@ -12,7 +12,7 @@
 #include "src/mc/inspect/ObjectInformation.hpp"
 #include "src/mc/inspect/Type.hpp"
 #include "src/mc/inspect/Variable.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include <cassert>
 #include <cstdlib>
@@ -21,7 +21,7 @@
 
 static std::default_random_engine rnd_engine;
 
-static simgrid::mc::RemoteClient* process;
+static simgrid::mc::RemoteClientMemory* process;
 
 static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext const& state, int op, uintptr_t a, uintptr_t b)
 {
@@ -145,7 +145,7 @@ static void test_deref(simgrid::dwarf::ExpressionContext const& state)
 
 int main()
 {
-  process = new simgrid::mc::RemoteClient(getpid(), -1);
+  process = new simgrid::mc::RemoteClientMemory(getpid(), -1);
   process->init();
 
   simgrid::dwarf::ExpressionContext state;
index 12f9031..fae099a 100644 (file)
@@ -15,7 +15,7 @@
 #include "src/mc/inspect/ObjectInformation.hpp"
 #include "src/mc/inspect/Type.hpp"
 #include "src/mc/inspect/Variable.hpp"
-#include "src/mc/remote/RemoteClient.hpp"
+#include "src/mc/remote/RemoteClientMemory.hpp"
 
 #include <cassert>
 #include <cstring>
@@ -72,7 +72,7 @@ static void test_local_variable(simgrid::mc::ObjectInformation* info, const char
   xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function);
 }
 
-static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteClient& process,
+static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteClientMemory& process,
                                                          const simgrid::mc::ObjectInformation* info, const char* name,
                                                          void* address, long byte_size)
 {
@@ -104,7 +104,7 @@ struct s_foo {
   int i;
 };
 
-static void test_type_by_name(const simgrid::mc::RemoteClient& process, s_foo /*my_foo*/)
+static void test_type_by_name(const simgrid::mc::RemoteClientMemory& process, s_foo /*my_foo*/)
 {
   assert(process.binary_info->full_types_by_name.find("struct s_foo") != process.binary_info->full_types_by_name.end());
 }
@@ -116,7 +116,7 @@ int main(int argc, char** argv)
   const simgrid::mc::Variable* var;
   simgrid::mc::Type* type;
 
-  simgrid::mc::RemoteClient process(getpid(), -1);
+  simgrid::mc::RemoteClientMemory process(getpid(), -1);
   process.init();
 
   test_global_variable(process, process.binary_info.get(), "some_local_variable", &some_local_variable, sizeof(int));
index d4a8b9e..00d134e 100644 (file)
@@ -630,8 +630,8 @@ set(MC_SRC
   src/mc/remote/Channel.hpp
   src/mc/remote/CheckerSide.cpp
   src/mc/remote/CheckerSide.hpp
-  src/mc/remote/RemoteClient.hpp
-  src/mc/remote/RemoteClient.cpp
+  src/mc/remote/RemoteClientMemory.hpp
+  src/mc/remote/RemoteClientMemory.cpp
   src/mc/remote/RemotePtr.hpp
   src/mc/remote/mc_protocol.h
   src/mc/remote/mc_protocol.cpp