Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix the translation of privatisation section in Process::read_bytes()
[simgrid.git] / src / mc / mc_process.h
index c21e951..d26ca5b 100644 (file)
@@ -10,6 +10,8 @@
 #include <stdbool.h>
 #include <sys/types.h>
 
+#include <vector>
+
 #include "simgrid_config.h"
 #include <sys/types.h>
 
@@ -47,6 +49,11 @@ typedef struct s_mc_smx_process_info s_mc_smx_process_info_t, *mc_smx_process_in
 namespace simgrid {
 namespace mc {
 
+struct IgnoredRegion {
+  std::uint64_t addr;
+  size_t size;
+};
+
 /** Representation of a process
  */
 class Process : public AddressSpace {
@@ -64,6 +71,14 @@ public:
     remote_ptr<void> address, int process_index = ProcessIndexAny,
     ReadMode mode = Normal) const override;
   void read_variable(const char* name, void* target, size_t size) const;
+  template<class T>
+  T read_variable(const char *name) const
+  {
+    static_assert(std::is_trivial<T>::value, "Cannot read a non-trivial type");
+    T res;
+    read_variable(name, &res, sizeof(T));
+    return res;
+  }
   char* read_string(remote_ptr<void> address) const;
 
   // Write memory:
@@ -91,13 +106,22 @@ public:
     return this->heap_info;
   }
 
+  std::vector<IgnoredRegion> const& ignored_regions() const
+  {
+    return ignored_regions_;
+  }
+  void ignore_region(std::uint64_t address, std::size_t size);
+
+  pid_t pid() const { return pid_; }
+
 private:
   void init_memory_map_info();
   void refresh_heap();
   void refresh_malloc_info();
-public: // to be private
+private:
   mc_process_flags_t process_flags;
-  pid_t pid;
+  pid_t pid_;
+public: // to be private
   int socket;
   int status;
   bool running;
@@ -164,7 +188,8 @@ public: // to be private
    */
   void* unw_underlying_context;
 
-  xbt_dynar_t checkpoint_ignore;
+private:
+  std::vector<IgnoredRegion> ignored_regions_;
 };
 
 /** Open a FD to a remote process memory (`/dev/$pid/mem`)
@@ -176,11 +201,6 @@ int open_vm(pid_t pid, int flags);
 
 SG_BEGIN_DECL()
 
-XBT_INTERNAL const void* MC_process_read_dynar_element(mc_process_t process,
-  void* local, const void* remote_dynar, size_t i, size_t len);
-XBT_INTERNAL unsigned long MC_process_read_dynar_length(mc_process_t process,
-  const void* remote_dynar);
-
 XBT_INTERNAL void MC_invalidate_cache(void);
 
 SG_END_DECL()