Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace redundant type with "auto" (src/mc/).
[simgrid.git] / src / mc / inspect / mc_unw_vmread.cpp
index 5f2acba2898feb4b631e50d16f4bfe690a73e7e6..f44e404f5ecdf6a1c5f20eeb33a603b6b390c0c4 100644 (file)
@@ -1,10 +1,10 @@
-/* Copyright (c) 2015-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2020. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * 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/RemoteSimulation.hpp"
 
 #include <sys/types.h>
 #include <sys/uio.h>
@@ -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;
 }
 
@@ -66,8 +66,8 @@ static int access_mem(const unw_addr_space_t as, const unw_word_t addr, unw_word
   // On recent kernels, we do not need to ptrace the target process.
   // On older kernels, it is necessary to ptrace the target process.
   size_t count = size;
-  off_t off    = (off_t)addr;
-  char* buf    = (char*)valp;
+  auto off     = static_cast<off_t>(addr);
+  auto* buf    = reinterpret_cast<char*>(valp);
   int fd       = simgrid::mc::open_vm(pid, O_RDONLY);
   if (fd < 0)
     return -UNW_EINVAL;
@@ -100,7 +100,7 @@ namespace unw {
  *  does not use ptrace() to read the target process memory by
  *  `process_vm_readv()` or `/dev/${pid}/mem` if possible.
  *
- *  Does not support any MC-specific behaviour (privatization, snapshots)
+ *  Does not support any MC-specific behavior (privatization, snapshots)
  *  and `ucontext_t`.
  *
  *  It works with `void*` contexts allocated with `_UPT_create(pid)`.