Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/mc/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 28 Dec 2019 13:11:19 +0000 (14:11 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 28 Dec 2019 20:48:19 +0000 (21:48 +0100)
33 files changed:
src/include/mc/mc.h
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/VisitedState.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/CommunicationDeterminismChecker.hpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/LivenessChecker.hpp
src/mc/checker/SafetyChecker.cpp
src/mc/checker/SafetyChecker.hpp
src/mc/compare.cpp
src/mc/inspect/LocationList.cpp
src/mc/inspect/LocationList.hpp
src/mc/inspect/ObjectInformation.hpp
src/mc/inspect/mc_dwarf.cpp
src/mc/inspect/mc_dwarf.hpp
src/mc/inspect/mc_member.cpp
src/mc/mc_base.cpp
src/mc/mc_base.h
src/mc/mc_comm_pattern.hpp
src/mc/mc_global.cpp
src/mc/mc_record.cpp
src/mc/mc_smx.cpp
src/mc/mc_state.hpp
src/mc/remote/Client.cpp
src/mc/remote/Client.hpp
src/mc/sosp/ChunkedData.cpp
src/mc/sosp/ChunkedData.hpp
src/mc/sosp/PageStore.cpp
src/mc/sosp/PageStore.hpp
src/mc/sosp/Region.cpp
src/mc/sosp/Region.hpp
src/mc/sosp/Snapshot.cpp

index c662db5..90349ab 100644 (file)
@@ -26,8 +26,6 @@ SG_BEGIN_DECL
 
 /********************************* Global *************************************/
 XBT_ATTRIB_NORETURN XBT_PUBLIC void MC_run();
 
 /********************************* Global *************************************/
 XBT_ATTRIB_NORETURN XBT_PUBLIC void MC_run();
-XBT_PUBLIC void MC_process_clock_add(smx_actor_t, double);
-XBT_PUBLIC double MC_process_clock_get(smx_actor_t);
 XBT_PRIVATE void MC_automaton_load(const char *file);
 
 /********************************* Memory *************************************/
 XBT_PRIVATE void MC_automaton_load(const char *file);
 
 /********************************* Memory *************************************/
@@ -35,4 +33,9 @@ XBT_PUBLIC void MC_memory_init(); /* Initialize the memory subsystem */
 
 SG_END_DECL
 
 
 SG_END_DECL
 
+#ifdef __cplusplus
+XBT_PUBLIC void MC_process_clock_add(const simgrid::kernel::actor::ActorImpl*, double);
+XBT_PUBLIC double MC_process_clock_get(const simgrid::kernel::actor::ActorImpl*);
+#endif
+
 #endif
 #endif
index f5ef3b4..42d42f6 100644 (file)
@@ -161,7 +161,7 @@ static void MC_report_assertion_error()
   session->log_state();
 }
 
   session->log_state();
 }
 
