From: Martin Quinson Date: Sun, 12 Mar 2023 21:16:16 +0000 (+0100) Subject: MC: rename remote/RemoteProcess to sosp/RemoteProcessMemory X-Git-Tag: v3.34~343 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/515cd2622ad1000f5f3ba58ecfaf488ac922b963 MC: rename remote/RemoteProcess to sosp/RemoteProcessMemory --- diff --git a/MANIFEST.in b/MANIFEST.in index 85bad9a84b..625f6ccd15 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2213,8 +2213,6 @@ 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/mc_protocol.h include src/mc/sosp/ChunkedData.cpp @@ -2224,6 +2222,8 @@ include src/mc/sosp/PageStore.hpp include src/mc/sosp/PageStore_test.cpp include src/mc/sosp/Region.cpp include src/mc/sosp/Region.hpp +include src/mc/sosp/RemoteProcessMemory.cpp +include src/mc/sosp/RemoteProcessMemory.hpp include src/mc/sosp/Snapshot.cpp include src/mc/sosp/Snapshot.hpp include src/mc/sosp/Snapshot_test.cpp diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index 47980be9ff..2ae6d4d0fd 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -83,17 +83,17 @@ public: */ class AddressSpace { private: - RemoteProcess* remote_process_; + RemoteProcessMemory* remote_process_memory_; public: - explicit AddressSpace(RemoteProcess* process) : remote_process_(process) {} + explicit AddressSpace(RemoteProcessMemory* process) : remote_process_memory_(process) {} virtual ~AddressSpace() = default; /** The process of this address space * * This is where we can get debug information, memory layout, etc. */ - simgrid::mc::RemoteProcess* get_remote_process() const { return remote_process_; } + simgrid::mc::RemoteProcessMemory* get_remote_process_memory() const { return remote_process_memory_; } /** Read data from the address space * diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index 243a22efba..60f4970751 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -9,7 +9,7 @@ #include "src/mc/mc_config.hpp" #include "src/mc/mc_exit.hpp" #include "src/mc/mc_private.hpp" -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include "src/mc/transition/TransitionComm.hpp" #include "xbt/automaton.hpp" #include "xbt/system_error.hpp" @@ -31,8 +31,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ModelChecker, mc, "ModelChecker"); namespace simgrid::mc { -ModelChecker::ModelChecker(std::unique_ptr remote_simulation, int sockfd) - : checker_side_(sockfd), remote_process_(std::move(remote_simulation)) +ModelChecker::ModelChecker(std::unique_ptr remote_memory, int sockfd) + : checker_side_(sockfd), remote_process_memory_(std::move(remote_memory)) { } @@ -64,7 +64,7 @@ void ModelChecker::start() int status; // The model-checked process SIGSTOP itself to signal it's ready: - const pid_t pid = remote_process_->pid(); + const pid_t pid = remote_process_memory_->pid(); xbt_assert(waitpid(pid, &status, WAITPID_CHECKED_FLAGS) == pid && WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP, "Could not wait model-checked process"); @@ -97,7 +97,7 @@ static constexpr auto ignored_local_variables = { void ModelChecker::setup_ignore() { - const RemoteProcess& process = this->get_remote_process(); + const RemoteProcessMemory& process = this->get_remote_process_memory(); for (auto const& [var, frame] : ignored_local_variables) process.ignore_local_variable(var, frame); @@ -109,7 +109,7 @@ void ModelChecker::shutdown() { XBT_DEBUG("Shutting down model-checker"); - RemoteProcess& process = get_remote_process(); + RemoteProcessMemory& process = get_remote_process_memory(); if (process.running()) { XBT_DEBUG("Killing process"); finalize_app(true); @@ -122,7 +122,7 @@ void ModelChecker::resume() { if (checker_side_.get_channel().send(MessageType::CONTINUE) != 0) throw xbt::errno_error(); - remote_process_->clear_cache(); + remote_process_memory_->clear_cache(); } static void MC_report_crash(Exploration* explorer, int status) @@ -148,7 +148,7 @@ static void MC_report_crash(Exploration* explorer, int status) XBT_INFO("Stack trace not displayed because you passed --log=no_loc"); } else { XBT_INFO("Stack trace:"); - explorer->get_remote_app().get_remote_process().dump_stack(); + explorer->get_remote_app().get_remote_process_memory().dump_stack(); } } } @@ -165,7 +165,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) xbt_assert(size == sizeof(message), "Broken message. Got %d bytes instead of %d.", (int)size, (int)sizeof(message)); memcpy(&message, buffer, sizeof(message)); - get_remote_process().init(message.mmalloc_default_mdp); + get_remote_process_memory().init(message.mmalloc_default_mdp); break; } @@ -179,7 +179,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) region.fragment = message.fragment; region.address = message.address; region.size = message.size; - get_remote_process().ignore_heap(region); + get_remote_process_memory().ignore_heap(region); break; } @@ -187,7 +187,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) s_mc_message_ignore_memory_t message; xbt_assert(size == sizeof(message), "Broken message"); memcpy(&message, buffer, sizeof(message)); - get_remote_process().unignore_heap((void*)(std::uintptr_t)message.addr, message.size); + get_remote_process_memory().unignore_heap((void*)(std::uintptr_t)message.addr, message.size); break; } @@ -195,7 +195,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) s_mc_message_ignore_memory_t message; xbt_assert(size == sizeof(message), "Broken message"); memcpy(&message, buffer, sizeof(message)); - this->get_remote_process().ignore_region(message.addr, message.size); + this->get_remote_process_memory().ignore_region(message.addr, message.size); break; } @@ -203,7 +203,7 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) s_mc_message_stack_region_t message; xbt_assert(size == sizeof(message), "Broken message"); memcpy(&message, buffer, sizeof(message)); - this->get_remote_process().stack_areas().push_back(message.stack_region); + this->get_remote_process_memory().stack_areas().push_back(message.stack_region); } break; case MessageType::REGISTER_SYMBOL: { @@ -213,7 +213,8 @@ bool ModelChecker::handle_message(const char* buffer, ssize_t size) xbt_assert(not message.callback, "Support for client-side function proposition is not implemented."); XBT_DEBUG("Received symbol: %s", message.name.data()); - LivenessChecker::automaton_register_symbol(get_remote_process(), message.name.data(), remote((int*)message.data)); + LivenessChecker::automaton_register_symbol(get_remote_process_memory(), message.name.data(), + remote((int*)message.data)); break; } @@ -256,7 +257,7 @@ void ModelChecker::handle_waitpid() if (pid == -1) { if (errno == ECHILD) { // No more children: - xbt_assert(not this->get_remote_process().running(), "Inconsistent state"); + xbt_assert(not this->get_remote_process_memory().running(), "Inconsistent state"); break; } else { XBT_ERROR("Could not wait for pid"); @@ -264,16 +265,17 @@ void ModelChecker::handle_waitpid() } } - if (pid == this->get_remote_process().pid()) { + if (pid == this->get_remote_process_memory().pid()) { // From PTRACE_O_TRACEEXIT: #ifdef __linux__ if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) { unsigned long eventmsg; - xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &eventmsg) != -1, "Could not get exit status"); + xbt_assert(ptrace(PTRACE_GETEVENTMSG, get_remote_process_memory().pid(), 0, &eventmsg) != -1, + "Could not get exit status"); status = static_cast(eventmsg); if (WIFSIGNALED(status)) { MC_report_crash(exploration_, status); - this->get_remote_process().terminate(); + this->get_remote_process_memory().terminate(); this->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH); } } @@ -284,20 +286,20 @@ void ModelChecker::handle_waitpid() XBT_DEBUG("Stopped with signal %i", (int) WSTOPSIG(status)); errno = 0; #ifdef __linux__ - ptrace(PTRACE_CONT, remote_process_->pid(), 0, WSTOPSIG(status)); + ptrace(PTRACE_CONT, get_remote_process_memory().pid(), 0, WSTOPSIG(status)); #elif defined BSD - ptrace(PT_CONTINUE, remote_process_->pid(), (caddr_t)1, WSTOPSIG(status)); + ptrace(PT_CONTINUE, get_remote_process_memory().pid(), (caddr_t)1, WSTOPSIG(status)); #endif xbt_assert(errno == 0, "Could not PTRACE_CONT"); } else if (WIFSIGNALED(status)) { MC_report_crash(exploration_, status); - this->get_remote_process().terminate(); + this->get_remote_process_memory().terminate(); this->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH); } else if (WIFEXITED(status)) { XBT_DEBUG("Child process is over"); - this->get_remote_process().terminate(); + this->get_remote_process_memory().terminate(); } } } @@ -306,7 +308,7 @@ void ModelChecker::handle_waitpid() void ModelChecker::wait_for_requests() { this->resume(); - if (this->get_remote_process().running()) + if (this->get_remote_process_memory().running()) checker_side_.dispatch(); } @@ -318,8 +320,8 @@ Transition* ModelChecker::handle_simcall(aid_t aid, int times_considered, bool n m.times_considered_ = times_considered; checker_side_.get_channel().send(m); - this->remote_process_->clear_cache(); - if (this->remote_process_->running()) + this->remote_process_memory_->clear_cache(); + if (this->remote_process_memory_->running()) checker_side_.dispatch(); // The app may send messages while processing the transition s_mc_message_simcall_execute_answer_t answer; diff --git a/src/mc/ModelChecker.hpp b/src/mc/ModelChecker.hpp index ccbee43782..5f7c53b2fe 100644 --- a/src/mc/ModelChecker.hpp +++ b/src/mc/ModelChecker.hpp @@ -19,15 +19,15 @@ namespace simgrid::mc { */ class ModelChecker { CheckerSide checker_side_; - std::unique_ptr remote_process_; + std::unique_ptr remote_process_memory_; Exploration* exploration_ = nullptr; 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); - RemoteProcess& get_remote_process() { return *remote_process_; } + RemoteProcessMemory& get_remote_process_memory() { return *remote_process_memory_; } Channel& channel() { return checker_side_.get_channel(); } void start(); diff --git a/src/mc/VisitedState.cpp b/src/mc/VisitedState.cpp index ac9e1919d0..3902d911a5 100644 --- a/src/mc/VisitedState.cpp +++ b/src/mc/VisitedState.cpp @@ -19,7 +19,7 @@ namespace simgrid::mc { /** @brief Save the current state */ VisitedState::VisitedState(unsigned long state_number, unsigned int actor_count, RemoteApp& remote_app) - : heap_bytes_used_(remote_app.get_remote_process().get_remote_heap_bytes()) + : heap_bytes_used_(remote_app.get_remote_process_memory().get_remote_heap_bytes()) , actor_count_(actor_count) , num_(state_number) { diff --git a/src/mc/api/RemoteApp.cpp b/src/mc/api/RemoteApp.cpp index a5111d17ec..b31650f1bf 100644 --- a/src/mc/api/RemoteApp.cpp +++ b/src/mc/api/RemoteApp.cpp @@ -128,7 +128,7 @@ RemoteApp::RemoteApp(const std::vector& args) 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(); @@ -151,7 +151,7 @@ RemoteApp::~RemoteApp() void RemoteApp::restore_initial_state() const { - this->initial_snapshot_->restore(&model_checker_->get_remote_process()); + this->initial_snapshot_->restore(&model_checker_->get_remote_process_memory()); } unsigned long RemoteApp::get_maxpid() const diff --git a/src/mc/api/RemoteApp.hpp b/src/mc/api/RemoteApp.hpp index f920da6f75..975502ed21 100644 --- a/src/mc/api/RemoteApp.hpp +++ b/src/mc/api/RemoteApp.hpp @@ -56,8 +56,8 @@ public: /* Get the list of actors that are ready to run at that step. Usually shorter than maxpid */ void get_actors_status(std::map& whereto) const; - /* Get the remote process */ - RemoteProcess& get_remote_process() { return model_checker_->get_remote_process(); } + /* Get the memory of the remote process */ + RemoteProcessMemory& get_remote_process_memory() { return model_checker_->get_remote_process_memory(); } PageStore& get_page_store() { return page_store_; } }; diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 2c24b35b2c..de5e31d4c9 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -137,7 +137,7 @@ static ssize_t heap_comparison_ignore_size(const std::vectorend() && pos->address == address) ? pos->size : -1; } -static bool is_stack(const simgrid::mc::RemoteProcess& process, const void* address) +static bool is_stack(const simgrid::mc::RemoteProcessMemory& process, const void* address) { auto const& stack_areas = process.stack_areas(); return std::any_of(stack_areas.begin(), stack_areas.end(), @@ -145,7 +145,7 @@ static bool is_stack(const simgrid::mc::RemoteProcess& process, const void* addr } // TODO, this should depend on the snapshot? -static bool is_block_stack(const simgrid::mc::RemoteProcess& process, int block) +static bool is_block_stack(const simgrid::mc::RemoteProcessMemory& process, int block) { auto const& stack_areas = process.stack_areas(); return std::any_of(stack_areas.begin(), stack_areas.end(), @@ -183,7 +183,7 @@ int StateComparator::initHeapInformation(const s_xbt_mheap_t* heap1, const s_xbt if ((heap1->heaplimit != heap2->heaplimit) || (heap1->heapsize != heap2->heapsize)) return -1; this->heaplimit = heap1->heaplimit; - this->std_heap_copy = *mc_model_checker->get_remote_process().get_heap(); + this->std_heap_copy = *mc_model_checker->get_remote_process_memory().get_heap(); this->processStates[0].initHeapInformation(heap1, i1); this->processStates[1].initHeapInformation(heap2, i2); return 0; @@ -198,9 +198,9 @@ static inline Region* MC_get_heap_region(const Snapshot& snapshot) xbt_die("No heap region"); } -static bool heap_area_differ(const RemoteProcess& process, StateComparator& state, const void* area1, const void* area2, - const Snapshot& snapshot1, const Snapshot& snapshot2, HeapLocationPairs* previous, - Type* type, int pointer_level); +static bool heap_area_differ(const RemoteProcessMemory& process, StateComparator& state, const void* area1, + const void* area2, const Snapshot& snapshot1, const Snapshot& snapshot2, + HeapLocationPairs* previous, Type* type, int pointer_level); /* Compares the content of each heap fragment between the two states, at the bit level. * @@ -233,7 +233,7 @@ static bool heap_area_differ(const RemoteProcess& process, StateComparator& stat * of the liveness model-checker, as state-equality is used to detect the loops that constitute the accepting states of * the verified property. So we could miss counter-examples to the verified property. Not good. Not good at all. */ -static bool mmalloc_heap_differ(const RemoteProcess& process, StateComparator& state, const Snapshot& snapshot1, +static bool mmalloc_heap_differ(const RemoteProcessMemory& process, StateComparator& state, const Snapshot& snapshot1, const Snapshot& snapshot2) { /* Check busy blocks */ @@ -457,9 +457,10 @@ static bool mmalloc_heap_differ(const RemoteProcess& process, StateComparator& s * @param check_ignore * @return true when different, false otherwise (same or unknown) */ -static bool heap_area_differ_without_type(const RemoteProcess& process, StateComparator& state, const void* real_area1, - const void* real_area2, const Snapshot& snapshot1, const Snapshot& snapshot2, - HeapLocationPairs* previous, int size, int check_ignore) +static bool heap_area_differ_without_type(const RemoteProcessMemory& process, StateComparator& state, + const void* real_area1, const void* real_area2, const Snapshot& snapshot1, + const Snapshot& snapshot2, HeapLocationPairs* previous, int size, + int check_ignore) { const Region* heap_region1 = MC_get_heap_region(snapshot1); const Region* heap_region2 = MC_get_heap_region(snapshot2); @@ -520,7 +521,7 @@ static bool heap_area_differ_without_type(const RemoteProcess& process, StateCom * @param pointer_level * @return true when different, false otherwise (same or unknown) */ -static bool heap_area_differ_with_type(const simgrid::mc::RemoteProcess& process, StateComparator& state, +static bool heap_area_differ_with_type(const simgrid::mc::RemoteProcessMemory& process, StateComparator& state, const void* real_area1, const void* real_area2, const Snapshot& snapshot1, const Snapshot& snapshot2, HeapLocationPairs* previous, const Type* type, int area_size, int check_ignore, int pointer_level) @@ -743,9 +744,9 @@ static Type* get_offset_type(void* real_base_address, Type* type, int offset, in * @param pointer_level * @return true when different, false otherwise (same or unknown) */ -static bool heap_area_differ(const RemoteProcess& process, StateComparator& state, const void* area1, const void* area2, - const Snapshot& snapshot1, const Snapshot& snapshot2, HeapLocationPairs* previous, - Type* type, int pointer_level) +static bool heap_area_differ(const RemoteProcessMemory& process, StateComparator& state, const void* area1, + const void* area2, const Snapshot& snapshot1, const Snapshot& snapshot2, + HeapLocationPairs* previous, Type* type, int pointer_level) { ssize_t block1; ssize_t block2; @@ -1016,7 +1017,7 @@ static bool heap_area_differ(const RemoteProcess& process, StateComparator& stat /************************** Snapshot comparison *******************************/ /******************************************************************************/ -static bool areas_differ_with_type(const simgrid::mc::RemoteProcess& process, simgrid::mc::StateComparator& state, +static bool areas_differ_with_type(const simgrid::mc::RemoteProcessMemory& process, 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, @@ -1143,7 +1144,8 @@ static bool areas_differ_with_type(const simgrid::mc::RemoteProcess& process, si return false; } -static bool global_variables_differ(const simgrid::mc::RemoteProcess& process, simgrid::mc::StateComparator& state, +static bool global_variables_differ(const simgrid::mc::RemoteProcessMemory& process, + 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) @@ -1170,7 +1172,7 @@ static bool global_variables_differ(const simgrid::mc::RemoteProcess& process, s return false; } -static bool local_variables_differ(const simgrid::mc::RemoteProcess& process, simgrid::mc::StateComparator& state, +static bool local_variables_differ(const simgrid::mc::RemoteProcessMemory& process, simgrid::mc::StateComparator& state, const simgrid::mc::Snapshot& snapshot1, const simgrid::mc::Snapshot& snapshot2, const_mc_snapshot_stack_t stack1, const_mc_snapshot_stack_t stack2) { @@ -1209,7 +1211,7 @@ bool Snapshot::operator==(const Snapshot& other) // TODO, make this a field of ModelChecker or something similar static StateComparator state_comparator; - const RemoteProcess& process = mc_model_checker->get_remote_process(); + const RemoteProcessMemory& process = mc_model_checker->get_remote_process_memory(); if (hash_ != other.hash_) { XBT_VERB("(%ld - %ld) Different hash: 0x%" PRIx64 "--0x%" PRIx64, this->num_state_, other.num_state_, this->hash_, diff --git a/src/mc/explo/DFSExplorer.cpp b/src/mc/explo/DFSExplorer.cpp index 05b607b850..d2aa4f48b5 100644 --- a/src/mc/explo/DFSExplorer.cpp +++ b/src/mc/explo/DFSExplorer.cpp @@ -279,7 +279,7 @@ void DFSExplorer::backtrack() /* If asked to rollback on a state that has a snapshot, restore it */ State* last_state = stack_.back().get(); if (const auto* system_state = last_state->get_system_state()) { - system_state->restore(&get_remote_app().get_remote_process()); + system_state->restore(&get_remote_app().get_remote_process_memory()); on_restore_system_state_signal(last_state, get_remote_app()); return; } diff --git a/src/mc/explo/LivenessChecker.cpp b/src/mc/explo/LivenessChecker.cpp index c0929f102f..6a43409edb 100644 --- a/src/mc/explo/LivenessChecker.cpp +++ b/src/mc/explo/LivenessChecker.cpp @@ -26,7 +26,7 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t prop_state, this->app_state_ = std::move(app_state); if (not this->app_state_->get_system_state()) this->app_state_->set_system_state(std::make_shared(pair_num, remote_app.get_page_store())); - this->heap_bytes_used = mc_model_checker->get_remote_process().get_remote_heap_bytes(); + this->heap_bytes_used = mc_model_checker->get_remote_process_memory().get_remote_heap_bytes(); this->actor_count_ = app_state_->get_actor_count(); this->other_num = -1; this->atomic_propositions = std::move(atomic_propositions); @@ -102,7 +102,7 @@ void LivenessChecker::replay() if (_sg_mc_checkpoint > 0) { const Pair* pair = exploration_stack_.back().get(); if (const auto* system_state = pair->app_state_->get_system_state()) { - system_state->restore(&get_remote_app().get_remote_process()); + system_state->restore(&get_remote_app().get_remote_process_memory()); return; } } @@ -241,7 +241,7 @@ xbt_automaton_state_t LivenessChecker::get_automaton_transition_dst(xbt_dynar_t const xbt_automaton_transition* transition = xbt_dynar_get_as(dynar, index, xbt_automaton_transition_t); return transition->dst; } -void LivenessChecker::automaton_register_symbol(RemoteProcess const& remote_process, const char* name, +void LivenessChecker::automaton_register_symbol(RemoteProcessMemory const& remote_process, const char* name, RemotePtr address) { if (property_automaton_ == nullptr) diff --git a/src/mc/explo/LivenessChecker.hpp b/src/mc/explo/LivenessChecker.hpp index 0b366e8f9e..532f6395a8 100644 --- a/src/mc/explo/LivenessChecker.hpp +++ b/src/mc/explo/LivenessChecker.hpp @@ -101,7 +101,8 @@ public: void set_property_automaton(xbt_automaton_state_t const& automaton_state) const; xbt_automaton_exp_label_t get_automaton_transition_label(xbt_dynar_t const& dynar, int index) const; xbt_automaton_state_t get_automaton_transition_dst(xbt_dynar_t const& dynar, int index) const; - static void automaton_register_symbol(RemoteProcess const& remote_process, const char* name, RemotePtr addr); + static void automaton_register_symbol(RemoteProcessMemory const& remote_process, const char* name, + RemotePtr addr); }; } // namespace simgrid::mc diff --git a/src/mc/inspect/ObjectInformation.hpp b/src/mc/inspect/ObjectInformation.hpp index bc59ee1098..7d1dfa11dc 100644 --- a/src/mc/inspect/ObjectInformation.hpp +++ b/src/mc/inspect/ObjectInformation.hpp @@ -163,7 +163,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::RemoteProcess* process, +XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteProcessMemory* process, simgrid::mc::ObjectInformation* info); } // namespace simgrid::mc diff --git a/src/mc/inspect/mc_dwarf.cpp b/src/mc/inspect/mc_dwarf.cpp index 93ff5f8c36..094635da76 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/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include #include @@ -1147,7 +1147,7 @@ std::shared_ptr createObjectInformation(std::vectortypes) { Type* type = &t; diff --git a/src/mc/inspect/mc_unw.cpp b/src/mc/inspect/mc_unw.cpp index 746fb3155d..1b66c85ac1 100644 --- a/src/mc/inspect/mc_unw.cpp +++ b/src/mc/inspect/mc_unw.cpp @@ -3,16 +3,14 @@ /* 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. */ -/** \file - * Libunwind support for mc_address_space objects. - */ +/** \file Libunwind support for mc_address_space objects. */ // We need this for the register indices: // #define _GNU_SOURCE #include "src/mc/inspect/mc_unw.hpp" #include "src/mc/inspect/Frame.hpp" -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include @@ -218,7 +216,7 @@ unw_addr_space_t UnwindContext::createUnwindAddressSpace() return unw_create_addr_space(&accessors, BYTE_ORDER); } -void UnwindContext::initialize(simgrid::mc::RemoteProcess* process, unw_context_t* c) +void UnwindContext::initialize(simgrid::mc::RemoteProcessMemory* 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 ce9d39c7b9..148591a154 100644 --- a/src/mc/inspect/mc_unw.hpp +++ b/src/mc/inspect/mc_unw.hpp @@ -40,12 +40,12 @@ XBT_PRIVATE void* create_context(unw_addr_space_t as, pid_t pid); namespace simgrid::mc { class UnwindContext { - simgrid::mc::AddressSpace* address_space_ = nullptr; - simgrid::mc::RemoteProcess* process_ = nullptr; - unw_context_t unwind_context_ = {}; + simgrid::mc::AddressSpace* address_space_ = nullptr; + simgrid::mc::RemoteProcessMemory* process_ = nullptr; + unw_context_t unwind_context_ = {}; public: - void initialize(simgrid::mc::RemoteProcess* process, unw_context_t* c); + void initialize(simgrid::mc::RemoteProcessMemory* 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 b9457da4d6..21fc4789ae 100644 --- a/src/mc/inspect/mc_unw_vmread.cpp +++ b/src/mc/inspect/mc_unw_vmread.cpp @@ -6,7 +6,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/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include #include diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 64a2ae63a7..c4004224f9 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -15,7 +15,7 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/api/RemoteApp.hpp" #include "src/mc/remote/AppSide.hpp" -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #endif XBT_LOG_NEW_DEFAULT_CATEGORY(mc, "All MC categories"); diff --git a/src/mc/mc_forward.hpp b/src/mc/mc_forward.hpp index 4f97d16d02..b9da6dfe04 100644 --- a/src/mc/mc_forward.hpp +++ b/src/mc/mc_forward.hpp @@ -17,7 +17,7 @@ class PageStore; class ChunkedData; class ModelChecker; class AddressSpace; -class RemoteProcess; +class RemoteProcessMemory; class Snapshot; class ObjectInformation; class Member; diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index b8ba57e726..036fd29fc5 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -11,7 +11,7 @@ #include "src/kernel/actor/SimcallObserver.hpp" #include "src/mc/mc_base.hpp" #include "src/mc/mc_config.hpp" -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #if HAVE_SMPI #include "src/smpi/include/private.hpp" #endif diff --git a/src/mc/sosp/Region.cpp b/src/mc/sosp/Region.cpp index bb98737b73..538e12f3ea 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/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include #include @@ -22,8 +22,8 @@ Region::Region(PageStore& store, RegionType region_type, void* start_addr, size_ { xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize - 1)) == 0, "Start address not at the beginning of a page"); - chunks_ = - ChunkedData(store, mc_model_checker->get_remote_process(), RemotePtr(start_addr), mmu::chunk_count(size)); + chunks_ = ChunkedData(store, mc_model_checker->get_remote_process_memory(), RemotePtr(start_addr), + mmu::chunk_count(size)); } /** @brief Restore a region from a snapshot @@ -38,7 +38,7 @@ void Region::restore() const for (size_t i = 0; i != get_chunks().page_count(); ++i) { auto* target_page = (void*)simgrid::mc::mmu::join(i, (std::uintptr_t)(void*)start().address()); const void* source_page = get_chunks().page(i); - mc_model_checker->get_remote_process().write_bytes(source_page, xbt_pagesize, remote(target_page)); + mc_model_checker->get_remote_process_memory().write_bytes(source_page, xbt_pagesize, remote(target_page)); } } diff --git a/src/mc/remote/RemoteProcess.cpp b/src/mc/sosp/RemoteProcessMemory.cpp similarity index 86% rename from src/mc/remote/RemoteProcess.cpp rename to src/mc/sosp/RemoteProcessMemory.cpp index fc4e89a0ad..7fd28b0abb 100644 --- a/src/mc/remote/RemoteProcess.cpp +++ b/src/mc/sosp/RemoteProcessMemory.cpp @@ -5,7 +5,7 @@ #define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */ -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include "src/mc/sosp/Snapshot.hpp" #include "xbt/file.hpp" @@ -101,11 +101,11 @@ int open_vm(pid_t pid, int flags) return open(buffer.c_str(), flags); } -// ***** RemoteProcess +// ***** RemoteProcessMemory -RemoteProcess::RemoteProcess(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {} +RemoteProcessMemory::RemoteProcessMemory(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {} -void RemoteProcess::init(xbt_mheap_t mmalloc_default_mdp) +void RemoteProcessMemory::init(xbt_mheap_t mmalloc_default_mdp) { this->heap_address = remote(mmalloc_default_mdp); @@ -121,7 +121,7 @@ void RemoteProcess::init(xbt_mheap_t mmalloc_default_mdp) this->unw_underlying_context = simgrid::unw::create_context(this->unw_underlying_addr_space, this->pid_); } -RemoteProcess::~RemoteProcess() +RemoteProcessMemory::~RemoteProcessMemory() { if (this->memory_file >= 0) close(this->memory_file); @@ -141,11 +141,11 @@ RemoteProcess::~RemoteProcess() * Do not use directly, this is used by the getters when appropriate * in order to have fresh data. */ -void RemoteProcess::refresh_heap() +void RemoteProcessMemory::refresh_heap() { // Read/dereference/refresh the std_heap pointer: this->read(this->heap.get(), this->heap_address); - this->cache_flags_ |= RemoteProcess::cache_heap; + this->cache_flags_ |= RemoteProcessMemory::cache_heap; } /** Refresh the information about the process @@ -153,24 +153,24 @@ void RemoteProcess::refresh_heap() * Do not use directly, this is used by the getters when appropriate * in order to have fresh data. * */ -void RemoteProcess::refresh_malloc_info() +void RemoteProcessMemory::refresh_malloc_info() { // Refresh process->heapinfo: - if (this->cache_flags_ & RemoteProcess::cache_malloc) + if (this->cache_flags_ & RemoteProcessMemory::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_ |= RemoteProcess::cache_malloc; + this->cache_flags_ |= RemoteProcessMemory::cache_malloc; } -std::size_t RemoteProcess::get_remote_heap_bytes() +std::size_t RemoteProcessMemory::get_remote_heap_bytes() { return mmalloc_get_bytes_used_remote(get_heap()->heaplimit, get_malloc_info()); } /** @brief Finds the range of the different memory segments and binary paths */ -void RemoteProcess::init_memory_map_info() +void RemoteProcessMemory::init_memory_map_info() { XBT_DEBUG("Get debug information ..."); this->maestro_stack_start_ = nullptr; @@ -231,7 +231,7 @@ void RemoteProcess::init_memory_map_info() XBT_DEBUG("Get debug information done !"); } -std::shared_ptr RemoteProcess::find_object_info(RemotePtr addr) const +std::shared_ptr RemoteProcessMemory::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) @@ -239,7 +239,7 @@ std::shared_ptr RemoteProcess::find_object_info( return nullptr; } -std::shared_ptr RemoteProcess::find_object_info_exec(RemotePtr addr) const +std::shared_ptr RemoteProcessMemory::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) @@ -247,7 +247,7 @@ std::shared_ptr RemoteProcess::find_object_info_exec(RemotePt return nullptr; } -std::shared_ptr RemoteProcess::find_object_info_rw(RemotePtr addr) const +std::shared_ptr RemoteProcessMemory::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) @@ -255,7 +255,7 @@ std::shared_ptr RemoteProcess::find_object_info_rw(RemotePtr< return nullptr; } -simgrid::mc::Frame* RemoteProcess::find_function(RemotePtr ip) const +simgrid::mc::Frame* RemoteProcessMemory::find_function(RemotePtr ip) const { std::shared_ptr info = this->find_object_info_exec(ip); return info ? info->find_function((void*)ip.address()) : nullptr; @@ -263,7 +263,7 @@ simgrid::mc::Frame* RemoteProcess::find_function(RemotePtr ip) const /** Find (one occurrence of) the named variable definition */ -const simgrid::mc::Variable* RemoteProcess::find_variable(const char* name) const +const simgrid::mc::Variable* RemoteProcessMemory::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 @@ -285,7 +285,7 @@ const simgrid::mc::Variable* RemoteProcess::find_variable(const char* name) cons return nullptr; } -void RemoteProcess::read_variable(const char* name, void* target, size_t size) const +void RemoteProcessMemory::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); @@ -301,7 +301,7 @@ void RemoteProcess::read_variable(const char* name, void* target, size_t size) c this->read_bytes(target, size, remote(var->address)); } -std::string RemoteProcess::read_string(RemotePtr address) const +std::string RemoteProcessMemory::read_string(RemotePtr address) const { if (not address) return {}; @@ -324,7 +324,8 @@ std::string RemoteProcess::read_string(RemotePtr address) const } } -void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr address, ReadOptions /*options*/) const +void* RemoteProcessMemory::read_bytes(void* buffer, std::size_t size, RemotePtr address, + ReadOptions /*options*/) const { xbt_assert(pread_whole(this->memory_file, buffer, size, (size_t)address.address()) != -1, "Read at %p from process %lli failed", (void*)address.address(), (long long)this->pid_); @@ -337,7 +338,7 @@ void* RemoteProcess::read_bytes(void* buffer, std::size_t size, RemotePtr * @param len data size * @param address target process memory address (target) */ -void RemoteProcess::write_bytes(const void* buffer, size_t len, RemotePtr address) const +void RemoteProcessMemory::write_bytes(const void* buffer, size_t len, RemotePtr address) const { xbt_assert(pwrite_whole(this->memory_file, buffer, len, (size_t)address.address()) != -1, "Write to process %lli failed", (long long)this->pid_); @@ -352,7 +353,7 @@ static void zero_buffer_init(const void** zero_buffer, size_t zero_buffer_size) close(fd); } -void RemoteProcess::clear_bytes(RemotePtr address, size_t len) const +void RemoteProcessMemory::clear_bytes(RemotePtr address, size_t len) const { static constexpr size_t zero_buffer_size = 10 * 4096; static const void* zero_buffer; @@ -367,7 +368,7 @@ void RemoteProcess::clear_bytes(RemotePtr address, size_t len) const } } -void RemoteProcess::ignore_region(std::uint64_t addr, std::size_t size) +void RemoteProcessMemory::ignore_region(std::uint64_t addr, std::size_t size) { IgnoredRegion region; region.addr = addr; @@ -381,7 +382,7 @@ void RemoteProcess::ignore_region(std::uint64_t addr, std::size_t size) ignored_regions_.insert(pos, region); } -void RemoteProcess::ignore_heap(IgnoredHeapRegion const& region) +void RemoteProcessMemory::ignore_heap(IgnoredHeapRegion const& region) { // Binary search the position of insertion: auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), region.address, @@ -392,7 +393,7 @@ void RemoteProcess::ignore_heap(IgnoredHeapRegion const& region) } } -void RemoteProcess::unignore_heap(void* address, size_t size) +void RemoteProcessMemory::unignore_heap(void* address, size_t size) { // Binary search: auto pos = std::lower_bound(ignored_heap_.begin(), ignored_heap_.end(), address, @@ -401,7 +402,7 @@ void RemoteProcess::unignore_heap(void* address, size_t size) ignored_heap_.erase(pos); } -void RemoteProcess::ignore_local_variable(const char* var_name, const char* frame_name) const +void RemoteProcessMemory::ignore_local_variable(const char* var_name, const char* frame_name) const { if (frame_name != nullptr && strcmp(frame_name, "*") == 0) frame_name = nullptr; @@ -409,7 +410,7 @@ void RemoteProcess::ignore_local_variable(const char* var_name, const char* fram info->remove_local_variable(var_name, frame_name); } -void RemoteProcess::dump_stack() const +void RemoteProcessMemory::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/RemoteProcess.hpp b/src/mc/sosp/RemoteProcessMemory.hpp similarity index 89% rename from src/mc/remote/RemoteProcess.hpp rename to src/mc/sosp/RemoteProcessMemory.hpp index b9dca02e9a..1e3422a590 100644 --- a/src/mc/remote/RemoteProcess.hpp +++ b/src/mc/sosp/RemoteProcessMemory.hpp @@ -60,23 +60,23 @@ struct IgnoredHeapRegion { * - stack unwinding; * - etc. */ -class RemoteProcess final : public AddressSpace { +class RemoteProcessMemory 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. - static constexpr int cache_none = 0; - static constexpr int cache_heap = 1; - static constexpr int cache_malloc = 2; + static constexpr int cache_none = 0; + static constexpr int cache_heap = 1; + static constexpr int cache_malloc = 2; public: - explicit RemoteProcess(pid_t pid); - ~RemoteProcess() override; + explicit RemoteProcessMemory(pid_t pid); + ~RemoteProcessMemory() override; void init(xbt_mheap_t mmalloc_default_mdp); - RemoteProcess(RemoteProcess const&) = delete; - RemoteProcess(RemoteProcess&&) = delete; - RemoteProcess& operator=(RemoteProcess const&) = delete; - RemoteProcess& operator=(RemoteProcess&&) = delete; + RemoteProcessMemory(RemoteProcessMemory const&) = delete; + RemoteProcessMemory(RemoteProcessMemory&&) = delete; + RemoteProcessMemory& operator=(RemoteProcessMemory const&) = delete; + RemoteProcessMemory& operator=(RemoteProcessMemory&&) = delete; /* ************* */ /* Low-level API */ @@ -115,20 +115,20 @@ public: // Heap access: xbt_mheap_t get_heap() { - if (not(this->cache_flags_ & RemoteProcess::cache_heap)) + if (not(this->cache_flags_ & RemoteProcessMemory::cache_heap)) this->refresh_heap(); return this->heap.get(); } const malloc_info* get_malloc_info() { - if (not(this->cache_flags_ & RemoteProcess::cache_malloc)) + if (not(this->cache_flags_ & RemoteProcessMemory::cache_malloc)) 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; } + void clear_cache() { this->cache_flags_ = RemoteProcessMemory::cache_none; } std::vector const& ignored_regions() const { return ignored_regions_; } void ignore_region(std::uint64_t address, std::size_t size); @@ -177,7 +177,7 @@ private: std::vector ignored_heap_; /** State of the cache (which variables are up to date) */ - int cache_flags_ = RemoteProcess::cache_none; + int cache_flags_ = RemoteProcessMemory::cache_none; public: // object info diff --git a/src/mc/sosp/Snapshot.cpp b/src/mc/sosp/Snapshot.cpp index afe91c63c1..be64dfff9f 100644 --- a/src/mc/sosp/Snapshot.cpp +++ b/src/mc/sosp/Snapshot.cpp @@ -13,7 +13,7 @@ namespace simgrid::mc { /************************************* Take Snapshot ************************************/ /****************************************************************************************/ -void Snapshot::snapshot_regions(RemoteProcess* process) +void Snapshot::snapshot_regions(RemoteProcessMemory* process) { snapshot_regions_.clear(); @@ -74,7 +74,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame, Frame* sco else if (not current_variable.location_list.empty()) { dwarf::Location location = simgrid::dwarf::resolve(current_variable.location_list, current_variable.object_info, &(stack_frame->unw_cursor), (void*)stack_frame->frame_base, - &mc_model_checker->get_remote_process()); + &mc_model_checker->get_remote_process_memory()); xbt_assert(location.in_memory(), "Cannot handle non-address variable"); new_var.address = location.address(); @@ -99,7 +99,7 @@ static std::vector get_local_variables_values(std::vector unwind_stack_frames(UnwindContext* stack_context) { - const RemoteProcess* process = &mc_model_checker->get_remote_process(); + const RemoteProcessMemory* process = &mc_model_checker->get_remote_process_memory(); std::vector result; unw_cursor_t c = stack_context->cursor(); @@ -149,7 +149,7 @@ static std::vector unwind_stack_frames(UnwindContext* stack_ return result; } -void Snapshot::snapshot_stacks(RemoteProcess* process) +void Snapshot::snapshot_stacks(RemoteProcessMemory* process) { for (auto const& stack : process->stack_areas()) { s_mc_snapshot_stack_t st; @@ -174,30 +174,31 @@ void Snapshot::snapshot_stacks(RemoteProcess* process) void Snapshot::handle_ignore() { - xbt_assert(get_remote_process()); + xbt_assert(get_remote_process_memory()); // Copy the memory: - for (auto const& region : get_remote_process()->ignored_regions()) { + for (auto const& region : get_remote_process_memory()->ignored_regions()) { s_mc_snapshot_ignored_data_t ignored_data; ignored_data.start = (void*)region.addr; ignored_data.data.resize(region.size); // TODO, we should do this once per privatization segment: - get_remote_process()->read_bytes(ignored_data.data.data(), region.size, remote(region.addr)); + get_remote_process_memory()->read_bytes(ignored_data.data.data(), region.size, remote(region.addr)); ignored_data_.push_back(std::move(ignored_data)); } // Zero the memory: - for (auto const& region : get_remote_process()->ignored_regions()) - get_remote_process()->clear_bytes(remote(region.addr), region.size); + for (auto const& region : get_remote_process_memory()->ignored_regions()) + get_remote_process_memory()->clear_bytes(remote(region.addr), region.size); } void Snapshot::ignore_restore() const { for (auto const& ignored_data : ignored_data_) - get_remote_process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start)); + get_remote_process_memory()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), + remote(ignored_data.start)); } -Snapshot::Snapshot(long num_state, PageStore& store, RemoteProcess* process) +Snapshot::Snapshot(long num_state, PageStore& store, RemoteProcessMemory* process) : AddressSpace(process), page_store_(store), num_state_(num_state) { XBT_DEBUG("Taking snapshot %ld", num_state); @@ -241,7 +242,7 @@ void* Snapshot::read_bytes(void* buffer, std::size_t size, RemotePtr addre return buffer; } } else - return this->get_remote_process()->read_bytes(buffer, size, address, options); + return this->get_remote_process_memory()->read_bytes(buffer, size, address, options); } /** @brief Find the snapshotted region from a pointer * @@ -270,7 +271,7 @@ Region* Snapshot::get_region(const void* addr, Region* hinted_region) const return get_region(addr); } -void Snapshot::restore(RemoteProcess* process) const +void Snapshot::restore(RemoteProcessMemory* process) const { XBT_DEBUG("Restore snapshot %ld", num_state_); diff --git a/src/mc/sosp/Snapshot.hpp b/src/mc/sosp/Snapshot.hpp index baf06f5611..8f8c43772e 100644 --- a/src/mc/sosp/Snapshot.hpp +++ b/src/mc/sosp/Snapshot.hpp @@ -8,8 +8,8 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/inspect/mc_unw.hpp" -#include "src/mc/remote/RemoteProcess.hpp" #include "src/mc/sosp/Region.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" // ***** MC Snapshot @@ -62,12 +62,13 @@ class XBT_PRIVATE Snapshot final : public AddressSpace { public: /* Initialization */ - Snapshot(long num_state, PageStore& store, RemoteProcess* process = &mc_model_checker->get_remote_process()); + Snapshot(long num_state, PageStore& store, + RemoteProcessMemory* process = &mc_model_checker->get_remote_process_memory()); /* Regular use */ bool on_heap(const void* address) const { - const s_xbt_mheap_t* heap = get_remote_process()->get_heap(); + const s_xbt_mheap_t* heap = get_remote_process_memory()->get_heap(); return address >= heap->heapbase && address < heap->breakval; } @@ -75,7 +76,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(RemoteProcess* process) const; + void restore(RemoteProcessMemory* process) const; bool operator==(const Snapshot& other); bool operator!=(const Snapshot& other) { return not(*this == other); } @@ -92,8 +93,8 @@ public: private: void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size); - void snapshot_regions(RemoteProcess* process); - void snapshot_stacks(RemoteProcess* process); + void snapshot_regions(RemoteProcessMemory* process); + void snapshot_stacks(RemoteProcessMemory* process); void handle_ignore(); void ignore_restore() const; hash_type do_hash() const; diff --git a/src/mc/sosp/Snapshot_test.cpp b/src/mc/sosp/Snapshot_test.cpp index 6c52fb6143..95c10a06ab 100644 --- a/src/mc/sosp/Snapshot_test.cpp +++ b/src/mc/sosp/Snapshot_test.cpp @@ -40,11 +40,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; simgrid::mc::PageStore snap_test_helper::page_store_(500); void snap_test_helper::init_memory(void* mem, size_t size) @@ -60,7 +60,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(nullptr); 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 a9f639d52e..2e50663798 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/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include #include @@ -148,7 +148,7 @@ static void test_deref(simgrid::dwarf::ExpressionContext const& state) int main() { - auto* process = new simgrid::mc::RemoteProcess(getpid()); + auto* process = new simgrid::mc::RemoteProcessMemory(getpid()); process->init(nullptr); simgrid::dwarf::ExpressionContext state; diff --git a/teshsuite/mc/dwarf/dwarf.cpp b/teshsuite/mc/dwarf/dwarf.cpp index 39aec321f7..b564b1caa3 100644 --- a/teshsuite/mc/dwarf/dwarf.cpp +++ b/teshsuite/mc/dwarf/dwarf.cpp @@ -16,7 +16,7 @@ #include "src/mc/inspect/ObjectInformation.hpp" #include "src/mc/inspect/Type.hpp" #include "src/mc/inspect/Variable.hpp" -#include "src/mc/remote/RemoteProcess.hpp" +#include "src/mc/sosp/RemoteProcessMemory.hpp" #include #include @@ -78,7 +78,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::RemoteProcess& process, +static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteProcessMemory& process, simgrid::mc::ObjectInformation* info, const char* name, void* address, long byte_size) { @@ -110,7 +110,7 @@ struct s_foo { int i; }; -static void test_type_by_name(const simgrid::mc::RemoteProcess& process, s_foo /*my_foo*/) +static void test_type_by_name(const simgrid::mc::RemoteProcessMemory& 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()); } @@ -122,7 +122,7 @@ int main(int argc, char** argv) const simgrid::mc::Variable* var; simgrid::mc::Type* type; - simgrid::mc::RemoteProcess process(getpid()); + simgrid::mc::RemoteProcessMemory process(getpid()); process.init(nullptr); 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 a573f980d6..bcb5bdc90b 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -570,17 +570,17 @@ set(MC_SRC src/mc/remote/Channel.hpp src/mc/remote/CheckerSide.cpp src/mc/remote/CheckerSide.hpp - src/mc/remote/RemoteProcess.cpp - src/mc/remote/RemoteProcess.hpp src/mc/remote/RemotePtr.hpp src/mc/remote/mc_protocol.h - + 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/RemoteProcessMemory.cpp + src/mc/sosp/RemoteProcessMemory.hpp src/mc/sosp/Snapshot.cpp src/mc/sosp/Snapshot.hpp