X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/056b1668e0d3af35c8d35b88694a65c23fbbd6ca..7c71e60dc8020a0a89f5ca36bd6487ed30a749d7:/src/mc/remote/RemoteProcess.hpp diff --git a/src/mc/remote/RemoteProcess.hpp b/src/mc/remote/RemoteProcess.hpp index a183c93266..4dc3dfd9bb 100644 --- a/src/mc/remote/RemoteProcess.hpp +++ b/src/mc/remote/RemoteProcess.hpp @@ -1,6 +1,6 @@ /* mc::RemoteClient: representative of the Client memory on the MC side */ -/* Copyright (c) 2008-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2008-2022. 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. */ @@ -18,8 +18,7 @@ #include #include -namespace simgrid { -namespace mc { +namespace simgrid::mc { class ActorInformation { public: @@ -51,16 +50,12 @@ struct IgnoredHeapRegion { std::size_t size; }; -/** The Application's process memory, seen from the MCer perspective - * - * This class is mixing a lot of different responsibilities and is tied - * to SIMIX. It should probably be split into different classes. +/** The Application's process memory, seen from the Checker perspective * * Responsibilities: * * - reading from the process memory (`AddressSpace`); * - accessing the system state of the process (heap, …); - * - storing the SIMIX state of the process; * - privatization; * - stack unwinding; * - etc. @@ -72,12 +67,11 @@ private: static constexpr int cache_none = 0; static constexpr int cache_heap = 1; static constexpr int cache_malloc = 2; - static constexpr int cache_simix_processes = 4; public: explicit RemoteProcess(pid_t pid); ~RemoteProcess() override; - void init(xbt_mheap_t mmalloc_default_mdp, unsigned long* maxpid, xbt_dynar_t actors, xbt_dynar_t dead_actors); + void init(xbt_mheap_t mmalloc_default_mdp, unsigned long* maxpid); RemoteProcess(RemoteProcess const&) = delete; RemoteProcess(RemoteProcess&&) = delete; @@ -131,6 +125,8 @@ public: this->refresh_malloc_info(); return this->heap_info.data(); } + /* Get the amount of memory mallocated in the remote process (requires mmalloc) */ + std::size_t get_remote_heap_bytes(); void clear_cache() { this->cache_flags_ = RemoteProcess::cache_none; } @@ -169,39 +165,8 @@ public: private: // Cache the address of the variables we read directly in the memory of remote RemotePtr maxpid_addr_; - RemotePtr actors_addr_; - RemotePtr dead_actors_addr_; public: - std::vector& actors(); - std::vector& dead_actors(); - - /** Get a local description of a remote SIMIX actor */ - ActorInformation* resolve_actor_info(RemotePtr actor) - { - xbt_assert(mc_model_checker != nullptr); - if (not actor) - return nullptr; - this->refresh_simix(); - for (auto& actor_info : this->smx_actors_infos) - if (actor_info.address == actor) - return &actor_info; - for (auto& actor_info : this->smx_dead_actors_infos) - if (actor_info.address == actor) - return &actor_info; - return nullptr; - } - - /** Get a local copy of the SIMIX actor structure */ - kernel::actor::ActorImpl* resolve_actor(RemotePtr process) - { - ActorInformation* actor_info = this->resolve_actor_info(process); - if (actor_info) - return actor_info->copy.get_buffer(); - else - return nullptr; - } - unsigned long get_maxpid() const { return this->read(maxpid_addr_); } void dump_stack() const; @@ -210,7 +175,6 @@ private: void init_memory_map_info(); void refresh_heap(); void refresh_malloc_info(); - void refresh_simix(); pid_t pid_ = -1; bool running_ = false; @@ -222,19 +186,6 @@ private: std::vector stack_areas_; std::vector ignored_heap_; - // Copies of MCed SMX data structures - /** Copy of `EngineImpl::actor_list_` - * - * See mc_smx.cpp. - */ - std::vector smx_actors_infos; - - /** Copy of `EngineImpl::actors_to_destroy_` - * - * See mc_smx.cpp. - */ - std::vector smx_dead_actors_infos; - /** State of the cache (which variables are up to date) */ int cache_flags_ = RemoteProcess::cache_none; @@ -253,7 +204,7 @@ public: * This is not used if the process is the current one: * use `get_heap_info()` in order to use it. */ - std::unique_ptr heap; + std::unique_ptr heap = std::make_unique(); /** Copy of the allocation info structure * @@ -287,7 +238,6 @@ public: /** Open a FD to a remote process memory (`/dev/$pid/mem`) */ XBT_PRIVATE int open_vm(pid_t pid, int flags); -} // namespace mc -} // namespace simgrid +} // namespace simgrid::mc #endif