-bool ModelChecker::handle_message(char* buffer, ssize_t size)
+bool ModelChecker::handle_message(const char* buffer, ssize_t size)
 {
   s_mc_message_t base_message;
   xbt_assert(size >= (ssize_t)sizeof(base_message), "Broken message");
 {
   s_mc_message_t base_message;
   xbt_assert(size >= (ssize_t)sizeof(base_message), "Broken message");
index fcbff13..52d068f 100644 (file)
@@ -65,7 +65,7 @@ public:
 
 private:
   void setup_ignore();
 
 private:
   void setup_ignore();
-  bool handle_message(char* buffer, ssize_t size);
+  bool handle_message(const char* buffer, ssize_t size);
   void handle_waitpid();
   void on_signal(int signo);
 
   void handle_waitpid();
   void on_signal(int signo);
 
index 5b8919b..55d40b6 100644 (file)
@@ -33,10 +33,9 @@ void VisitedStates::prune()
 {
   while (states_.size() > (std::size_t)_sg_mc_max_visited_states) {
     XBT_DEBUG("Try to remove visited state (maximum number of stored states reached)");
 {
   while (states_.size() > (std::size_t)_sg_mc_max_visited_states) {
     XBT_DEBUG("Try to remove visited state (maximum number of stored states reached)");
-    auto min_element = boost::range::min_element(states_,
-      [](std::unique_ptr<simgrid::mc::VisitedState>& a, std::unique_ptr<simgrid::mc::VisitedState>& b) {
-        return a->num < b->num;
-      });
+    auto min_element = boost::range::min_element(
+        states_, [](const std::unique_ptr<simgrid::mc::VisitedState>& a,
+                    const std::unique_ptr<simgrid::mc::VisitedState>& b) { return a->num < b->num; });
     xbt_assert(min_element != states_.end());
     // and drop it:
     states_.erase(min_element);
     xbt_assert(min_element != states_.end());
     // and drop it:
     states_.erase(min_element);
index db14ae1..a6a4127 100644 (file)
@@ -29,8 +29,8 @@ std::vector<std::vector<simgrid::mc::PatternCommunication*>> incomplete_communic
 
 /********** Static functions ***********/
 
 
 /********** Static functions ***********/
 
-static e_mc_comm_pattern_difference_t compare_comm_pattern(simgrid::mc::PatternCommunication* comm1,
-                                                           simgrid::mc::PatternCommunication* comm2)
+static e_mc_comm_pattern_difference_t compare_comm_pattern(const simgrid::mc::PatternCommunication* comm1,
+                                                           const simgrid::mc::PatternCommunication* comm2)
 {
   if(comm1->type != comm2->type)
     return TYPE_DIFF;
 {
   if(comm1->type != comm2->type)
     return TYPE_DIFF;
@@ -50,7 +50,7 @@ static e_mc_comm_pattern_difference_t compare_comm_pattern(simgrid::mc::PatternC
 }
 
 static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int process,
 }
 
 static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int process,
-                                      simgrid::mc::PatternCommunication* comm, unsigned int cursor)
+                                      const simgrid::mc::PatternCommunication* comm, unsigned int cursor)
 {
   char* type;
   char* res;
 {
   char* type;
   char* res;
@@ -116,7 +116,7 @@ static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
 namespace simgrid {
 namespace mc {
 
 namespace simgrid {
 namespace mc {
 
-void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, PatternCommunication* comm,
+void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, const PatternCommunication* comm,
                                                                  int backtracking)
 {
   if (not backtracking) {
                                                                  int backtracking)
 {
   if (not backtracking) {
@@ -253,7 +253,7 @@ void CommunicationDeterminismChecker::complete_comm_pattern(RemotePtr<kernel::ac
   std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer];
   auto current_comm_pattern =
       std::find_if(begin(incomplete_pattern), end(incomplete_pattern),
   std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer];
   auto current_comm_pattern =
       std::find_if(begin(incomplete_pattern), end(incomplete_pattern),
-                   [&comm_addr](PatternCommunication* comm) { return remote(comm->comm_addr) == comm_addr; });
+                   [&comm_addr](const PatternCommunication* comm) { return remote(comm->comm_addr) == comm_addr; });
   if (current_comm_pattern == std::end(incomplete_pattern))
     xbt_die("Corresponding communication not found!");
 
   if (current_comm_pattern == std::end(incomplete_pattern))
     xbt_die("Corresponding communication not found!");
 
index c10d60f..6e132c8 100644 (file)
@@ -28,7 +28,7 @@ private:
   void prepare();
   void real_run();
   void log_state() override;
   void prepare();
   void real_run();
   void log_state() override;
-  void deterministic_comm_pattern(int process, simgrid::mc::PatternCommunication* comm, int backtracking);
+  void deterministic_comm_pattern(int process, const simgrid::mc::PatternCommunication* comm, int backtracking);
   void restoreState();
 public:
   // These are used by functions which should be moved in CommunicationDeterminismChecker:
   void restoreState();
 public:
   // These are used by functions which should be moved in CommunicationDeterminismChecker:
index 7f5a9d6..75a6307 100644 (file)
@@ -39,7 +39,7 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
   this->atomic_propositions = std::move(atomic_propositions);
 }
 
   this->atomic_propositions = std::move(atomic_propositions);
 }
 
-static bool evaluate_label(xbt_automaton_exp_label_t l, std::vector<int> const& values)
+static bool evaluate_label(const xbt_automaton_exp_label* l, std::vector<int> const& values)
 {
   switch (l->type) {
   case xbt_automaton_exp_label::AUT_OR:
 {
   switch (l->type) {
   case xbt_automaton_exp_label::AUT_OR:
@@ -260,7 +260,7 @@ std::vector<std::string> LivenessChecker::get_textual_trace() // override
   return trace;
 }
 
   return trace;
 }
 
-std::shared_ptr<Pair> LivenessChecker::create_pair(Pair* current_pair, xbt_automaton_state_t state,
+std::shared_ptr<Pair> LivenessChecker::create_pair(const Pair* current_pair, xbt_automaton_state_t state,
                                                    std::shared_ptr<const std::vector<int>> propositions)
 {
   expanded_pairs_count_++;
                                                    std::shared_ptr<const std::vector<int>> propositions)
 {
   expanded_pairs_count_++;
index 3867a9e..d050fa8 100644 (file)
@@ -71,7 +71,7 @@ private:
   void remove_acceptance_pair(int pair_num);
   void purge_visited_pairs();
   void backtrack();
   void remove_acceptance_pair(int pair_num);
   void purge_visited_pairs();
   void backtrack();
-  std::shared_ptr<Pair> create_pair(Pair* pair, xbt_automaton_state_t state,
+  std::shared_ptr<Pair> create_pair(const Pair* pair, xbt_automaton_state_t state,
                                     std::shared_ptr<const std::vector<int>> propositions);
 
   // A stack of (application_state, automaton_state) pairs for DFS exploration:
                                     std::shared_ptr<const std::vector<int>> propositions);
 
   // A stack of (application_state, automaton_state) pairs for DFS exploration:
index bb45a97..e4859a2 100644 (file)
@@ -31,7 +31,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_safety, mc, "Logging specific to MC safety ve
 namespace simgrid {
 namespace mc {
 
 namespace simgrid {
 namespace mc {
 
-void SafetyChecker::check_non_termination(State* current_state)
+void SafetyChecker::check_non_termination(const State* current_state)
 {
   for (auto state = stack_.rbegin(); state != stack_.rend(); ++state)
     if (snapshot_equal((*state)->system_state_.get(), current_state->system_state_.get())) {
 {
   for (auto state = stack_.rbegin(); state != stack_.rend(); ++state)
     if (snapshot_equal((*state)->system_state_.get(), current_state->system_state_.get())) {
index 1377934..8fb5df2 100644 (file)
@@ -30,7 +30,7 @@ public:
   void log_state() override;
 
 private:
   void log_state() override;
 
 private:
-  void check_non_termination(simgrid::mc::State* current_state);
+  void check_non_termination(const State* current_state);
   void backtrack();
   void restore_state();
 
   void backtrack();
   void restore_state();
 
index a93c6d1..9e93e1a 100644 (file)
@@ -60,7 +60,7 @@ public:
   std::vector<Type*> types;
   std::size_t heapsize = 0;
 
   std::vector<Type*> types;
   std::size_t heapsize = 0;
 
-  void initHeapInformation(xbt_mheap_t heap, const std::vector<IgnoredHeapRegion>& i);
+  void initHeapInformation(const s_xbt_mheap_t* heap, const std::vector<IgnoredHeapRegion>& i);
 };
 
 class StateComparator {
 };
 
 class StateComparator {
@@ -77,8 +77,8 @@ public:
     compared_pointers.clear();
   }
 
     compared_pointers.clear();
   }
 
-  int initHeapInformation(xbt_mheap_t heap1, xbt_mheap_t heap2, const std::vector<IgnoredHeapRegion>& i1,
-                          const std::vector<IgnoredHeapRegion>& i2);
+  int initHeapInformation(const s_xbt_mheap_t* heap1, const s_xbt_mheap_t* heap2,
+                          const std::vector<IgnoredHeapRegion>& i1, const std::vector<IgnoredHeapRegion>& i2);
 
   template <int rank> HeapArea& equals_to_(std::size_t i, std::size_t j)
   {
 
   template <int rank> HeapArea& equals_to_(std::size_t i, std::size_t j)
   {
@@ -123,7 +123,7 @@ public:
            this->equals_to_<2>(b2, f2).block_ == b1 && this->equals_to_<2>(b2, f2).fragment_ == f1;
   }
 
            this->equals_to_<2>(b2, f2).block_ == b1 && this->equals_to_<2>(b2, f2).fragment_ == f1;
   }
 
-  void match_equals(HeapLocationPairs* list);
+  void match_equals(const HeapLocationPairs* list);
 };
 
 } // namespace mc
 };
 
 } // namespace mc
@@ -171,7 +171,7 @@ static bool is_block_stack(int block)
 namespace simgrid {
 namespace mc {
 
 namespace simgrid {
 namespace mc {
 
-void StateComparator::match_equals(HeapLocationPairs* list)
+void StateComparator::match_equals(const HeapLocationPairs* list)
 {
   for (auto const& pair : *list) {
     if (pair[0].fragment_ != -1) {
 {
   for (auto const& pair : *list) {
     if (pair[0].fragment_ != -1) {
@@ -184,7 +184,7 @@ void StateComparator::match_equals(HeapLocationPairs* list)
   }
 }
 
   }
 }
 
-void ProcessComparisonState::initHeapInformation(xbt_mheap_t heap, const std::vector<IgnoredHeapRegion>& i)
+void ProcessComparisonState::initHeapInformation(const s_xbt_mheap_t* heap, const std::vector<IgnoredHeapRegion>& i)
 {
   auto heaplimit  = heap->heaplimit;
   this->heapsize  = heap->heapsize;
 {
   auto heaplimit  = heap->heaplimit;
   this->heapsize  = heap->heapsize;
@@ -193,7 +193,8 @@ void ProcessComparisonState::initHeapInformation(xbt_mheap_t heap, const std::ve
   this->types.assign(heaplimit * MAX_FRAGMENT_PER_BLOCK, nullptr);
 }
 
   this->types.assign(heaplimit * MAX_FRAGMENT_PER_BLOCK, nullptr);
 }
 
-int StateComparator::initHeapInformation(xbt_mheap_t heap1, xbt_mheap_t heap2, const std::vector<IgnoredHeapRegion>& i1,
+int StateComparator::initHeapInformation(const s_xbt_mheap_t* heap1, const s_xbt_mheap_t* heap2,
+                                         const std::vector<IgnoredHeapRegion>& i1,
                                          const std::vector<IgnoredHeapRegion>& i2)
 {
   if ((heap1->heaplimit != heap2->heaplimit) || (heap1->heapsize != heap2->heapsize))
                                          const std::vector<IgnoredHeapRegion>& i2)
 {
   if ((heap1->heaplimit != heap2->heaplimit) || (heap1->heapsize != heap2->heapsize))
@@ -228,8 +229,8 @@ static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot
   malloc_info heapinfo_temp2;
   malloc_info heapinfo_temp2b;
 
   malloc_info heapinfo_temp2;
   malloc_info heapinfo_temp2b;
 
-  Region* heap_region1 = MC_get_heap_region(snapshot1);
-  Region* heap_region2 = MC_get_heap_region(snapshot2);
+  const Region* heap_region1 = MC_get_heap_region(snapshot1);
+  const Region* heap_region2 = MC_get_heap_region(snapshot2);
 
   // This is the address of std_heap->heapinfo in the application process:
   void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
 
   // This is the address of std_heap->heapinfo in the application process:
   void* heapinfo_address = &((xbt_mheap_t)process.heap_address)->heapinfo;
@@ -448,8 +449,8 @@ static bool heap_area_differ_without_type(StateComparator& state, const void* re
                                           HeapLocationPairs* previous, int size, int check_ignore)
 {
   const RemoteClient& process = mc_model_checker->process();
                                           HeapLocationPairs* previous, int size, int check_ignore)
 {
   const RemoteClient& process = mc_model_checker->process();
-  Region* heap_region1        = MC_get_heap_region(snapshot1);
-  Region* heap_region2        = MC_get_heap_region(snapshot2);
+  const Region* heap_region1  = MC_get_heap_region(snapshot1);
+  const Region* heap_region2  = MC_get_heap_region(snapshot2);
 
   for (int i = 0; i < size; ) {
     if (check_ignore > 0) {
 
   for (int i = 0; i < size; ) {
     if (check_ignore > 0) {
@@ -509,7 +510,7 @@ static bool heap_area_differ_without_type(StateComparator& state, const void* re
  */
 static bool heap_area_differ_with_type(StateComparator& state, const void* real_area1, const void* real_area2,
                                        const Snapshot& snapshot1, const Snapshot& snapshot2,
  */
 static bool heap_area_differ_with_type(StateComparator& state, const void* real_area1, const void* real_area2,
                                        const Snapshot& snapshot1, const Snapshot& snapshot2,
-                                       HeapLocationPairs* previous, Type* type, int area_size, int check_ignore,
+                                       HeapLocationPairs* previous, const Type* type, int area_size, int check_ignore,
                                        int pointer_level)
 {
   // HACK: This should not happen but in practice, there are some
                                        int pointer_level)
 {
   // HACK: This should not happen but in practice, there are some
@@ -536,8 +537,8 @@ static bool heap_area_differ_with_type(StateComparator& state, const void* real_
   const void* addr_pointed1;
   const void* addr_pointed2;
 
   const void* addr_pointed1;
   const void* addr_pointed2;
 
-  Region* heap_region1 = MC_get_heap_region(snapshot1);
-  Region* heap_region2 = MC_get_heap_region(snapshot2);
+  const Region* heap_region1 = MC_get_heap_region(snapshot1);
+  const Region* heap_region2 = MC_get_heap_region(snapshot2);
 
   switch (type->type) {
     case DW_TAG_unspecified_type:
 
   switch (type->type) {
     case DW_TAG_unspecified_type:
@@ -652,7 +653,7 @@ static bool heap_area_differ_with_type(StateComparator& state, const void* real_
             return true;
         }
         } else {
             return true;
         }
         } else {
-          for (simgrid::mc::Member& member : type->members) {
+          for (const simgrid::mc::Member& member : type->members) {
             // TODO, optimize this? (for the offset case)
             const void* real_member1 = dwarf::resolve_member(real_area1, type, &member, &snapshot1);
             const void* real_member2 = dwarf::resolve_member(real_area2, type, &member, &snapshot2);
             // TODO, optimize this? (for the offset case)
             const void* real_member1 = dwarf::resolve_member(real_area1, type, &member, &snapshot1);
             const void* real_member2 = dwarf::resolve_member(real_area2, type, &member, &snapshot2);
@@ -700,7 +701,7 @@ static Type* get_offset_type(void* real_base_address, Type* type, int offset, in
         return nullptr;
     }
 
         return nullptr;
     }
 
-    for (simgrid::mc::Member& member : type->members) {
+    for (const simgrid::mc::Member& member : type->members) {
       if (member.has_offset_location()) {
         // We have the offset, use it directly (shortcut):
         if (member.offset() == offset)
       if (member.has_offset_location()) {
         // We have the offset, use it directly (shortcut):
         if (member.offset() == offset)
@@ -806,8 +807,8 @@ static bool heap_area_differ(StateComparator& state, const void* area1, const vo
       type_size = type->byte_size;
   }
 
       type_size = type->byte_size;
   }
 
-  simgrid::mc::Region* heap_region1 = MC_get_heap_region(snapshot1);
-  simgrid::mc::Region* heap_region2 = MC_get_heap_region(snapshot2);
+  const Region* heap_region1 = MC_get_heap_region(snapshot1);
+  const Region* heap_region2 = MC_get_heap_region(snapshot2);
 
   const malloc_info* heapinfo1 =
       (const malloc_info*)heap_region1->read(&heapinfo_temp1, &heapinfos1[block1], sizeof(malloc_info));
 
   const malloc_info* heapinfo1 =
       (const malloc_info*)heap_region1->read(&heapinfo_temp1, &heapinfos1[block1], sizeof(malloc_info));
@@ -1009,7 +1010,7 @@ static bool heap_area_differ(StateComparator& state, const void* area1, const vo
 static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const void* real_area1,
                                    const simgrid::mc::Snapshot& snapshot1, simgrid::mc::Region* region1,
                                    const void* real_area2, const simgrid::mc::Snapshot& snapshot2,
 static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const void* real_area1,
                                    const simgrid::mc::Snapshot& snapshot1, simgrid::mc::Region* region1,
                                    const void* real_area2, const simgrid::mc::Snapshot& snapshot2,
-                                   simgrid::mc::Region* region2, simgrid::mc::Type* type, int pointer_level)
+                                   simgrid::mc::Region* region2, const simgrid::mc::Type* type, int pointer_level)
 {
   const simgrid::mc::Type* subtype;
   const simgrid::mc::Type* subsubtype;
 {
   const simgrid::mc::Type* subtype;
   const simgrid::mc::Type* subsubtype;
@@ -1113,7 +1114,7 @@ static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const vo
     }
     case DW_TAG_structure_type:
     case DW_TAG_class_type:
     }
     case DW_TAG_structure_type:
     case DW_TAG_class_type:
-      for (simgrid::mc::Member& member : type->members) {
+      for (const simgrid::mc::Member& member : type->members) {
         const void* member1             = simgrid::dwarf::resolve_member(real_area1, type, &member, &snapshot1);
         const void* member2             = simgrid::dwarf::resolve_member(real_area2, type, &member, &snapshot2);
         simgrid::mc::Region* subregion1 = snapshot1.get_region(member1, region1); // region1 is hinted
         const void* member1             = simgrid::dwarf::resolve_member(real_area1, type, &member, &snapshot1);
         const void* member2             = simgrid::dwarf::resolve_member(real_area2, type, &member, &snapshot2);
         simgrid::mc::Region* subregion1 = snapshot1.get_region(member1, region1); // region1 is hinted
@@ -1133,9 +1134,10 @@ static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const vo
   return false;
 }
 
   return false;
 }
 
-static bool global_variables_differ(simgrid::mc::StateComparator& state, simgrid::mc::ObjectInformation* object_info,
-                                    simgrid::mc::Region* r1, simgrid::mc::Region* r2,
-                                    const simgrid::mc::Snapshot& snapshot1, const simgrid::mc::Snapshot& snapshot2)
+static bool global_variables_differ(simgrid::mc::StateComparator& state,
+                                    const simgrid::mc::ObjectInformation* object_info, simgrid::mc::Region* r1,
+                                    simgrid::mc::Region* r2, const simgrid::mc::Snapshot& snapshot1,
+                                    const simgrid::mc::Snapshot& snapshot2)
 {
   xbt_assert(r1 && r2, "Missing region.");
 
 {
   xbt_assert(r1 && r2, "Missing region.");
 
index cc70196..a370ac7 100644 (file)
@@ -20,7 +20,7 @@ namespace dwarf {
 
 /** Resolve a location expression */
 Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info,
 
 /** Resolve a location expression */
 Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info,
-                 unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space)
+                 unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space)
 {
   simgrid::dwarf::ExpressionContext context;
   context.frame_base    = frame_pointer_address;
 {
   simgrid::dwarf::ExpressionContext context;
   context.frame_base    = frame_pointer_address;
@@ -50,7 +50,7 @@ static simgrid::dwarf::DwarfExpression const* find_expression(simgrid::dwarf::Lo
 }
 
 Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::ObjectInformation* object_info,
 }
 
 Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::ObjectInformation* object_info,
-                 unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space)
+                 unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space)
 {
   unw_word_t ip = 0;
   if (c && unw_get_reg(c, UNW_REG_IP, &ip))
 {
   unw_word_t ip = 0;
   if (c && unw_get_reg(c, UNW_REG_IP, &ip))
@@ -61,7 +61,7 @@ Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::Obj
   return simgrid::dwarf::resolve(*expression, object_info, c, frame_pointer_address, address_space);
 }
 
   return simgrid::dwarf::resolve(*expression, object_info, c, frame_pointer_address, address_space);
 }
 
-LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr)
+LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr)
 {
   LocationList locations;
   std::ptrdiff_t offset = 0;
 {
   LocationList locations;
   std::ptrdiff_t offset = 0;
index adb4b4e..46f50db 100644 (file)
@@ -66,13 +66,13 @@ public:
 
 XBT_PRIVATE
 Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info,
 
 XBT_PRIVATE
 Location resolve(simgrid::dwarf::DwarfExpression const& expression, simgrid::mc::ObjectInformation* object_info,
-                 unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space);
+                 unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space);
 
 Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::ObjectInformation* object_info,
 
 Location resolve(simgrid::dwarf::LocationList const& locations, simgrid::mc::ObjectInformation* object_info,
-                 unw_cursor_t* c, void* frame_pointer_address, simgrid::mc::AddressSpace* address_space);
+                 unw_cursor_t* c, void* frame_pointer_address, const simgrid::mc::AddressSpace* address_space);
 
 XBT_PRIVATE
 
 XBT_PRIVATE
-simgrid::dwarf::LocationList location_list(simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr);
+simgrid::dwarf::LocationList location_list(const simgrid::mc::ObjectInformation& info, Dwarf_Attribute& attr);
 
 } // namespace dwarf
 } // namespace simgrid
 
 } // namespace dwarf
 } // namespace simgrid
index 0e3a394..6928513 100644 (file)
@@ -157,7 +157,8 @@ XBT_PRIVATE std::shared_ptr<ObjectInformation> createObjectInformation(std::vect
                                                                        const char* name);
 
 /** Augment the current module with informations about the other ones */
                                                                        const char* name);
 
 /** Augment the current module with informations about the other ones */
-XBT_PRIVATE void postProcessObjectInformation(simgrid::mc::RemoteClient* process, simgrid::mc::ObjectInformation* info);
+XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteClient* process,
+                                              simgrid::mc::ObjectInformation* info);
 } // namespace mc
 } // namespace simgrid
 
 } // namespace mc
 } // namespace simgrid
 
index c6085b0..6bc7aaf 100644 (file)
@@ -89,7 +89,7 @@ static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf
  *  @param unit the DIE of the compile unit of the current DIE
  *  @param frame containing frame if any
  */
  *  @param unit the DIE of the compile unit of the current DIE
  *  @param frame containing frame if any
  */
-static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit,
+static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, const Dwarf_Die* unit,
                                          simgrid::mc::Frame* frame, const char* ns);
 
 /** @brief Get the DW_TAG_type of the DIE
                                          simgrid::mc::Frame* frame, const char* ns);
 
 /** @brief Get the DW_TAG_type of the DIE
@@ -431,7 +431,7 @@ static bool MC_compare_variable(simgrid::mc::Variable const& a, simgrid::mc::Var
  *  @param  member the member of the type
  *  @param  child  DIE of the member (DW_TAG_member)
  */
  *  @param  member the member of the type
  *  @param  child  DIE of the member (DW_TAG_member)
  */
-static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die* child)
+static void MC_dwarf_fill_member_location(const simgrid::mc::Type* type, simgrid::mc::Member* member, Dwarf_Die* child)
 {
   xbt_assert(not dwarf_hasattr(child, DW_AT_data_bit_offset), "Can't groke DW_AT_data_bit_offset.");
 
 {
   xbt_assert(not dwarf_hasattr(child, DW_AT_data_bit_offset), "Can't groke DW_AT_data_bit_offset.");
 
@@ -484,8 +484,8 @@ static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::
  *  @param unit DIE of the compilation unit containing the type DIE
  *  @param type the type
  */
  *  @param unit DIE of the compilation unit containing the type DIE
  *  @param type the type
  */
-static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* /*info*/, Dwarf_Die* die, Dwarf_Die* /*unit*/,
-                                 simgrid::mc::Type* type)
+static void MC_dwarf_add_members(const simgrid::mc::ObjectInformation* /*info*/, Dwarf_Die* die,
+                                 const Dwarf_Die* /*unit*/, simgrid::mc::Type* type)
 {
   int res;
   Dwarf_Die child;
 {
   int res;
   Dwarf_Die child;
@@ -644,8 +644,8 @@ static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf
 static int mc_anonymous_variable_index = 0;
 
 static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(simgrid::mc::ObjectInformation* info, Dwarf_Die* die,
 static int mc_anonymous_variable_index = 0;
 
 static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(simgrid::mc::ObjectInformation* info, Dwarf_Die* die,
-                                                                 Dwarf_Die* /*unit*/, simgrid::mc::Frame* frame,
-                                                                 const char* ns)
+                                                                 const Dwarf_Die* /*unit*/,
+                                                                 const simgrid::mc::Frame* frame, const char* ns)
 {
   // Skip declarations:
   if (MC_dwarf_attr_flag(die, DW_AT_declaration, false))
 {
   // Skip declarations:
   if (MC_dwarf_attr_flag(die, DW_AT_declaration, false))
@@ -739,7 +739,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(simgrid::mc::Ob
   return variable;
 }
 
   return variable;
 }
 
-static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, Dwarf_Die* unit,
+static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die* die, const Dwarf_Die* unit,
                                          simgrid::mc::Frame* frame, const char* ns)
 {
   std::unique_ptr<simgrid::mc::Variable> variable = MC_die_to_variable(info, die, unit, frame, ns);
                                          simgrid::mc::Frame* frame, const char* ns)
 {
   std::unique_ptr<simgrid::mc::Variable> variable = MC_die_to_variable(info, die, unit, frame, ns);
@@ -1207,7 +1207,7 @@ std::shared_ptr<ObjectInformation> createObjectInformation(std::vector<xbt::VmMa
 
 /*************************************************************************/
 
 
 /*************************************************************************/
 
-void postProcessObjectInformation(RemoteClient* process, ObjectInformation* info)
+void postProcessObjectInformation(const RemoteClient* process, ObjectInformation* info)
 {
   for (auto& t : info->types) {
     Type* type    = &(t.second);
 {
   for (auto& t : info->types) {
     Type* type    = &(t.second);
index d24ebe9..8ee9ab5 100644 (file)
@@ -16,7 +16,7 @@ namespace dwarf {
 XBT_PRIVATE const char* attrname(int attr);
 XBT_PRIVATE const char* tagname(int tag);
 
 XBT_PRIVATE const char* attrname(int attr);
 XBT_PRIVATE const char* tagname(int tag);
 
-XBT_PRIVATE void* resolve_member(const void* base, simgrid::mc::Type* type, simgrid::mc::Member* member,
+XBT_PRIVATE void* resolve_member(const void* base, const simgrid::mc::Type* type, const simgrid::mc::Member* member,
                                  const simgrid::mc::AddressSpace* snapshot);
 
 XBT_PRIVATE
                                  const simgrid::mc::AddressSpace* snapshot);
 
 XBT_PRIVATE
index 1bd5ad4..fbc7054 100644 (file)
@@ -18,7 +18,7 @@ namespace dwarf {
  * @param snapshot Snapshot (or nullptr)
  * @return Process address of the given member of the 'object' struct/class
  */
  * @param snapshot Snapshot (or nullptr)
  * @return Process address of the given member of the 'object' struct/class
  */
-void* resolve_member(const void* base, simgrid::mc::Type* /*type*/, simgrid::mc::Member* member,
+void* resolve_member(const void* base, const simgrid::mc::Type* /*type*/, const simgrid::mc::Member* member,
                      const simgrid::mc::AddressSpace* address_space)
 {
   ExpressionContext state;
                      const simgrid::mc::AddressSpace* address_space)
 {
   ExpressionContext state;
index 10c8ec9..e574258 100644 (file)
@@ -42,7 +42,7 @@ void wait_for_requests()
   while (not simix_global->actors_to_run.empty()) {
     simix_global->run_all_actors();
     for (smx_actor_t const& process : simix_global->actors_that_ran) {
   while (not simix_global->actors_to_run.empty()) {
     simix_global->run_all_actors();
     for (smx_actor_t const& process : simix_global->actors_that_ran) {
-      smx_simcall_t req = &process->simcall;
+      const s_smx_simcall* req = &process->simcall;
       if (req->call_ != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
         process->simcall_handle(0);
     }
       if (req->call_ != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
         process->simcall_handle(0);
     }
@@ -148,7 +148,7 @@ bool actor_is_enabled(smx_actor_t actor)
 /* This is the list of requests that are visible from the checker algorithm.
  * Any other requests are handled right away on the application side.
  */
 /* This is the list of requests that are visible from the checker algorithm.
  * Any other requests are handled right away on the application side.
  */
-bool request_is_visible(smx_simcall_t req)
+bool request_is_visible(const s_smx_simcall* req)
 {
 #if SIMGRID_HAVE_MC
   xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
 {
 #if SIMGRID_HAVE_MC
   xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
index a1160d0..48cbdde 100644 (file)
@@ -40,8 +40,7 @@ XBT_PRIVATE void handle_simcall(smx_simcall_t req, int req_num);
 XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
 
 /** Check if the given simcall is visible */
 XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
 
 /** Check if the given simcall is visible */
-XBT_PRIVATE bool request_is_visible(smx_simcall_t req);
-
+XBT_PRIVATE bool request_is_visible(const s_smx_simcall* req);
 }
 }
 
 }
 }
 
index 9d55a88..6b0e4a7 100644 (file)
@@ -43,7 +43,7 @@ enum e_mc_comm_pattern_difference_t {
   DATA_DIFF,
 };
 
   DATA_DIFF,
 };
 
-static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
+static inline e_mc_call_type_t MC_get_call_type(const s_smx_simcall* req)
 {
   switch (req->call_) {
     case SIMCALL_COMM_ISEND:
 {
   switch (req->call_) {
     case SIMCALL_COMM_ISEND:
index 975d079..4c57cd7 100644 (file)
@@ -136,7 +136,7 @@ void dumpStack(FILE* file, unw_cursor_t&& cursor)
 }
 #endif
 
 }
 #endif
 
-double MC_process_clock_get(smx_actor_t process)
+double MC_process_clock_get(const simgrid::kernel::actor::ActorImpl* process)
 {
   if (simgrid::mc::processes_time.empty())
     return 0;
 {
   if (simgrid::mc::processes_time.empty())
     return 0;
@@ -145,7 +145,7 @@ double MC_process_clock_get(smx_actor_t process)
   return -1;
 }
 
   return -1;
 }
 
-void MC_process_clock_add(smx_actor_t process, double amount)
+void MC_process_clock_add(const simgrid::kernel::actor::ActorImpl* process, double amount)
 {
   simgrid::mc::processes_time[process->get_pid()] += amount;
 }
 {
   simgrid::mc::processes_time[process->get_pid()] += amount;
 }
index 4c7f441..53a3acc 100644 (file)
@@ -34,7 +34,7 @@ void replay(RecordTrace const& trace)
     smx_actor_t process = SIMIX_process_from_PID(transition.pid_);
     if (not process)
       xbt_die("Unexpected process (pid:%d).", transition.pid_);
     smx_actor_t process = SIMIX_process_from_PID(transition.pid_);
     if (not process)
       xbt_die("Unexpected process (pid:%d).", transition.pid_);
-    smx_simcall_t simcall = &(process->simcall);
+    const s_smx_simcall* simcall = &(process->simcall);
     if (simcall == nullptr || simcall->call_ == SIMCALL_NONE)
       xbt_die("No simcall for process %d.", transition.pid_);
     if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::actor_is_enabled(process))
     if (simcall == nullptr || simcall->call_ == SIMCALL_NONE)
       xbt_die("No simcall for process %d.", transition.pid_);
     if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::actor_is_enabled(process))
index e6ffc00..606a523 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
  */
  *  @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(simgrid::mc::RemoteClient* process,
+static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteClient* process,
                                                  std::vector<simgrid::mc::ActorInformation>& target,
                                                  simgrid::mc::RemotePtr<s_xbt_dynar_t> remote_dynar)
 {
                                                  std::vector<simgrid::mc::ActorInformation>& target,
                                                  simgrid::mc::RemotePtr<s_xbt_dynar_t> remote_dynar)
 {
index 9e70190..586b5a0 100644 (file)
@@ -124,7 +124,10 @@ public:
   explicit State(unsigned long state_number);
 
   std::size_t interleave_size() const;
   explicit State(unsigned long state_number);
 
   std::size_t interleave_size() const;
-  void add_interleaving_set(smx_actor_t actor) { this->actor_states_[actor->get_pid()].consider(); }
+  void add_interleaving_set(const simgrid::kernel::actor::ActorImpl* actor)
+  {
+    this->actor_states_[actor->get_pid()].consider();
+  }
   Transition get_transition() const;
 };
 }
   Transition get_transition() const;
 };
 }
index a1c9242..b5fd0a0 100644 (file)
@@ -72,7 +72,7 @@ Client* Client::initialize()
   return instance_.get();
 }
 
   return instance_.get();
 }
 
-void Client::handle_deadlock_check(s_mc_message_t*)
+void Client::handle_deadlock_check(const s_mc_message_t*)
 {
   bool deadlock = false;
   if (not simix_global->process_list.empty()) {
 {
   bool deadlock = false;
   if (not simix_global->process_list.empty()) {
@@ -88,11 +88,11 @@ void Client::handle_deadlock_check(s_mc_message_t*)
   s_mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
   xbt_assert(channel_.send(answer) == 0, "Could not send response");
 }
   s_mc_message_int_t answer{MC_MESSAGE_DEADLOCK_CHECK_REPLY, deadlock};
   xbt_assert(channel_.send(answer) == 0, "Could not send response");
 }
-void Client::handle_continue(s_mc_message_t*)
+void Client::handle_continue(const s_mc_message_t*)
 {
   /* Nothing to do */
 }
 {
   /* Nothing to do */
 }
-void Client::handle_simcall(s_mc_message_simcall_handle_t* message)
+void Client::handle_simcall(const s_mc_message_simcall_handle_t* message)
 {
   smx_actor_t process = SIMIX_process_from_PID(message->pid);
   if (not process)
 {
   smx_actor_t process = SIMIX_process_from_PID(message->pid);
   if (not process)
@@ -102,7 +102,7 @@ void Client::handle_simcall(s_mc_message_simcall_handle_t* message)
     xbt_die("Could not send MESSAGE_WAITING to model-checker");
 }
 
     xbt_die("Could not send MESSAGE_WAITING to model-checker");
 }
 
-void Client::handle_actor_enabled(s_mc_message_actor_enabled_t* msg)
+void Client::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg)
 {
   bool res = simgrid::mc::actor_is_enabled(SIMIX_process_from_PID(msg->aid));
   s_mc_message_int_t answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res};
 {
   bool res = simgrid::mc::actor_is_enabled(SIMIX_process_from_PID(msg->aid));
   s_mc_message_int_t answer{MC_MESSAGE_ACTOR_ENABLED_REPLY, res};
@@ -120,7 +120,7 @@ void Client::handle_messages()
     if (received_size < 0)
       xbt_die("Could not receive commands from the model-checker");
 
     if (received_size < 0)
       xbt_die("Could not receive commands from the model-checker");
 
-    s_mc_message_t* message = (s_mc_message_t*)message_buffer;
+    const s_mc_message_t* message = (s_mc_message_t*)message_buffer;
     switch (message->type) {
       case MC_MESSAGE_DEADLOCK_CHECK:
         xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)",
     switch (message->type) {
       case MC_MESSAGE_DEADLOCK_CHECK:
         xbt_assert(received_size == sizeof(s_mc_message_t), "Unexpected size for DEADLOCK_CHECK (%zd != %zu)",
index b26207e..e0ce493 100644 (file)
@@ -28,10 +28,10 @@ public:
   void handle_messages();
 
 private:
   void handle_messages();
 
 private:
-  void handle_deadlock_check(s_mc_message_t* msg);
-  void handle_continue(s_mc_message_t* msg);
-  void handle_simcall(s_mc_message_simcall_handle_t* message);
-  void handle_actor_enabled(s_mc_message_actor_enabled_t* msg);
+  void handle_deadlock_check(const s_mc_message_t* msg);
+  void handle_continue(const s_mc_message_t* msg);
+  void handle_simcall(const s_mc_message_simcall_handle_t* message);
+  void handle_actor_enabled(const s_mc_message_actor_enabled_t* msg);
 
 public:
   Channel const& get_channel() const { return channel_; }
 
 public:
   Channel const& get_channel() const { return channel_; }
index 14796c4..c51891c 100644 (file)
@@ -15,7 +15,7 @@ namespace mc {
  *  @param page_count      Number of pages of the region
  *  @return                Snapshot page numbers of this new snapshot
  */
  *  @param page_count      Number of pages of the region
  *  @return                Snapshot page numbers of this new snapshot
  */
-ChunkedData::ChunkedData(PageStore& store, AddressSpace& as, RemotePtr<void> addr, std::size_t page_count)
+ChunkedData::ChunkedData(PageStore& store, const AddressSpace& as, RemotePtr<void> addr, std::size_t page_count)
     : store_(&store)
 {
   this->pagenos_.resize(page_count);
     : store_(&store)
 {
   this->pagenos_.resize(page_count);
index 8d5f1ba..a7f2903 100644 (file)
@@ -84,7 +84,7 @@ public:
   /** Get a a pointer to a chunk */
   void* page(std::size_t i) const { return store_->get_page(pagenos_[i]); }
 
   /** Get a a pointer to a chunk */
   void* page(std::size_t i) const { return store_->get_page(pagenos_[i]); }
 
-  ChunkedData(PageStore& store, AddressSpace& as, RemotePtr<void> addr, std::size_t page_count);
+  ChunkedData(PageStore& store, const AddressSpace& as, RemotePtr<void> addr, std::size_t page_count);
 };
 
 } // namespace mc
 };
 
 } // namespace mc
index 149e36d..e96f0b6 100644 (file)
@@ -142,7 +142,7 @@ void PageStore::remove_page(std::size_t pageno)
 }
 
 /** Store a page in memory */
 }
 
 /** Store a page in memory */
-std::size_t PageStore::store_page(void* page)
+std::size_t PageStore::store_page(const void* page)
 {
   xbt_assert(top_index_ <= this->capacity_, "top_index is not consistent");
 
 {
   xbt_assert(top_index_ <= this->capacity_, "top_index is not consistent");
 
index 0853b6d..0bc896f 100644 (file)
@@ -134,7 +134,7 @@ public:
   void ref_page(size_t pageno);
 
   /** @brief Store a page in the page store */
   void ref_page(size_t pageno);
 
   /** @brief Store a page in the page store */
-  std::size_t store_page(void* page);
+  std::size_t store_page(const void* page);
 
   /** @brief Get a page from its page number
    *
 
   /** @brief Get a page from its page number
    *
index 41c8b1b..1cc0105 100644 (file)
@@ -44,7 +44,7 @@ void Region::restore()
   }
 }
 
   }
 }
 
-static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgrid::mc::Region* region)
+static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, const simgrid::mc::Region* region)
 {
   auto split                = simgrid::mc::mmu::split(addr - region->start().address());
   auto pageno               = split.first;
 {
   auto split                = simgrid::mc::mmu::split(addr - region->start().address());
   auto pageno               = split.first;
@@ -53,7 +53,7 @@ static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgr
   return (char*)snapshot_page + offset;
 }
 
   return (char*)snapshot_page + offset;
 }
 
-void* Region::read(void* target, const void* addr, std::size_t size)
+void* Region::read(void* target, const void* addr, std::size_t size) const
 {
   xbt_assert(contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary.");
 
 {
   xbt_assert(contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary.");
 
@@ -103,8 +103,8 @@ void* Region::read(void* target, const void* addr, std::size_t size)
  * @param region2 Region of the address in the second snapshot
  * @return same semantic as memcmp
  */
  * @param region2 Region of the address in the second snapshot
  * @return same semantic as memcmp
  */
-int MC_snapshot_region_memcmp(const void* addr1, simgrid::mc::Region* region1, const void* addr2,
-                              simgrid::mc::Region* region2, size_t size)
+int MC_snapshot_region_memcmp(const void* addr1, const simgrid::mc::Region* region1, const void* addr2,
+                              const simgrid::mc::Region* region2, size_t size)
 {
   // Using alloca() for large allocations may trigger stack overflow:
   // use malloc if the buffer is too big.
 {
   // Using alloca() for large allocations may trigger stack overflow:
   // use malloc if the buffer is too big.
index 4985c61..f75a345 100644 (file)
@@ -69,16 +69,16 @@ public:
    *  @param size    Size of the data to read in bytes
    *  @return Pointer where the data is located (either target buffer or original location)
    */
    *  @param size    Size of the data to read in bytes
    *  @return Pointer where the data is located (either target buffer or original location)
    */
-  void* read(void* target, const void* addr, std::size_t size);
+  void* read(void* target, const void* addr, std::size_t size) const;
 };
 
 } // namespace mc
 } // namespace simgrid
 
 };
 
 } // namespace mc
 } // namespace simgrid
 
-int MC_snapshot_region_memcmp(const void* addr1, simgrid::mc::Region* region1, const void* addr2,
-                              simgrid::mc::Region* region2, std::size_t size);
+int MC_snapshot_region_memcmp(const void* addr1, const simgrid::mc::Region* region1, const void* addr2,
+                              const simgrid::mc::Region* region2, std::size_t size);
 
 
-static XBT_ALWAYS_INLINE void* MC_region_read_pointer(simgrid::mc::Region* region, const void* addr)
+static XBT_ALWAYS_INLINE void* MC_region_read_pointer(const simgrid::mc::Region* region, const void* addr)
 {
   void* res;
   return *(void**)region->read(&res, addr, sizeof(void*));
 {
   void* res;
   return *(void**)region->read(&res, addr, sizeof(void*));
index fb8e06f..db553bc 100644 (file)
@@ -40,7 +40,7 @@ void Snapshot::snapshot_regions(RemoteClient* process)
  *  @param ip    Instruction pointer
  *  @return      true if the variable is valid
  * */
  *  @param ip    Instruction pointer
  *  @return      true if the variable is valid
  * */
-static bool valid_variable(simgrid::mc::Variable* var, simgrid::mc::Frame* scope, const void* ip)
+static bool valid_variable(const simgrid::mc::Variable* var, simgrid::mc::Frame* scope, const void* ip)
 {
   // The variable is not yet valid:
   if (scope->range.begin() + var->start_scope > (std::uint64_t)ip)
 {
   // The variable is not yet valid:
   if (scope->range.begin() + var->start_scope > (std::uint64_t)ip)
@@ -55,7 +55,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame, Frame* sco
   if (not scope || not scope->range.contain(stack_frame->ip))
     return;
 
   if (not scope || not scope->range.contain(stack_frame->ip))
     return;
 
-  for (Variable& current_variable : scope->variables) {
+  for (const Variable& current_variable : scope->variables) {
     if (not valid_variable(&current_variable, scope, (void*)stack_frame->ip))
       continue;
 
     if (not valid_variable(&current_variable, scope, (void*)stack_frame->ip))
       continue;
 
@@ -191,7 +191,7 @@ static void snapshot_handle_ignore(Snapshot* snapshot)
     snapshot->process()->clear_bytes(remote(region.addr), region.size);
 }
 
     snapshot->process()->clear_bytes(remote(region.addr), region.size);
 }
 
-static void snapshot_ignore_restore(simgrid::mc::Snapshot* snapshot)
+static void snapshot_ignore_restore(const simgrid::mc::Snapshot* snapshot)
 {
   for (auto const& ignored_data : snapshot->ignored_data_)
     snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
 {
   for (auto const& ignored_data : snapshot->ignored_data_)
     snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
@@ -233,7 +233,7 @@ void Snapshot::add_region(RegionType type, ObjectInformation* object_info, void*
 
 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());
+  const Region* region = this->get_region((void*)address.address());
   if (region) {
     void* res = region->read(buffer, (void*)address.address(), size);
     if (buffer == res || options & ReadOptions::lazy())
   if (region) {
     void* res = region->read(buffer, (void*)address.address(), size);
     if (buffer == res || options & ReadOptions::lazy())