From 09abefeb928cd7ea4679407a6b4387d4f75beaa9 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 14 Mar 2021 00:19:04 +0100 Subject: [PATCH] Rename mc::RemoteSimulation into mc::RemoteProcess --- MANIFEST.in | 4 +- src/mc/AddressSpace.hpp | 6 +- src/mc/ModelChecker.cpp | 31 +++++----- src/mc/ModelChecker.hpp | 8 +-- src/mc/Session.cpp | 2 +- src/mc/api.cpp | 8 +-- src/mc/compare.cpp | 8 +-- src/mc/inspect/ObjectInformation.hpp | 2 +- src/mc/inspect/mc_dwarf.cpp | 4 +- src/mc/inspect/mc_unw.cpp | 4 +- src/mc/inspect/mc_unw.hpp | 4 +- src/mc/inspect/mc_unw_vmread.cpp | 2 +- src/mc/mc_base.cpp | 2 +- src/mc/mc_forward.hpp | 2 +- src/mc/mc_request.cpp | 2 +- src/mc/mc_smx.cpp | 10 ++-- src/mc/remote/AppSide.cpp | 2 +- ...RemoteSimulation.cpp => RemoteProcess.cpp} | 59 +++++++++---------- ...RemoteSimulation.hpp => RemoteProcess.hpp} | 22 +++---- src/mc/sosp/Region.cpp | 2 +- src/mc/sosp/Snapshot.cpp | 10 ++-- src/mc/sosp/Snapshot.hpp | 10 ++-- src/mc/sosp/Snapshot_test.cpp | 6 +- .../mc/dwarf-expression/dwarf-expression.cpp | 4 +- teshsuite/mc/dwarf/dwarf.cpp | 8 +-- tools/cmake/DefinePackages.cmake | 4 +- 26 files changed, 112 insertions(+), 114 deletions(-) rename src/mc/remote/{RemoteSimulation.cpp => RemoteProcess.cpp} (88%) rename src/mc/remote/{RemoteSimulation.hpp => RemoteProcess.hpp} (92%) diff --git a/MANIFEST.in b/MANIFEST.in index c4d738fdaa..b1bc14f93b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2280,9 +2280,9 @@ include src/mc/remote/Channel.cpp include src/mc/remote/Channel.hpp include src/mc/remote/CheckerSide.cpp include src/mc/remote/CheckerSide.hpp +include src/mc/remote/RemoteProcess.cpp +include src/mc/remote/RemoteProcess.hpp include src/mc/remote/RemotePtr.hpp -include src/mc/remote/RemoteSimulation.cpp -include src/mc/remote/RemoteSimulation.hpp include src/mc/remote/mc_protocol.h include src/mc/sosp/ChunkedData.cpp include src/mc/sosp/ChunkedData.hpp diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index f05725bb7b..fd136eb158 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -84,17 +84,17 @@ public: */ class AddressSpace { private: - RemoteSimulation* remote_simulation_; + RemoteProcess* remote_process_; public: - explicit AddressSpace(RemoteSimulation* remote_simulation) : remote_simulation_(remote_simulation) {} + explicit AddressSpace(RemoteProcess* remote_simulation) : remote_process_(remote_simulation) {} virtual ~AddressSpace() = default; /** The process of this address space * * This is where we can get debug information, memory layout, etc. */ - simgrid::mc::RemoteSimulation* get_remote_simulation() const { return remote_simulation_; } + simgrid::mc::RemoteProcess* get_remote_simulation() const { return remote_process_; } /** Read data from the address space * diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index 141400a9e8..5da95f6294 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -10,7 +10,7 @@ #include "src/mc/mc_config.hpp" #include "src/mc/mc_exit.hpp" #include "src/mc/mc_private.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include "xbt/automaton.hpp" #include "xbt/system_error.hpp" @@ -33,8 +33,8 @@ using simgrid::mc::remote; namespace simgrid { namespace mc { -ModelChecker::ModelChecker(std::unique_ptr remote_simulation, int sockfd) - : checker_side_(sockfd), remote_simulation_(std::move(remote_simulation)) +ModelChecker::ModelChecker(std::unique_ptr remote_simulation, int sockfd) + : checker_side_(sockfd), remote_process_(std::move(remote_simulation)) { } @@ -62,13 +62,13 @@ void ModelChecker::start() int status; // The model-checked process SIGSTOP itself to signal it's ready: - const pid_t pid = remote_simulation_->pid(); + const pid_t pid = remote_process_->pid(); pid_t res = waitpid(pid, &status, WAITPID_CHECKED_FLAGS); if (res < 0 || not WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP) xbt_die("Could not wait model-checked process"); - remote_simulation_->init(); + remote_process_->init(); if (not _sg_mc_dot_output_file.get().empty()) MC_init_dot_output(); @@ -95,7 +95,7 @@ static constexpr auto ignored_local_variables = { void ModelChecker::setup_ignore() { - const RemoteSimulation& process = this->get_remote_simulation(); + const RemoteProcess& process = this->get_remote_simulation(); for (auto const& var : ignored_local_variables) process.ignore_local_variable(var.first, var.second); @@ -107,7 +107,7 @@ void ModelChecker::shutdown() { XBT_DEBUG("Shutting down model-checker"); - RemoteSimulation* process = &this->get_remote_simulation(); + RemoteProcess* process = &this->get_remote_simulation(); if (process->running()) { XBT_DEBUG("Killing process"); kill(process->pid(), SIGKILL); @@ -115,7 +115,7 @@ void ModelChecker::shutdown() } } -void ModelChecker::resume(RemoteSimulation& process) +void ModelChecker::resume(RemoteProcess& process) { int res = checker_side_.get_channel().send(MessageType::CONTINUE); if (res) @@ -213,7 +213,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) if (property_automaton == nullptr) property_automaton = xbt_automaton_new(); - const RemoteSimulation* process = &this->get_remote_simulation(); + const RemoteProcess* process = &this->get_remote_simulation(); RemotePtr address = remote((int*)message.data); xbt::add_proposition(property_automaton, message.name.data(), [process, address]() { return process->read(address); }); @@ -264,8 +264,7 @@ void ModelChecker::handle_waitpid() // From PTRACE_O_TRACEEXIT: #ifdef __linux__ if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) { - xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_simulation_->pid(), 0, &status) != -1, - "Could not get exit status"); + xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status) != -1, "Could not get exit status"); if (WIFSIGNALED(status)) { MC_report_crash(status); mc_model_checker->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH); @@ -278,9 +277,9 @@ void ModelChecker::handle_waitpid() XBT_DEBUG("Stopped with signal %i", (int) WSTOPSIG(status)); errno = 0; #ifdef __linux__ - ptrace(PTRACE_CONT, remote_simulation_->pid(), 0, WSTOPSIG(status)); + ptrace(PTRACE_CONT, remote_process_->pid(), 0, WSTOPSIG(status)); #elif defined BSD - ptrace(PT_CONTINUE, remote_simulation_->pid(), (caddr_t)1, WSTOPSIG(status)); + ptrace(PT_CONTINUE, remote_process_->pid(), (caddr_t)1, WSTOPSIG(status)); #endif xbt_assert(errno == 0, "Could not PTRACE_CONT"); } @@ -311,8 +310,8 @@ void ModelChecker::handle_simcall(Transition const& transition) m.pid_ = transition.pid_; m.times_considered_ = transition.times_considered_; checker_side_.get_channel().send(m); - this->remote_simulation_->clear_cache(); - if (this->remote_simulation_->running()) + this->remote_process_->clear_cache(); + if (this->remote_process_->running()) checker_side_.dispatch(); } bool ModelChecker::simcall_is_visible(int aid) @@ -336,7 +335,7 @@ bool ModelChecker::simcall_is_visible(int aid) XBT_DEBUG("is_visible(%d) is returning %s", aid, answer.value ? "true" : "false"); - this->remote_simulation_->clear_cache(); + this->remote_process_->clear_cache(); return answer.value; } diff --git a/src/mc/ModelChecker.hpp b/src/mc/ModelChecker.hpp index 99aa60dcd2..aade1c288b 100644 --- a/src/mc/ModelChecker.hpp +++ b/src/mc/ModelChecker.hpp @@ -25,7 +25,7 @@ class ModelChecker { std::set> hostnames_; // This is the parent snapshot of the current state: PageStore page_store_{500}; - std::unique_ptr remote_simulation_; + std::unique_ptr remote_process_; Checker* checker_ = nullptr; // Expect MessageType::SIMCALL_TO_STRING or MessageType::SIMCALL_DOT_LABEL @@ -34,9 +34,9 @@ class ModelChecker { public: ModelChecker(ModelChecker const&) = delete; ModelChecker& operator=(ModelChecker const&) = delete; - explicit ModelChecker(std::unique_ptr remote_simulation, int sockfd); + explicit ModelChecker(std::unique_ptr remote_simulation, int sockfd); - RemoteSimulation& get_remote_simulation() { return *remote_simulation_; } + RemoteProcess& get_remote_simulation() { return *remote_process_; } Channel& channel() { return checker_side_.get_channel(); } PageStore& page_store() { @@ -50,7 +50,7 @@ public: void start(); void shutdown(); - void resume(simgrid::mc::RemoteSimulation& get_remote_simulation); + void resume(simgrid::mc::RemoteProcess& get_remote_simulation); void wait_for_requests(); void handle_simcall(Transition const& transition); diff --git a/src/mc/Session.cpp b/src/mc/Session.cpp index 0677662b1d..401346b2ac 100644 --- a/src/mc/Session.cpp +++ b/src/mc/Session.cpp @@ -86,7 +86,7 @@ Session::Session(const std::function& code) xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?"); - auto process = std::make_unique(pid); + auto process = std::make_unique(pid); model_checker_ = std::make_unique(std::move(process), sockets[1]); mc_model_checker = model_checker_.get(); diff --git a/src/mc/api.cpp b/src/mc/api.cpp index 68310531c6..f95a8b2b7c 100644 --- a/src/mc/api.cpp +++ b/src/mc/api.cpp @@ -9,7 +9,7 @@ #include "src/mc/mc_exit.hpp" #include "src/mc/mc_pattern.hpp" #include "src/mc/mc_private.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include @@ -333,7 +333,7 @@ xbt::string const& Api::get_actor_host_name(smx_actor_t actor) const if (mc_model_checker == nullptr) return actor->get_host()->get_name(); - const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation(); + const simgrid::mc::RemoteProcess* process = &mc_model_checker->get_remote_simulation(); // Read the simgrid::xbt::string in the MCed process: simgrid::mc::ActorInformation* info = actor_info_cast(actor); @@ -354,7 +354,7 @@ std::string Api::get_actor_name(smx_actor_t actor) const simgrid::mc::ActorInformation* info = actor_info_cast(actor); if (info->name.empty()) { - const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation(); + const simgrid::mc::RemoteProcess* process = &mc_model_checker->get_remote_simulation(); simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name_); info->name = process->read_string(remote(string_data.data), string_data.len); @@ -540,7 +540,7 @@ smx_actor_t Api::get_dst_actor(RemotePtr const& comm std::size_t Api::get_remote_heap_bytes() const { - RemoteSimulation& process = mc_model_checker->get_remote_simulation(); + RemoteProcess& process = mc_model_checker->get_remote_simulation(); auto heap_bytes_used = mmalloc_get_bytes_used_remote(process.get_heap()->heaplimit, process.get_malloc_info()); return heap_bytes_used; } diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index f97b59899d..15cecb72da 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -207,7 +207,7 @@ static bool heap_area_differ(StateComparator& state, const void* area1, const vo static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot1, const Snapshot& snapshot2) { - const RemoteSimulation& process = mc_model_checker->get_remote_simulation(); + const RemoteProcess& process = mc_model_checker->get_remote_simulation(); /* Check busy blocks */ size_t i1 = 1; @@ -435,7 +435,7 @@ static bool heap_area_differ_without_type(StateComparator& state, const void* re const Snapshot& snapshot1, const Snapshot& snapshot2, HeapLocationPairs* previous, int size, int check_ignore) { - const RemoteSimulation& process = mc_model_checker->get_remote_simulation(); + const RemoteProcess& process = mc_model_checker->get_remote_simulation(); const Region* heap_region1 = MC_get_heap_region(snapshot1); const Region* heap_region2 = MC_get_heap_region(snapshot2); @@ -721,7 +721,7 @@ static Type* get_offset_type(void* real_base_address, Type* type, int offset, in static bool heap_area_differ(StateComparator& state, const void* area1, const void* area2, const Snapshot& snapshot1, const Snapshot& snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level) { - const simgrid::mc::RemoteSimulation& process = mc_model_checker->get_remote_simulation(); + const simgrid::mc::RemoteProcess& process = mc_model_checker->get_remote_simulation(); ssize_t block1; ssize_t block2; @@ -1188,7 +1188,7 @@ bool snapshot_equal(const Snapshot* s1, const Snapshot* s2) // TODO, make this a field of ModelChecker or something similar static StateComparator state_comparator; - const RemoteSimulation& process = mc_model_checker->get_remote_simulation(); + const RemoteProcess& process = mc_model_checker->get_remote_simulation(); if (s1->hash_ != s2->hash_) { XBT_VERB("(%d - %d) Different hash: 0x%" PRIx64 "--0x%" PRIx64, s1->num_state_, s2->num_state_, s1->hash_, diff --git a/src/mc/inspect/ObjectInformation.hpp b/src/mc/inspect/ObjectInformation.hpp index 9586e5570e..eb5e219f14 100644 --- a/src/mc/inspect/ObjectInformation.hpp +++ b/src/mc/inspect/ObjectInformation.hpp @@ -157,7 +157,7 @@ XBT_PRIVATE std::shared_ptr createObjectInformation(std::vect const char* name); /** Augment the current module with information about the other ones */ -XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteSimulation* process, +XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteProcess* process, simgrid::mc::ObjectInformation* info); } // namespace mc } // namespace simgrid diff --git a/src/mc/inspect/mc_dwarf.cpp b/src/mc/inspect/mc_dwarf.cpp index 646ecc1305..a11a069d7a 100644 --- a/src/mc/inspect/mc_dwarf.cpp +++ b/src/mc/inspect/mc_dwarf.cpp @@ -13,7 +13,7 @@ #include "src/mc/inspect/Variable.hpp" #include "src/mc/inspect/mc_dwarf.hpp" #include "src/mc/mc_private.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include @@ -1164,7 +1164,7 @@ std::shared_ptr createObjectInformation(std::vectortypes) { Type* type = &(t.second); diff --git a/src/mc/inspect/mc_unw.cpp b/src/mc/inspect/mc_unw.cpp index 8f37ddb5e1..b5c5a07b33 100644 --- a/src/mc/inspect/mc_unw.cpp +++ b/src/mc/inspect/mc_unw.cpp @@ -12,7 +12,7 @@ #include "src/mc/inspect/mc_unw.hpp" #include "src/mc/inspect/Frame.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include @@ -221,7 +221,7 @@ unw_addr_space_t UnwindContext::createUnwindAddressSpace() return unw_create_addr_space(&accessors, BYTE_ORDER); } -void UnwindContext::initialize(simgrid::mc::RemoteSimulation* process, unw_context_t* c) +void UnwindContext::initialize(simgrid::mc::RemoteProcess* process, unw_context_t* c) { this->address_space_ = process; this->process_ = process; diff --git a/src/mc/inspect/mc_unw.hpp b/src/mc/inspect/mc_unw.hpp index 4dc94d6625..462486a3f6 100644 --- a/src/mc/inspect/mc_unw.hpp +++ b/src/mc/inspect/mc_unw.hpp @@ -44,11 +44,11 @@ namespace mc { class UnwindContext { simgrid::mc::AddressSpace* address_space_ = nullptr; - simgrid::mc::RemoteSimulation* process_ = nullptr; + simgrid::mc::RemoteProcess* process_ = nullptr; unw_context_t unwind_context_ = {}; public: - void initialize(simgrid::mc::RemoteSimulation* process, unw_context_t* c); + void initialize(simgrid::mc::RemoteProcess* process, unw_context_t* c); unw_cursor_t cursor(); private: // Methods and virtual table for libunwind diff --git a/src/mc/inspect/mc_unw_vmread.cpp b/src/mc/inspect/mc_unw_vmread.cpp index b79000aa58..935b8ae5dd 100644 --- a/src/mc/inspect/mc_unw_vmread.cpp +++ b/src/mc/inspect/mc_unw_vmread.cpp @@ -4,7 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/mc/inspect/mc_unw.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 21c2e8cdaf..b4564677a1 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -17,7 +17,7 @@ #if SIMGRID_HAVE_MC #include "src/mc/ModelChecker.hpp" #include "src/mc/Session.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" using simgrid::mc::remote; #endif diff --git a/src/mc/mc_forward.hpp b/src/mc/mc_forward.hpp index 4dfc4d5075..48d6b2f001 100644 --- a/src/mc/mc_forward.hpp +++ b/src/mc/mc_forward.hpp @@ -18,7 +18,7 @@ class PageStore; class ChunkedData; class ModelChecker; class AddressSpace; -class RemoteSimulation; +class RemoteProcess; class Snapshot; class ObjectInformation; class Member; diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index 6c271aabb8..479bcb635b 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -9,7 +9,7 @@ #include "src/kernel/activity/MutexImpl.hpp" #include "src/mc/ModelChecker.hpp" #include "src/mc/checker/SimcallObserver.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index a1b7d6c0a9..abb9d42c86 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -6,7 +6,7 @@ #include "simgrid/s4u/Host.hpp" #include "src/mc/ModelChecker.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" using simgrid::mc::remote; /** @file @@ -35,7 +35,7 @@ using simgrid::mc::remote; * @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(const simgrid::mc::RemoteSimulation* process, +static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteProcess* process, std::vector& target, simgrid::mc::RemotePtr remote_dynar) { @@ -61,9 +61,9 @@ static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteSimula namespace simgrid { namespace mc { -void RemoteSimulation::refresh_simix() +void RemoteProcess::refresh_simix() { - if (this->cache_flags_ & RemoteSimulation::cache_simix_processes) + if (this->cache_flags_ & RemoteProcess::cache_simix_processes) return; // TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global` @@ -85,7 +85,7 @@ void RemoteSimulation::refresh_simix() MC_process_refresh_simix_actor_dynar(this, this->smx_dead_actors_infos, remote(simix_global.get_buffer()->dead_actors_vector)); - this->cache_flags_ |= RemoteSimulation::cache_simix_processes; + this->cache_flags_ |= RemoteProcess::cache_simix_processes; } } diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index 91be2f5b1a..7448d7ce99 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -7,7 +7,7 @@ #include "src/internal_config.h" #include "src/kernel/actor/ActorImpl.hpp" #include "src/mc/checker/SimcallObserver.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include diff --git a/src/mc/remote/RemoteSimulation.cpp b/src/mc/remote/RemoteProcess.cpp similarity index 88% rename from src/mc/remote/RemoteSimulation.cpp rename to src/mc/remote/RemoteProcess.cpp index 2d6d919bcd..0899bd7069 100644 --- a/src/mc/remote/RemoteSimulation.cpp +++ b/src/mc/remote/RemoteProcess.cpp @@ -5,7 +5,7 @@ #define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */ -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include "src/mc/sosp/Snapshot.hpp" #include "xbt/file.hpp" @@ -227,11 +227,11 @@ int open_vm(pid_t pid, int flags) return open(buffer.c_str(), flags); } -// ***** RemoteSimulation +// ***** RemoteProcess -RemoteSimulation::RemoteSimulation(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {} +RemoteProcess::RemoteProcess(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {} -void RemoteSimulation::init() +void RemoteProcess::init() { this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_); this->init_memory_map_info(); @@ -253,7 +253,7 @@ void RemoteSimulation::init() this->unw_underlying_context = simgrid::unw::create_context(this->unw_underlying_addr_space, this->pid_); } -RemoteSimulation::~RemoteSimulation() +RemoteProcess::~RemoteProcess() { if (this->memory_file >= 0) close(this->memory_file); @@ -273,13 +273,13 @@ RemoteSimulation::~RemoteSimulation() * Do not use directly, this is used by the getters when appropriate * in order to have fresh data. */ -void RemoteSimulation::refresh_heap() +void RemoteProcess::refresh_heap() { // Read/dereference/refresh the std_heap pointer: if (not this->heap) this->heap = std::make_unique(); this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address)); - this->cache_flags_ |= RemoteSimulation::cache_heap; + this->cache_flags_ |= RemoteProcess::cache_heap; } /** Refresh the information about the process @@ -287,26 +287,26 @@ void RemoteSimulation::refresh_heap() * Do not use directly, this is used by the getters when appropriate * in order to have fresh data. * */ -void RemoteSimulation::refresh_malloc_info() +void RemoteProcess::refresh_malloc_info() { // Refresh process->heapinfo: - if (this->cache_flags_ & RemoteSimulation::cache_malloc) + if (this->cache_flags_ & RemoteProcess::cache_malloc) return; size_t count = this->heap->heaplimit + 1; if (this->heap_info.size() < count) this->heap_info.resize(count); this->read_bytes(this->heap_info.data(), count * sizeof(malloc_info), remote(this->heap->heapinfo)); - this->cache_flags_ |= RemoteSimulation::cache_malloc; + this->cache_flags_ |= RemoteProcess::cache_malloc; } /** @brief Finds the range of the different memory segments and binary paths */ -void RemoteSimulation::init_memory_map_info() +void RemoteProcess::init_memory_map_info() { XBT_DEBUG("Get debug information ..."); this->maestro_stack_start_ = nullptr; this->maestro_stack_end_ = nullptr; this->object_infos.resize(0); - this->binary_info = nullptr; + this->binary_info = nullptr; std::vector const& maps = this->memory_map_; @@ -367,7 +367,7 @@ void RemoteSimulation::init_memory_map_info() XBT_DEBUG("Get debug information done !"); } -std::shared_ptr RemoteSimulation::find_object_info(RemotePtr addr) const +std::shared_ptr RemoteProcess::find_object_info(RemotePtr addr) const { for (auto const& object_info : this->object_infos) if (addr.address() >= (std::uint64_t)object_info->start && addr.address() <= (std::uint64_t)object_info->end) @@ -375,7 +375,7 @@ std::shared_ptr RemoteSimulation::find_object_in return nullptr; } -std::shared_ptr RemoteSimulation::find_object_info_exec(RemotePtr addr) const +std::shared_ptr RemoteProcess::find_object_info_exec(RemotePtr addr) const { for (std::shared_ptr const& info : this->object_infos) if (addr.address() >= (std::uint64_t)info->start_exec && addr.address() <= (std::uint64_t)info->end_exec) @@ -383,7 +383,7 @@ std::shared_ptr RemoteSimulation::find_object_info_exec(Remot return nullptr; } -std::shared_ptr RemoteSimulation::find_object_info_rw(RemotePtr addr) const +std::shared_ptr RemoteProcess::find_object_info_rw(RemotePtr addr) const { for (std::shared_ptr const& info : this->object_infos) if (addr.address() >= (std::uint64_t)info->start_rw && addr.address() <= (std::uint64_t)info->end_rw) @@ -391,7 +391,7 @@ std::shared_ptr RemoteSimulation::find_object_info_rw(RemoteP return nullptr; } -simgrid::mc::Frame* RemoteSimulation::find_function(RemotePtr ip) const +simgrid::mc::Frame* RemoteProcess::find_function(RemotePtr ip) const { std::shared_ptr info = this->find_object_info_exec(ip); return info ? info->find_function((void*)ip.address()) : nullptr; @@ -399,7 +399,7 @@ simgrid::mc::Frame* RemoteSimulation::find_function(RemotePtr ip) const /** Find (one occurrence of) the named variable definition */ -const simgrid::mc::Variable* RemoteSimulation::find_variable(const char* name) const +const simgrid::mc::Variable* RemoteProcess::find_variable(const char* name) const { // First lookup the variable in the executable shared object. // A global variable used directly by the executable code from a library @@ -421,7 +421,7 @@ const simgrid::mc::Variable* RemoteSimulation::find_variable(const char* name) c return nullptr; } -void RemoteSimulation::read_variable(const char* name, void* target, size_t size) const +void RemoteProcess::read_variable(const char* name, void* target, size_t size) const { const simgrid::mc::Variable* var = this->find_variable(name); xbt_assert(var, "Variable %s not found", name); @@ -432,7 +432,7 @@ void RemoteSimulation::read_variable(const char* name, void* target, size_t size this->read_bytes(target, size, remote(var->address)); } -std::string RemoteSimulation::read_string(RemotePtr address) const +std::string RemoteProcess::read_string(RemotePtr address) const { if (not address) return {}; @@ -456,8 +456,7 @@ std::string RemoteSimulation::read_string(RemotePtr address) const } } -void* RemoteSimulation::read_bytes(void* buffer, std::size_t size, RemotePtr address, - ReadOptions /*options*/) const +void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr 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_); @@ -470,13 +469,13 @@ void* RemoteSimulation::read_bytes(void* buffer, std::size_t size, RemotePtr address) const +void RemoteProcess::write_bytes(const void* buffer, size_t len, RemotePtr address) const { if (pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) < 0) xbt_die("Write to process %lli failed", (long long)this->pid_); } -void RemoteSimulation::clear_bytes(RemotePtr address, size_t len) const +void RemoteProcess::clear_bytes(RemotePtr address, size_t len) const { pthread_once(&zero_buffer_flag, zero_buffer_init); while (len) { @@ -487,7 +486,7 @@ void RemoteSimulation::clear_bytes(RemotePtr address, size_t len) const } } -void RemoteSimulation::ignore_region(std::uint64_t addr, std::size_t size) +void RemoteProcess::ignore_region(std::uint64_t addr, std::size_t size) { IgnoredRegion region; region.addr = addr; @@ -501,7 +500,7 @@ void RemoteSimulation::ignore_region(std::uint64_t addr, std::size_t size) ignored_regions_.insert(pos, region); } -void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region) +void RemoteProcess::ignore_heap(IgnoredHeapRegion const& region) { // Binary search the position of insertion: auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), region.address, @@ -512,7 +511,7 @@ void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region) } } -void RemoteSimulation::unignore_heap(void* address, size_t size) +void RemoteProcess::unignore_heap(void* address, size_t size) { // Binary search: auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), address, @@ -521,7 +520,7 @@ void RemoteSimulation::unignore_heap(void* address, size_t size) ignored_heap_.erase(pos); } -void RemoteSimulation::ignore_local_variable(const char* var_name, const char* frame_name) const +void RemoteProcess::ignore_local_variable(const char* var_name, const char* frame_name) const { if (frame_name != nullptr && strcmp(frame_name, "*") == 0) frame_name = nullptr; @@ -529,19 +528,19 @@ void RemoteSimulation::ignore_local_variable(const char* var_name, const char* f info->remove_local_variable(var_name, frame_name); } -std::vector& RemoteSimulation::actors() +std::vector& RemoteProcess::actors() { this->refresh_simix(); return smx_actors_infos; } -std::vector& RemoteSimulation::dead_actors() +std::vector& RemoteProcess::dead_actors() { this->refresh_simix(); return smx_dead_actors_infos; } -void RemoteSimulation::dump_stack() const +void RemoteProcess::dump_stack() const { unw_addr_space_t as = unw_create_addr_space(&_UPT_accessors, BYTE_ORDER); if (as == nullptr) { diff --git a/src/mc/remote/RemoteSimulation.hpp b/src/mc/remote/RemoteProcess.hpp similarity index 92% rename from src/mc/remote/RemoteSimulation.hpp rename to src/mc/remote/RemoteProcess.hpp index fc50761c09..3e35f7f3a3 100644 --- a/src/mc/remote/RemoteSimulation.hpp +++ b/src/mc/remote/RemoteProcess.hpp @@ -63,7 +63,7 @@ struct IgnoredHeapRegion { * - stack unwinding; * - etc. */ -class RemoteSimulation final : public AddressSpace { +class RemoteProcess final : public AddressSpace { private: // Those flags are used to track down which cached information // is still up to date and which information needs to be updated. @@ -73,14 +73,14 @@ private: static constexpr int cache_simix_processes = 4; public: - explicit RemoteSimulation(pid_t pid); - ~RemoteSimulation() override; + explicit RemoteProcess(pid_t pid); + ~RemoteProcess() override; void init(); - RemoteSimulation(RemoteSimulation const&) = delete; - RemoteSimulation(RemoteSimulation&&) = delete; - RemoteSimulation& operator=(RemoteSimulation const&) = delete; - RemoteSimulation& operator=(RemoteSimulation&&) = delete; + RemoteProcess(RemoteProcess const&) = delete; + RemoteProcess(RemoteProcess&&) = delete; + RemoteProcess& operator=(RemoteProcess const&) = delete; + RemoteProcess& operator=(RemoteProcess&&) = delete; // Read memory: void* read_bytes(void* buffer, std::size_t size, RemotePtr address, @@ -115,18 +115,18 @@ public: // Heap access: xbt_mheap_t get_heap() { - if (not(this->cache_flags_ & RemoteSimulation::cache_heap)) + if (not(this->cache_flags_ & RemoteProcess::cache_heap)) this->refresh_heap(); return this->heap.get(); } const malloc_info* get_malloc_info() { - if (not(this->cache_flags_ & RemoteSimulation::cache_malloc)) + if (not(this->cache_flags_ & RemoteProcess::cache_malloc)) this->refresh_malloc_info(); return this->heap_info.data(); } - void clear_cache() { this->cache_flags_ = RemoteSimulation::cache_none; } + void clear_cache() { this->cache_flags_ = RemoteProcess::cache_none; } std::vector const& ignored_regions() const { return ignored_regions_; } void ignore_region(std::uint64_t address, std::size_t size); @@ -224,7 +224,7 @@ public: private: /** State of the cache (which variables are up to date) */ - int cache_flags_ = RemoteSimulation::cache_none; + int cache_flags_ = RemoteProcess::cache_none; public: /** Address of the heap structure in the MCed process. */ diff --git a/src/mc/sosp/Region.cpp b/src/mc/sosp/Region.cpp index 86d3452988..1a43ee4354 100644 --- a/src/mc/sosp/Region.cpp +++ b/src/mc/sosp/Region.cpp @@ -7,7 +7,7 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/mc_forward.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include diff --git a/src/mc/sosp/Snapshot.cpp b/src/mc/sosp/Snapshot.cpp index 96ee900d14..ec69ce5084 100644 --- a/src/mc/sosp/Snapshot.cpp +++ b/src/mc/sosp/Snapshot.cpp @@ -15,7 +15,7 @@ namespace mc { /************************************* Take Snapshot ************************************/ /****************************************************************************************/ -void Snapshot::snapshot_regions(RemoteSimulation* process) +void Snapshot::snapshot_regions(RemoteProcess* process) { snapshot_regions_.clear(); @@ -96,7 +96,7 @@ static std::vector get_local_variables_values(std::vector unwind_stack_frames(UnwindContext* stack_context) { - const RemoteSimulation* process = &mc_model_checker->get_remote_simulation(); + const RemoteProcess* process = &mc_model_checker->get_remote_simulation(); std::vector result; unw_cursor_t c = stack_context->cursor(); @@ -148,7 +148,7 @@ static std::vector unwind_stack_frames(UnwindContext* stack_ return result; } -void Snapshot::snapshot_stacks(RemoteSimulation* process) +void Snapshot::snapshot_stacks(RemoteProcess* process) { for (auto const& stack : process->stack_areas()) { s_mc_snapshot_stack_t st; @@ -197,7 +197,7 @@ static void snapshot_ignore_restore(const simgrid::mc::Snapshot* snapshot) remote(ignored_data.start)); } -Snapshot::Snapshot(int num_state, RemoteSimulation* process) : AddressSpace(process), num_state_(num_state) +Snapshot::Snapshot(int num_state, RemoteProcess* process) : AddressSpace(process), num_state_(num_state) { XBT_DEBUG("Taking snapshot %i", num_state); @@ -272,7 +272,7 @@ Region* Snapshot::get_region(const void* addr, Region* hinted_region) const return get_region(addr); } -void Snapshot::restore(RemoteSimulation* process) const +void Snapshot::restore(RemoteProcess* process) const { XBT_DEBUG("Restore snapshot %i", num_state_); diff --git a/src/mc/sosp/Snapshot.hpp b/src/mc/sosp/Snapshot.hpp index fbcf185c4a..2dfc05b188 100644 --- a/src/mc/sosp/Snapshot.hpp +++ b/src/mc/sosp/Snapshot.hpp @@ -8,7 +8,7 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/inspect/mc_unw.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include "src/mc/sosp/Region.hpp" // ***** MC Snapshot @@ -60,7 +60,7 @@ namespace mc { class XBT_PRIVATE Snapshot final : public AddressSpace { public: /* Initialization */ - Snapshot(int num_state, RemoteSimulation* get_remote_simulation = &mc_model_checker->get_remote_simulation()); + Snapshot(int num_state, RemoteProcess* get_remote_simulation = &mc_model_checker->get_remote_simulation()); /* Regular use */ bool on_heap(const void* address) const @@ -73,7 +73,7 @@ public: 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(RemoteSimulation* get_remote_simulation) const; + void restore(RemoteProcess* get_remote_simulation) const; // To be private int num_state_; @@ -88,8 +88,8 @@ public: private: void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size); - void snapshot_regions(RemoteSimulation* get_remote_simulation); - void snapshot_stacks(RemoteSimulation* get_remote_simulation); + void snapshot_regions(RemoteProcess* get_remote_simulation); + void snapshot_stacks(RemoteProcess* get_remote_simulation); }; } // namespace mc } // namespace simgrid diff --git a/src/mc/sosp/Snapshot_test.cpp b/src/mc/sosp/Snapshot_test.cpp index c5efb099db..47350be9b3 100644 --- a/src/mc/sosp/Snapshot_test.cpp +++ b/src/mc/sosp/Snapshot_test.cpp @@ -38,11 +38,11 @@ public: mc_model_checker = nullptr; } - static std::unique_ptr process; + static std::unique_ptr process; }; // static member variables init. -std::unique_ptr snap_test_helper::process = nullptr; +std::unique_ptr snap_test_helper::process = nullptr; void snap_test_helper::init_memory(void* mem, size_t size) { @@ -57,7 +57,7 @@ void snap_test_helper::Init() REQUIRE(xbt_pagesize == getpagesize()); REQUIRE(1 << xbt_pagebits == xbt_pagesize); - process = std::make_unique(getpid()); + process = std::make_unique(getpid()); process->init(); mc_model_checker = new ::simgrid::mc::ModelChecker(std::move(process), -1); } diff --git a/teshsuite/mc/dwarf-expression/dwarf-expression.cpp b/teshsuite/mc/dwarf-expression/dwarf-expression.cpp index 3cb50f5ec4..23b7b3d996 100644 --- a/teshsuite/mc/dwarf-expression/dwarf-expression.cpp +++ b/teshsuite/mc/dwarf-expression/dwarf-expression.cpp @@ -12,7 +12,7 @@ #include "src/mc/inspect/ObjectInformation.hpp" #include "src/mc/inspect/Type.hpp" #include "src/mc/inspect/Variable.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include @@ -145,7 +145,7 @@ static void test_deref(simgrid::dwarf::ExpressionContext const& state) int main() { - auto* process = new simgrid::mc::RemoteSimulation(getpid()); + auto* process = new simgrid::mc::RemoteProcess(getpid()); process->init(); simgrid::dwarf::ExpressionContext state; diff --git a/teshsuite/mc/dwarf/dwarf.cpp b/teshsuite/mc/dwarf/dwarf.cpp index 0ca7ff3940..78cff65b8c 100644 --- a/teshsuite/mc/dwarf/dwarf.cpp +++ b/teshsuite/mc/dwarf/dwarf.cpp @@ -15,7 +15,7 @@ #include "src/mc/inspect/ObjectInformation.hpp" #include "src/mc/inspect/Type.hpp" #include "src/mc/inspect/Variable.hpp" -#include "src/mc/remote/RemoteSimulation.hpp" +#include "src/mc/remote/RemoteProcess.hpp" #include #include @@ -72,7 +72,7 @@ static void test_local_variable(simgrid::mc::ObjectInformation* info, const char xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function); } -static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteSimulation& process, +static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteProcess& process, const simgrid::mc::ObjectInformation* info, const char* name, void* address, long byte_size) { @@ -104,7 +104,7 @@ struct s_foo { int i; }; -static void test_type_by_name(const simgrid::mc::RemoteSimulation& process, s_foo /*my_foo*/) +static void test_type_by_name(const simgrid::mc::RemoteProcess& process, s_foo /*my_foo*/) { assert(process.binary_info->full_types_by_name.find("struct s_foo") != process.binary_info->full_types_by_name.end()); } @@ -116,7 +116,7 @@ int main(int argc, char** argv) const simgrid::mc::Variable* var; simgrid::mc::Type* type; - simgrid::mc::RemoteSimulation process(getpid()); + simgrid::mc::RemoteProcess process(getpid()); process.init(); test_global_variable(process, process.binary_info.get(), "some_local_variable", &some_local_variable, sizeof(int)); diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index a0746a7d7a..f3969f46b4 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -620,8 +620,8 @@ set(MC_SRC src/mc/remote/Channel.hpp src/mc/remote/CheckerSide.cpp src/mc/remote/CheckerSide.hpp - src/mc/remote/RemoteSimulation.hpp - src/mc/remote/RemoteSimulation.cpp + src/mc/remote/RemoteProcess.hpp + src/mc/remote/RemoteProcess.cpp src/mc/remote/RemotePtr.hpp src/mc/remote/mc_protocol.h -- 2.20.1