Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference local variables in src/mc/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 22:31:57 +0000 (23:31 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 23:33:39 +0000 (00:33 +0100)
17 files changed:
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/compare.cpp
src/mc/inspect/ObjectInformation.cpp
src/mc/inspect/mc_dwarf.cpp
src/mc/inspect/mc_unw.cpp
src/mc/inspect/mc_unw_vmread.cpp
src/mc/mc_base.cpp
src/mc/mc_request.cpp
src/mc/mc_smx.cpp
src/mc/mc_state.cpp
src/mc/remote/Client.cpp
src/mc/remote/RemoteClient.cpp
src/mc/sosp/Region.cpp
src/mc/sosp/Snapshot.cpp
src/mc/sosp/Snapshot.hpp

index 41d5962..db14ae1 100644 (file)
@@ -96,7 +96,7 @@ static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
   // HACK, type punning
   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
   mc_model_checker->process().read(temp_comm, comm_addr);
-  simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
+  const simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
 
   smx_actor_t src_proc   = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->src_actor_.get()));
   smx_actor_t dst_proc   = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->dst_actor_.get()));
@@ -185,7 +185,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, e_
     Remote<kernel::activity::CommImpl> temp_synchro;
     mc_model_checker->process().read(temp_synchro,
                                      remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
-    kernel::activity::CommImpl* synchro = static_cast<kernel::activity::CommImpl*>(temp_synchro.get_buffer());
+    const kernel::activity::CommImpl* synchro = static_cast<kernel::activity::CommImpl*>(temp_synchro.get_buffer());
 
     char* remote_name = mc_model_checker->process().read<char*>(RemotePtr<char*>(
         (uint64_t)(synchro->get_mailbox() ? &synchro->get_mailbox()->name_ : &synchro->mbox_cpy->name_)));
@@ -230,7 +230,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, e_
 
     Remote<kernel::activity::CommImpl> temp_comm;
     mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
-    kernel::activity::CommImpl* comm = temp_comm.get_buffer();
+    const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
 
     char* remote_name;
     mc_model_checker->process().read(
@@ -379,7 +379,7 @@ void CommunicationDeterminismChecker::restoreState()
       break;
 
     int req_num             = state->transition_.argument_;
-    smx_simcall_t saved_req = &state->executed_req_;
+    const s_smx_simcall* saved_req = &state->executed_req_;
     xbt_assert(saved_req);
 
     /* because we got a copy of the executed request, we have to fetch the
index a1485bf..7f5a9d6 100644 (file)
@@ -121,7 +121,7 @@ void LivenessChecker::replay()
 
   /* Intermediate backtracking */
   if(_sg_mc_checkpoint > 0) {
-    Pair* pair = exploration_stack_.back().get();
+    const Pair* pair = exploration_stack_.back().get();
     if (pair->graph_state->system_state_) {
       pair->graph_state->system_state_->restore(&mc_model_checker->process());
       return;
@@ -141,7 +141,7 @@ void LivenessChecker::replay()
 
     if (pair->exploration_started) {
       int req_num             = state->transition_.argument_;
-      smx_simcall_t saved_req = &state->executed_req_;
+      const s_smx_simcall* saved_req = &state->executed_req_;
 
       smx_simcall_t req = nullptr;
 
@@ -183,7 +183,7 @@ int LivenessChecker::insert_visited_pair(std::shared_ptr<VisitedPair> visited_pa
   auto range = boost::range::equal_range(visited_pairs_, visited_pair.get(), DerefAndCompareByActorsCountAndUsedHeap());
 
   for (auto i = range.first; i != range.second; ++i) {
-    VisitedPair* pair_test = i->get();
+    const VisitedPair* pair_test = i->get();
     if (xbt_automaton_state_compare(pair_test->automaton_state, visited_pair->automaton_state) != 0 ||
         *(pair_test->atomic_propositions) != *(visited_pair->atomic_propositions) ||
         not snapshot_equal(pair_test->graph_state->system_state_.get(), visited_pair->graph_state->system_state_.get()))
@@ -408,7 +408,7 @@ void LivenessChecker::run()
     // For each enabled transition in the property automaton, push a
     // (application_state, automaton_state) pair to the exploration stack:
     for (int i = xbt_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
-      xbt_automaton_transition_t transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(
+      const xbt_automaton_transition* transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(
           current_pair->automaton_state->out, i, xbt_automaton_transition_t);
       if (evaluate_label(transition_succ->label, *prop_values))
         exploration_stack_.push_back(this->create_pair(current_pair.get(), transition_succ->dst, prop_values));
index 33d26b8..bb45a97 100644 (file)
@@ -220,7 +220,7 @@ void SafetyChecker::backtrack()
                     SIMIX_simcall_name(prev_state->internal_req_.call_));
           break;
         } else {
-          const smx_actor_t previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req_);
+          const kernel::actor::ActorImpl* previous_issuer = MC_smx_simcall_get_issuer(&prev_state->internal_req_);
           XBT_DEBUG("Simcall %s, process %ld (state %d) and simcall %s, process %ld (state %d) are independent",
                     SIMIX_simcall_name(req->call_), issuer->get_pid(), state->num_,
                     SIMIX_simcall_name(prev_state->internal_req_.call_), previous_issuer->get_pid(), prev_state->num_);
@@ -244,7 +244,7 @@ void SafetyChecker::backtrack()
 void SafetyChecker::restore_state()
 {
   /* Intermediate backtracking */
-  State* last_state = stack_.back().get();
+  const State* last_state = stack_.back().get();
   if (last_state->system_state_) {
     last_state->system_state_->restore(&mc_model_checker->process());
     return;
index 51c00fe..e27e191 100644 (file)
@@ -275,7 +275,7 @@ static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot
 
       /* Try first to associate to same block in the other heap */
       if (heapinfo2->type == heapinfo1->type && state.equals_to_<2>(i1, 0).valid_ == 0) {
-        void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
+        const void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
         if (not heap_area_differ(state, addr_block1, addr_block2, snapshot1, snapshot2, nullptr, nullptr, 0)) {
           for (size_t k = 1; k < heapinfo2->busy_block.size; k++)
             state.equals_to_<2>(i1 + k, 0) = HeapArea(i1, -1);
@@ -287,7 +287,7 @@ static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot
       }
 
       while (i2 < state.heaplimit && not equal) {
-        void* addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
+        const void* addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
 
         if (i2 == i1) {
           i2++;
@@ -337,8 +337,8 @@ static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot
 
         /* Try first to associate to same fragment_ in the other heap */
         if (heapinfo2->type == heapinfo1->type && not state.equals_to_<2>(i1, j1).valid_) {
-          void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
-          void* addr_frag2  = (void*)((char*)addr_block2 + (j1 << heapinfo2->type));
+          const void* addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
+          const void* addr_frag2  = (void*)((char*)addr_block2 + (j1 << heapinfo2->type));
           if (not heap_area_differ(state, addr_frag1, addr_frag2, snapshot1, snapshot2, nullptr, nullptr, 0))
             equal = true;
         }
@@ -367,8 +367,8 @@ static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot
             if (state.equals_to_<2>(i2, j2).valid_)
               continue;
 
-            void* addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
-            void* addr_frag2  = (void*)((char*)addr_block2 + (j2 << heapinfo2b->type));
+            const void* addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
+            const void* addr_frag2  = (void*)((char*)addr_block2 + (j2 << heapinfo2b->type));
 
             if (not heap_area_differ(state, addr_frag1, addr_frag2, snapshot1, snapshot2, nullptr, nullptr, 0)) {
               equal = true;
@@ -530,8 +530,8 @@ static bool heap_area_differ_with_type(StateComparator& state, const void* real_
       return false;
   }
 
-  Type* subtype;
-  Type* subsubtype;
+  const Type* subtype;
+  const Type* subsubtype;
   int elm_size;
   const void* addr_pointed1;
   const void* addr_pointed2;
@@ -654,8 +654,8 @@ static bool heap_area_differ_with_type(StateComparator& state, const void* real_
         } else {
           for (simgrid::mc::Member& member : type->members) {
             // TODO, optimize this? (for the offset case)
-            void* real_member1 = dwarf::resolve_member(real_area1, type, &member, &snapshot1);
-            void* real_member2 = dwarf::resolve_member(real_area2, type, &member, &snapshot2);
+            const void* real_member1 = dwarf::resolve_member(real_area1, type, &member, &snapshot1);
+            const void* real_member2 = dwarf::resolve_member(real_area2, type, &member, &snapshot2);
             if (heap_area_differ_with_type(state, real_member1, real_member2, snapshot1, snapshot2, previous,
                                            member.type, -1, check_ignore, 0))
               return true;
@@ -1011,8 +1011,8 @@ static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const vo
                                    const void* real_area2, const simgrid::mc::Snapshot& snapshot2,
                                    simgrid::mc::Region* region2, simgrid::mc::Type* type, int pointer_level)
 {
-  simgrid::mc::Type* subtype;
-  simgrid::mc::Type* subsubtype;
+  const simgrid::mc::Type* subtype;
+  const simgrid::mc::Type* subsubtype;
   int elm_size;
   int i;
 
@@ -1114,8 +1114,8 @@ static bool areas_differ_with_type(simgrid::mc::StateComparator& state, const vo
     case DW_TAG_structure_type:
     case DW_TAG_class_type:
       for (simgrid::mc::Member& member : type->members) {
-        void* member1                   = simgrid::dwarf::resolve_member(real_area1, type, &member, &snapshot1);
-        void* member2                   = simgrid::dwarf::resolve_member(real_area2, type, &member, &snapshot2);
+        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
         simgrid::mc::Region* subregion2 = snapshot2.get_region(member2, region2); // region2 is hinted
         if (areas_differ_with_type(state, member1, snapshot1, subregion1, member2, snapshot2, subregion2, member.type,
index d456364..9d9dd03 100644 (file)
@@ -100,7 +100,7 @@ void ObjectInformation::remove_global_variable(const char* name)
 
   while (first <= last) {
     size_type cursor                   = first + (last - first) / 2;
-    Variable& current_var              = this->global_variables[cursor];
+    const Variable& current_var        = this->global_variables[cursor];
     int cmp                            = current_var.name.compare(name);
 
     if (cmp == 0) {
@@ -151,7 +151,7 @@ static void remove_local_variable(Frame& scope, const char* var_name, const char
     // Binary search:
     while (start <= end) {
       size_type cursor                   = start + (end - start) / 2;
-      Variable& current_var              = scope.variables[cursor];
+      const Variable& current_var        = scope.variables[cursor];
       int compare                        = current_var.name.compare(var_name);
       if (compare == 0) {
         // Variable found, remove it:
index 74b9f47..c6085b0 100644 (file)
@@ -891,10 +891,10 @@ static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die*
 
 static Elf64_Half get_type(Elf* elf)
 {
-  Elf64_Ehdr* ehdr64 = elf64_getehdr(elf);
+  const Elf64_Ehdr* ehdr64 = elf64_getehdr(elf);
   if (ehdr64)
     return ehdr64->e_type;
-  Elf32_Ehdr* ehdr32 = elf32_getehdr(elf);
+  const Elf32_Ehdr* ehdr32 = elf32_getehdr(elf);
   if (ehdr32)
     return ehdr32->e_type;
   xbt_die("Could not get ELF heeader");
@@ -935,7 +935,7 @@ static std::vector<char> get_build_id(Elf* elf)
   // Iterate over the program headers and find the PT_NOTE ones:
   for (size_t i = 0; i < phnum; ++i) {
     GElf_Phdr phdr_temp;
-    GElf_Phdr* phdr = gelf_getphdr(elf, i, &phdr_temp);
+    const GElf_Phdr* phdr = gelf_getphdr(elf, i, &phdr_temp);
     if (phdr->p_type != PT_NOTE)
       continue;
 
index 82efd56..bcf310c 100644 (file)
@@ -39,7 +39,7 @@ namespace mc {
 int UnwindContext::find_proc_info(unw_addr_space_t /*as*/, unw_word_t ip, unw_proc_info_t* pip, int need_unwind_info,
                                   void* arg) noexcept
 {
-  simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
+  const simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
   return unw_get_accessors(context->process_->unw_underlying_addr_space)
       ->find_proc_info(context->process_->unw_underlying_addr_space, ip, pip, need_unwind_info,
                        context->process_->unw_underlying_context);
@@ -51,7 +51,7 @@ int UnwindContext::find_proc_info(unw_addr_space_t /*as*/, unw_word_t ip, unw_pr
  */
 void UnwindContext::put_unwind_info(unw_addr_space_t /*as*/, unw_proc_info_t* pip, void* arg) noexcept
 {
-  simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
+  const simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
   return unw_get_accessors(context->process_->unw_underlying_addr_space)
       ->put_unwind_info(context->process_->unw_underlying_addr_space, pip, context->process_->unw_underlying_context);
 }
@@ -62,7 +62,7 @@ void UnwindContext::put_unwind_info(unw_addr_space_t /*as*/, unw_proc_info_t* pi
  */
 int UnwindContext::get_dyn_info_list_addr(unw_addr_space_t /*as*/, unw_word_t* dilap, void* arg) noexcept
 {
-  simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
+  const simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
   return unw_get_accessors(context->process_->unw_underlying_addr_space)
       ->get_dyn_info_list_addr(context->process_->unw_underlying_addr_space, dilap,
                                context->process_->unw_underlying_context);
@@ -74,7 +74,7 @@ int UnwindContext::get_dyn_info_list_addr(unw_addr_space_t /*as*/, unw_word_t* d
  */
 int UnwindContext::access_mem(unw_addr_space_t /*as*/, unw_word_t addr, unw_word_t* valp, int write, void* arg) noexcept
 {
-  simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
+  const simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
   if (write)
     return -UNW_EREADONLYREG;
   context->address_space_->read_bytes(valp, sizeof(unw_word_t), remote(addr));
@@ -176,7 +176,7 @@ int UnwindContext::access_reg(unw_addr_space_t /*as*/, unw_regnum_t regnum, unw_
   unw_context_t* context                 = &as_context->unwind_context_;
   if (write)
     return -UNW_EREADONLYREG;
-  greg_t* preg = (greg_t*)get_reg(context, regnum);
+  const greg_t* preg = (greg_t*)get_reg(context, regnum);
   if (not preg)
     return -UNW_EBADREG;
   *valp = *preg;
@@ -188,8 +188,8 @@ int UnwindContext::access_reg(unw_addr_space_t /*as*/, unw_regnum_t regnum, unw_
 int UnwindContext::get_proc_name(unw_addr_space_t /*as*/, unw_word_t addr, char* bufp, size_t buf_len, unw_word_t* offp,
                                  void* arg) noexcept
 {
-  simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
-  simgrid::mc::Frame* frame           = context->process_->find_function(remote(addr));
+  const simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*)arg;
+  const simgrid::mc::Frame* frame           = context->process_->find_function(remote(addr));
   if (not frame)
     return -UNW_ENOINFO;
   *offp = (unw_word_t)frame->range.begin() - addr;
index d75ec4d..979ec4d 100644 (file)
@@ -32,7 +32,7 @@ struct _UPT_info {
  */
 static inline pid_t _UPT_getpid(void* arg)
 {
-  _UPT_info* info = static_cast<_UPT_info*>(arg);
+  const _UPT_info* info = static_cast<_UPT_info*>(arg);
   return info->pid;
 }
 
index c75d927..10c8ec9 100644 (file)
@@ -88,8 +88,8 @@ bool actor_is_enabled(smx_actor_t actor)
 
     case SIMCALL_COMM_WAIT: {
       /* FIXME: check also that src and dst processes are not suspended */
-      simgrid::kernel::activity::CommImpl* act =
-          static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
+      const kernel::activity::CommImpl* act =
+          static_cast<kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(req));
 
       if (act->src_timeout_ || act->dst_timeout_) {
         /* If it has a timeout it will be always be enabled (regardless of who declared the timeout),
@@ -108,7 +108,7 @@ bool actor_is_enabled(smx_actor_t actor)
       simgrid::kernel::activity::CommImpl** comms = simcall_comm_waitany__get__comms(req);
       size_t count                                = simcall_comm_waitany__get__count(req);
       for (unsigned int index = 0; index < count; ++index) {
-        auto* comm = comms[index];
+        auto const* comm = comms[index];
         if (comm->src_actor_ && comm->dst_actor_)
           return true;
       }
@@ -116,7 +116,7 @@ bool actor_is_enabled(smx_actor_t actor)
     }
 
     case SIMCALL_MUTEX_LOCK: {
-      smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
+      const kernel::activity::MutexImpl* mutex = simcall_mutex_lock__get__mutex(req);
 
       if (mutex->owner_ == nullptr)
         return true;
index 9fc50cb..126c074 100644 (file)
@@ -57,11 +57,11 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2)
     return false;
 
   // Those are internal requests, we do not need indirection because those objects are copies:
-  kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
-  kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
+  const kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
+  const kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
 
   if ((r1->call_ == SIMCALL_COMM_ISEND || r1->call_ == SIMCALL_COMM_IRECV) && r2->call_ == SIMCALL_COMM_WAIT) {
-    smx_mailbox_t mbox = MC_get_mbox(r1);
+    const kernel::activity::MailboxImpl* mbox = MC_get_mbox(r1);
 
     if (mbox != synchro2->mbox_cpy
         && simcall_comm_wait__get__timeout(r2) <= 0)
@@ -124,8 +124,8 @@ bool request_depend(smx_simcall_t req1, smx_simcall_t req2)
     return request_depend_asymmetric(req1, req2) && request_depend_asymmetric(req2, req1);
 
   // Those are internal requests, we do not need indirection because those objects are copies:
-  kernel::activity::CommImpl* synchro1 = MC_get_comm(req1);
-  kernel::activity::CommImpl* synchro2 = MC_get_comm(req2);
+  const kernel::activity::CommImpl* synchro1 = MC_get_comm(req1);
+  const kernel::activity::CommImpl* synchro2 = MC_get_comm(req2);
 
   switch (req1->call_) {
     case SIMCALL_COMM_ISEND:
@@ -237,7 +237,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
         p    = pointer_to_string(remote_act);
 
         simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
-        simgrid::kernel::activity::CommImpl* act;
+        const simgrid::kernel::activity::CommImpl* act;
         if (use_remote_comm) {
           mc_model_checker->process().read(temp_synchro,
                                            remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
@@ -261,7 +261,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
       simgrid::kernel::activity::CommImpl* remote_act =
           static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__getraw__comm(req));
       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
-      simgrid::kernel::activity::CommImpl* act;
+      const simgrid::kernel::activity::CommImpl* act;
       if (use_remote_comm) {
         mc_model_checker->process().read(temp_synchro,
                                          remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
@@ -381,7 +381,7 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
 
   Remote<kernel::activity::CommImpl> temp_comm;
   mc_model_checker->process().read(temp_comm, remote(remote_act));
-  kernel::activity::CommImpl* comm = temp_comm.get_buffer();
+  const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
   return comm->src_actor_.get() && comm->dst_actor_.get();
 }
 
@@ -431,10 +431,12 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
         kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
         Remote<kernel::activity::CommImpl> temp_comm;
         mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
-        kernel::activity::CommImpl* comm = temp_comm.get_buffer();
+        const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
 
-        smx_actor_t src_proc = mc_model_checker->process().resolve_actor(mc::remote(comm->src_actor_.get()));
-        smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(mc::remote(comm->dst_actor_.get()));
+        const kernel::actor::ActorImpl* src_proc =
+            mc_model_checker->process().resolve_actor(mc::remote(comm->src_actor_.get()));
+        const kernel::actor::ActorImpl* dst_proc =
+            mc_model_checker->process().resolve_actor(mc::remote(comm->dst_actor_.get()));
         if (issuer->get_host())
           label =
               xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
@@ -449,7 +451,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
       kernel::activity::ActivityImpl* remote_act = simcall_comm_test__getraw__comm(req);
       Remote<simgrid::kernel::activity::CommImpl> temp_comm;
       mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
-      kernel::activity::CommImpl* comm = temp_comm.get_buffer();
+      const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
       if (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr) {
         if (issuer->get_host())
           label = xbt::string_printf("[(%ld)%s] Test FALSE", issuer->get_pid(), MC_smx_actor_get_host_name(issuer));
index e57e6bd..e6ffc00 100644 (file)
@@ -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();
 
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClient* 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)
 {
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
+  const simgrid::mc::RemoteClient* process = &mc_model_checker->process();
   if (mc_model_checker == nullptr)
     return actor->get_cname();
 
index 5670d07..65d07ed 100644 (file)
@@ -112,7 +112,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
           remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(&actor->simcall)));
       simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
       mc_model_checker->process().read(temp_act, remote_act);
-      simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
+      const simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
       if (act->src_actor_.get() && act->dst_actor_.get())
         state->transition_.argument_ = 0; // OK
       else if (act->src_actor_.get() == nullptr && act->type_ == simgrid::kernel::activity::CommImpl::Type::READY &&
index 585ed0c..8d7b915 100644 (file)
@@ -38,7 +38,7 @@ Client* Client::initialize()
   _sg_do_model_check = 1;
 
   // Fetch socket from MC_ENV_SOCKET_FD:
-  char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
+  const char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
   if (not fd_env)
     xbt_die("No MC socket passed in the environment");
   int fd =
@@ -183,7 +183,7 @@ void Client::ignore_memory(void* addr, std::size_t size)
 
 void Client::ignore_heap(void* address, std::size_t size)
 {
-  xbt_mheap_t heap = mmalloc_get_current_heap();
+  const mdesc* heap = mmalloc_get_current_heap();
 
   s_mc_message_ignore_heap_t message;
   message.type    = MC_MESSAGE_IGNORE_HEAP;
@@ -227,7 +227,7 @@ void Client::declare_symbol(const char* name, int* value)
 
 void Client::declare_stack(void* stack, size_t size, ucontext_t* context)
 {
-  xbt_mheap_t heap = mmalloc_get_current_heap();
+  const mdesc* heap = mmalloc_get_current_heap();
 
   s_stack_region_t region;
   memset(&region, 0, sizeof(region));
index 940d9f9..e373e3d 100644 (file)
@@ -435,7 +435,7 @@ std::string RemoteClient::read_string(RemotePtr<char> address) const
       continue;
     xbt_assert(c > 0, "Could not read string from remote process");
 
-    void* p = memchr(res.data() + off, '\0', c);
+    const void* p = memchr(res.data() + off, '\0', c);
     if (p)
       return std::string(res.data());
 
@@ -487,7 +487,7 @@ void RemoteClient::ignore_region(std::uint64_t addr, std::size_t size)
   }
 
   unsigned int cursor           = 0;
-  IgnoredRegion* current_region = nullptr;
+  const IgnoredRegion* current_region = nullptr;
 
   int start = 0;
   int end   = ignored_regions_.size() - 1;
@@ -536,7 +536,7 @@ void RemoteClient::ignore_heap(IgnoredHeapRegion const& region)
   size_type cursor;
   while (start <= end) {
     cursor               = start + (end - start) / 2;
-    auto& current_region = ignored_heap_[cursor];
+    auto const& current_region = ignored_heap_[cursor];
     if (current_region.address == region.address)
       return;
     else if (current_region.address < region.address)
@@ -565,7 +565,7 @@ void RemoteClient::unignore_heap(void* address, size_t size)
   size_type cursor;
   while (start <= end) {
     cursor       = (start + end) / 2;
-    auto& region = ignored_heap_[cursor];
+    auto const& region = ignored_heap_[cursor];
     if (region.address < address)
       start = cursor + 1;
     else if ((char*)region.address <= ((char*)address + size)) {
index 9d04b83..41c8b1b 100644 (file)
@@ -76,7 +76,7 @@ void* Region::read(void* target, const void* addr, std::size_t size)
 
   // Read each page:
   while (simgrid::mc::mmu::split((std::uintptr_t)addr).first != page_end) {
-    void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, this);
+    const void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, this);
     void* next_page     = (void*)simgrid::mc::mmu::join(simgrid::mc::mmu::split((std::uintptr_t)addr).first + 1, 0);
     size_t readable     = (char*)next_page - (const char*)addr;
     memcpy(dest, snapshot_addr, readable);
@@ -86,7 +86,7 @@ void* Region::read(void* target, const void* addr, std::size_t size)
   }
 
   // Read the end:
-  void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, this);
+  const void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, this);
   memcpy(dest, snapshot_addr, size);
 
   return target;
index de20ddd..047ae88 100644 (file)
@@ -23,7 +23,7 @@ void Snapshot::snapshot_regions(RemoteClient* process)
   for (auto const& object_info : process->object_infos)
     add_region(RegionType::Data, object_info.get(), object_info->start_rw, object_info->end_rw - object_info->start_rw);
 
-  xbt_mheap_t heap = process->get_heap();
+  const mdesc* heap = process->get_heap();
   void* start_heap = heap->base;
   void* end_heap   = heap->breakval;
 
@@ -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)
 {
-  RemoteClient* process = &mc_model_checker->process();
+  const RemoteClient* process = &mc_model_checker->process();
   std::vector<s_mc_stack_frame_t> result;
 
   unw_cursor_t c = stack_context->cursor();
index 6741084..92ea945 100644 (file)
@@ -66,7 +66,7 @@ public:
   /* Regular use */
   bool on_heap(const void* address) const
   {
-    const xbt_mheap_t heap = process()->get_heap();
+    const mdesc* heap = process()->get_heap();
     return address >= heap->heapbase && address < heap->breakval;
   }