Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc: const seems wrong here.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 11 Jul 2019 14:44:13 +0000 (16:44 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 11 Jul 2019 14:44:13 +0000 (16:44 +0200)
src/mc/compare.cpp
src/mc/remote/RemoteClient.cpp
src/mc/remote/RemoteClient.hpp
src/mc/sosp/Region.cpp
src/mc/sosp/Region.hpp
src/mc/sosp/Snapshot.cpp
src/mc/sosp/Snapshot.hpp

index b913fae..d5fd2eb 100644 (file)
@@ -1284,10 +1284,12 @@ bool snapshot_equal(Snapshot* s1, Snapshot* s2)
   }
 
   /* Init heap information used in heap comparison algorithm */
-  xbt_mheap_t heap1 = (xbt_mheap_t)s1->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
-                                                  remote(process.heap_address), simgrid::mc::ReadOptions::lazy());
-  xbt_mheap_t heap2 = (xbt_mheap_t)s2->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
-                                                  remote(process.heap_address), simgrid::mc::ReadOptions::lazy());
+  xbt_mheap_t heap1 =
+      static_cast<xbt_mheap_t>(s1->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
+                                              remote(process.heap_address), simgrid::mc::ReadOptions::lazy()));
+  xbt_mheap_t heap2 =
+      static_cast<xbt_mheap_t>(s2->read_bytes(alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
+                                              remote(process.heap_address), simgrid::mc::ReadOptions::lazy()));
   if (state_comparator.initHeapInformation(heap1, heap2, &s1->to_ignore_, &s2->to_ignore_) == -1) {
     XBT_VERB("(%d - %d) Different heap information", s1->num_state_, s2->num_state_);
     return false;
index 4412b4f..b90b22f 100644 (file)
@@ -425,8 +425,7 @@ std::string RemoteClient::read_string(RemotePtr<char> address) const
   }
 }
 
-const void* RemoteClient::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
-                                     ReadOptions /*options*/) const
+void* RemoteClient::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_);
index b786aea..174517d 100644 (file)
@@ -80,8 +80,8 @@ public:
   RemoteClient& operator=(RemoteClient&&) = delete;
 
   // Read memory:
-  const void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
-                         ReadOptions options = ReadOptions::none()) const override;
+  void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
+                   ReadOptions options = ReadOptions::none()) const override;
 
   void read_variable(const char* name, void* target, size_t size) const;
   template <class T> void read_variable(const char* name, T* target) const
index 4eb5d6f..8c27e7c 100644 (file)
@@ -55,7 +55,7 @@ static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgr
   return (char*)snapshot_page + offset;
 }
 
-const void* Region::read(void* target, const void* addr, std::size_t size)
+void* Region::read(void* target, const void* addr, std::size_t size)
 {
   xbt_assert(contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary.");
 
index 2ee7e52..8293df6 100644 (file)
@@ -69,7 +69,7 @@ public:
    *  @param size    Size of the data to read in bytes
    *  @return Pointer where the data is located (either target buffer or original location)
    */
-  const void* read(void* target, const void* addr, std::size_t size);
+  void* read(void* target, const void* addr, std::size_t size);
 };
 
 } // namespace mc
index 141d14a..bc32ba6 100644 (file)
@@ -235,11 +235,11 @@ void Snapshot::add_region(RegionType type, ObjectInformation* object_info, void*
   snapshot_regions_.push_back(std::unique_ptr<simgrid::mc::Region>(std::move(region)));
 }
 
-const void* Snapshot::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions options) const
+void* Snapshot::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions options) const
 {
   Region* region = this->get_region((void*)address.address());
   if (region) {
-    const void* res = region->read(buffer, (void*)address.address(), size);
+    void* res = region->read(buffer, (void*)address.address(), size);
     if (buffer == res || options & ReadOptions::lazy())
       return res;
     else {
index a81dfcb..45b00dc 100644 (file)
@@ -63,8 +63,8 @@ public:
   /* Initialization */
 
   /* Regular use */
-  const void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
-                         ReadOptions options = ReadOptions::none()) const override;
+  void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
+                   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);