*/
class AddressSpace {
private:
- RemoteClientMemory* process_;
+ RemoteSimulation* remote_simulation_;
public:
- explicit AddressSpace(RemoteClientMemory* process) : process_(process) {}
+ explicit AddressSpace(RemoteSimulation* remote_simulation) : remote_simulation_(remote_simulation) {}
virtual ~AddressSpace() = default;
/** The process of this address space
*
* This is where we can get debug informations, memory layout, etc.
*/
- simgrid::mc::RemoteClientMemory* process() const { return process_; }
+ simgrid::mc::RemoteSimulation* get_remote_simulation() const { return remote_simulation_; }
/** Read data from the address space
*
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_exit.hpp"
#include "src/mc/mc_private.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include "xbt/automaton.hpp"
#include "xbt/system_error.hpp"
namespace simgrid {
namespace mc {
-ModelChecker::ModelChecker(std::unique_ptr<RemoteClientMemory> process, int sockfd)
- : event_loop_(sockfd), process_(std::move(process))
+ModelChecker::ModelChecker(std::unique_ptr<RemoteSimulation> remote_simulation, int sockfd)
+ : checker_side_(sockfd), remote_simulation_(std::move(remote_simulation))
{
}
void ModelChecker::start()
{
- event_loop_.start(
+ checker_side_.start(
[](evutil_socket_t sig, short events, void* arg) { ((ModelChecker*)arg)->handle_events(sig, events); });
XBT_DEBUG("Waiting for the model-checked process");
int status;
// The model-checked process SIGSTOP itself to signal it's ready:
- const pid_t pid = process_->pid();
+ const pid_t pid = remote_simulation_->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");
- process_->init();
+ remote_simulation_->init();
if (not _sg_mc_dot_output_file.get().empty())
MC_init_dot_output();
void ModelChecker::setup_ignore()
{
- RemoteClientMemory& process = this->process();
+ RemoteSimulation& process = this->get_remote_simulation();
for (std::pair<const char*, const char*> const& var :
ignored_local_variables)
process.ignore_local_variable(var.first, var.second);
{
XBT_DEBUG("Shuting down model-checker");
- RemoteClientMemory* process = &this->process();
+ RemoteSimulation* process = &this->get_remote_simulation();
if (process->running()) {
XBT_DEBUG("Killing process");
kill(process->pid(), SIGKILL);
}
}
-void ModelChecker::resume(RemoteClientMemory& process)
+void ModelChecker::resume(RemoteSimulation& process)
{
- int res = event_loop_.get_channel().send(MC_MESSAGE_CONTINUE);
+ int res = checker_side_.get_channel().send(MC_MESSAGE_CONTINUE);
if (res)
throw xbt::errno_error();
process.clear_cache();
XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
} else {
XBT_INFO("Stack trace:");
- mc_model_checker->process().dump_stack();
+ mc_model_checker->get_remote_simulation().dump_stack();
}
}
region.fragment = message.fragment;
region.address = message.address;
region.size = message.size;
- process().ignore_heap(region);
+ get_remote_simulation().ignore_heap(region);
break;
}
s_mc_message_ignore_memory_t message;
xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
- process().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
+ get_remote_simulation().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
break;
}
s_mc_message_ignore_memory_t message;
xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
- this->process().ignore_region(message.addr, message.size);
+ this->get_remote_simulation().ignore_region(message.addr, message.size);
break;
}
s_mc_message_stack_region_t message;
xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
- this->process().stack_areas().push_back(message.stack_region);
+ this->get_remote_simulation().stack_areas().push_back(message.stack_region);
}
break;
if (property_automaton == nullptr)
property_automaton = xbt_automaton_new();
- RemoteClientMemory* process = &this->process();
+ RemoteSimulation* process = &this->get_remote_simulation();
RemotePtr<int> address = remote((int*)message.data);
xbt::add_proposition(property_automaton, message.name, [process, address]() { return process->read(address); });
void ModelChecker::exit(int status)
{
// TODO, terminate the model checker politely instead of exiting rudely
- if (process().running())
- kill(process().pid(), SIGKILL);
+ if (get_remote_simulation().running())
+ kill(get_remote_simulation().pid(), SIGKILL);
::exit(status);
}
{
if (events == EV_READ) {
char buffer[MC_MESSAGE_LENGTH];
- ssize_t size = event_loop_.get_channel().receive(buffer, sizeof(buffer), false);
+ ssize_t size = checker_side_.get_channel().receive(buffer, sizeof(buffer), false);
if (size == -1 && errno != EAGAIN)
throw simgrid::xbt::errno_error();
if (not handle_message(buffer, size))
- event_loop_.break_loop();
+ checker_side_.break_loop();
}
else if (events == EV_SIGNAL) {
if (sig == SIGCHLD)
if (pid == -1) {
if (errno == ECHILD) {
// No more children:
- xbt_assert(not this->process().running(), "Inconsistent state");
+ xbt_assert(not this->get_remote_simulation().running(), "Inconsistent state");
break;
} else {
XBT_ERROR("Could not wait for pid");
}
}
- if (pid == this->process().pid()) {
+ if (pid == this->get_remote_simulation().pid()) {
// From PTRACE_O_TRACEEXIT:
#ifdef __linux__
if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) {
- xbt_assert(ptrace(PTRACE_GETEVENTMSG, this->process().pid(), 0, &status) != -1, "Could not get exit status");
+ xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_simulation_->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);
XBT_DEBUG("Stopped with signal %i", (int) WSTOPSIG(status));
errno = 0;
#ifdef __linux__
- ptrace(PTRACE_CONT, this->process().pid(), 0, WSTOPSIG(status));
+ ptrace(PTRACE_CONT, remote_simulation_->pid(), 0, WSTOPSIG(status));
#elif defined BSD
- ptrace(PT_CONTINUE, this->process().pid(), (caddr_t)1, WSTOPSIG(status));
+ ptrace(PT_CONTINUE, app_remote_mem_.pid(), (caddr_t)1, WSTOPSIG(status));
#endif
xbt_assert(errno == 0, "Could not PTRACE_CONT");
}
mc_model_checker->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
} else if (WIFEXITED(status)) {
XBT_DEBUG("Child process is over");
- this->process().terminate();
+ this->get_remote_simulation().terminate();
}
}
}
void ModelChecker::wait_for_requests()
{
- this->resume(process());
- if (this->process().running())
- event_loop_.dispatch();
+ this->resume(get_remote_simulation());
+ if (this->get_remote_simulation().running())
+ checker_side_.dispatch();
}
void ModelChecker::handle_simcall(Transition const& transition)
m.type = MC_MESSAGE_SIMCALL_HANDLE;
m.pid = transition.pid_;
m.value = transition.argument_;
- event_loop_.get_channel().send(m);
- this->process_->clear_cache();
- if (this->process_->running())
- event_loop_.dispatch();
+ checker_side_.get_channel().send(m);
+ this->remote_simulation_->clear_cache();
+ if (this->remote_simulation_->running())
+ checker_side_.dispatch();
}
bool ModelChecker::checkDeadlock()
{
- int res = event_loop_.get_channel().send(MC_MESSAGE_DEADLOCK_CHECK);
+ int res = checker_side_.get_channel().send(MC_MESSAGE_DEADLOCK_CHECK);
xbt_assert(res == 0, "Could not check deadlock state");
s_mc_message_int_t message;
- ssize_t s = event_loop_.get_channel().receive(message);
+ ssize_t s = checker_side_.get_channel().receive(message);
xbt_assert(s != -1, "Could not receive message");
xbt_assert(s == sizeof(message) && message.type == MC_MESSAGE_DEADLOCK_CHECK_REPLY,
"Received unexpected message %s (%i, size=%i) "
/** State of the model-checker (global variables for the model checker)
*/
class ModelChecker {
- CheckerSide event_loop_;
+ CheckerSide checker_side_;
/** String pool for host names */
std::set<std::string> hostnames_;
// This is the parent snapshot of the current state:
PageStore page_store_{500};
- std::unique_ptr<RemoteClientMemory> process_;
+ std::unique_ptr<RemoteSimulation> remote_simulation_;
Checker* checker_ = nullptr;
public:
ModelChecker(ModelChecker const&) = delete;
ModelChecker& operator=(ModelChecker const&) = delete;
- explicit ModelChecker(std::unique_ptr<RemoteClientMemory> process, int sockfd);
+ explicit ModelChecker(std::unique_ptr<RemoteSimulation> remote_simulation, int sockfd);
- RemoteClientMemory& process() { return *process_; }
- Channel& channel() { return event_loop_.get_channel(); }
+ RemoteSimulation& get_remote_simulation() { return *remote_simulation_; }
+ Channel& channel() { return checker_side_.get_channel(); }
PageStore& page_store()
{
return page_store_;
void start();
void shutdown();
- void resume(simgrid::mc::RemoteClientMemory& process);
+ void resume(simgrid::mc::RemoteSimulation& get_remote_simulation);
void handle_events(int fd, short events);
void wait_for_requests();
void handle_simcall(Transition const& transition);
xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?");
- auto process = std::unique_ptr<simgrid::mc::RemoteClientMemory>(new simgrid::mc::RemoteClientMemory(pid));
+ auto process = std::unique_ptr<simgrid::mc::RemoteSimulation>(new simgrid::mc::RemoteSimulation(pid));
model_checker_.reset(new simgrid::mc::ModelChecker(std::move(process), sockets[1]));
mc_model_checker = model_checker_.get();
void Session::restore_initial_state()
{
- this->initial_snapshot_->restore(&model_checker_->process());
+ this->initial_snapshot_->restore(&model_checker_->get_remote_simulation());
}
void Session::log_state()
/** @brief Save the current state */
VisitedState::VisitedState(unsigned long state_number) : num(state_number)
{
- simgrid::mc::RemoteClientMemory* process = &(mc_model_checker->process());
+ simgrid::mc::RemoteSimulation* process = &(mc_model_checker->get_remote_simulation());
this->heap_bytes_used = mmalloc_get_bytes_used_remote(
process->get_heap()->heaplimit,
process->get_malloc_info());
- this->actors_count = mc_model_checker->process().actors().size();
+ this->actors_count = mc_model_checker->get_remote_simulation().actors().size();
this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
}
{
// HACK, type punning
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, comm_addr);
+ mc_model_checker->get_remote_simulation().read(temp_comm, comm_addr);
const simgrid::kernel::activity::CommImpl* comm = temp_comm.get_buffer();
- smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->src_actor_.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(comm->dst_actor_.get()));
+ smx_actor_t src_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(comm->src_actor_.get()));
+ smx_actor_t dst_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(comm->dst_actor_.get()));
comm_pattern->src_proc = src_proc->get_pid();
comm_pattern->dst_proc = dst_proc->get_pid();
comm_pattern->src_host = MC_smx_actor_get_host_name(src_proc);
comm_pattern->dst_host = MC_smx_actor_get_host_name(dst_proc);
if (comm_pattern->data.size() == 0 && comm->src_buff_ != nullptr) {
size_t buff_size;
- mc_model_checker->process().read(&buff_size, remote(comm->dst_buff_size_));
+ mc_model_checker->get_remote_simulation().read(&buff_size, remote(comm->dst_buff_size_));
comm_pattern->data.resize(buff_size);
- mc_model_checker->process().read_bytes(comm_pattern->data.data(), comm_pattern->data.size(),
- remote(comm->src_buff_));
+ mc_model_checker->get_remote_simulation().read_bytes(comm_pattern->data.data(), comm_pattern->data.size(),
+ remote(comm->src_buff_));
}
}
pattern->comm_addr = static_cast<kernel::activity::CommImpl*>(simcall_comm_isend__getraw__result(request));
Remote<kernel::activity::CommImpl> temp_synchro;
- mc_model_checker->process().read(temp_synchro,
- remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
+ mc_model_checker->get_remote_simulation().read(
+ temp_synchro, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
const kernel::activity::CommImpl* synchro = static_cast<kernel::activity::CommImpl*>(temp_synchro.get_buffer());
- char* remote_name = mc_model_checker->process().read<char*>(RemotePtr<char*>(
+ char* remote_name = mc_model_checker->get_remote_simulation().read<char*>(RemotePtr<char*>(
(uint64_t)(synchro->get_mailbox() ? &synchro->get_mailbox()->name_ : &synchro->mbox_cpy->name_)));
- pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->src_proc = mc_model_checker->process().resolve_actor(mc::remote(synchro->src_actor_.get()))->get_pid();
+ pattern->rdv = mc_model_checker->get_remote_simulation().read_string(RemotePtr<char>(remote_name));
+ pattern->src_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(mc::remote(synchro->src_actor_.get()))->get_pid();
pattern->src_host = MC_smx_actor_get_host_name(issuer);
#if HAVE_SMPI
if (synchro->src_buff_ != nullptr) {
pattern->data.resize(synchro->src_buff_size_);
- mc_model_checker->process().read_bytes(pattern->data.data(), pattern->data.size(), remote(synchro->src_buff_));
+ mc_model_checker->get_remote_simulation().read_bytes(pattern->data.data(), pattern->data.size(),
+ remote(synchro->src_buff_));
}
#if HAVE_SMPI
if(mpi_request.detached()){
#endif
Remote<kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
+ mc_model_checker->get_remote_simulation().read(
+ temp_comm, remote(static_cast<kernel::activity::CommImpl*>(pattern->comm_addr)));
const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
char* remote_name;
- mc_model_checker->process().read(
+ mc_model_checker->get_remote_simulation().read(
&remote_name, remote(comm->get_mailbox() ? &xbt::string::to_string_data(comm->get_mailbox()->name_).data
: &xbt::string::to_string_data(comm->mbox_cpy->name_).data));
- pattern->rdv = mc_model_checker->process().read_string(RemotePtr<char>(remote_name));
- pattern->dst_proc = mc_model_checker->process().resolve_actor(mc::remote(comm->dst_actor_.get()))->get_pid();
+ pattern->rdv = mc_model_checker->get_remote_simulation().read_string(RemotePtr<char>(remote_name));
+ pattern->dst_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(mc::remote(comm->dst_actor_.get()))->get_pid();
pattern->dst_host = MC_smx_actor_get_host_name(issuer);
} else
xbt_die("Unexpected call_type %i", (int) call_type);
XBT_DEBUG("********* Start communication determinism verification *********");
/* Get an enabled actor and insert it in the interleave set of the initial state */
- for (auto& actor : mc_model_checker->process().actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors())
if (mc::actor_is_enabled(actor.copy.get_buffer()))
initial_state->add_interleaving_set(actor.copy.get_buffer());
/* Intermediate backtracking */
State* last_state = stack_.back().get();
if (last_state->system_state_) {
- last_state->system_state_->restore(&mc_model_checker->process());
+ last_state->system_state_->restore(&mc_model_checker->get_remote_simulation());
MC_restore_communications_pattern(last_state);
return;
}
if (visited_state == nullptr) {
/* Get enabled actors and insert them in the interleave set of the next state */
- for (auto& actor : mc_model_checker->process().actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors())
if (simgrid::mc::actor_is_enabled(actor.copy.get_buffer()))
next_state->add_interleaving_set(actor.copy.get_buffer());
std::shared_ptr<State> graph_state)
: num(pair_num), automaton_state(automaton_state)
{
- RemoteClientMemory* process = &(mc_model_checker->process());
+ RemoteSimulation* process = &(mc_model_checker->get_remote_simulation());
this->graph_state = std::move(graph_state);
if (this->graph_state->system_state_ == nullptr)
this->graph_state->system_state_ = std::make_shared<Snapshot>(pair_num);
this->heap_bytes_used = mmalloc_get_bytes_used_remote(process->get_heap()->heaplimit, process->get_malloc_info());
- this->actors_count = mc_model_checker->process().actors().size();
+ this->actors_count = mc_model_checker->get_remote_simulation().actors().size();
this->other_num = -1;
this->atomic_propositions = std::move(atomic_propositions);
if(_sg_mc_checkpoint > 0) {
const Pair* pair = exploration_stack_.back().get();
if (pair->graph_state->system_state_) {
- pair->graph_state->system_state_->restore(&mc_model_checker->process());
+ pair->graph_state->system_state_->restore(&mc_model_checker->get_remote_simulation());
return;
}
}
else
next_pair->depth = 1;
/* Get enabled actors and insert them in the interleave set of the next graph_state */
- for (auto& actor : mc_model_checker->process().actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors())
if (mc::actor_is_enabled(actor.copy.get_buffer()))
next_pair->graph_state->add_interleaving_set(actor.copy.get_buffer());
next_pair->requests = next_pair->graph_state->interleave_size();
/* If this is a new state (or if we don't care about state-equality reduction) */
if (visited_state_ == nullptr) {
/* Get an enabled process and insert it in the interleave set of the next state */
- for (auto& remoteActor : mc_model_checker->process().actors()) {
+ for (auto& remoteActor : mc_model_checker->get_remote_simulation().actors()) {
auto actor = remoteActor.copy.get_buffer();
if (actor_is_enabled(actor)) {
next_state->add_interleaving_set(actor);
/* Intermediate backtracking */
const State* last_state = stack_.back().get();
if (last_state->system_state_) {
- last_state->system_state_->restore(&mc_model_checker->process());
+ last_state->system_state_->restore(&mc_model_checker->get_remote_simulation());
return;
}
XBT_DEBUG("Initial state");
/* Get an enabled actor and insert it in the interleave set of the initial state */
- for (auto& actor : mc_model_checker->process().actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors())
if (actor_is_enabled(actor.copy.get_buffer())) {
initial_state->add_interleaving_set(actor.copy.get_buffer());
if (reductionMode_ != ReductionMode::none)
static bool is_stack(const void *address)
{
- for (auto const& stack : mc_model_checker->process().stack_areas())
+ for (auto const& stack : mc_model_checker->get_remote_simulation().stack_areas())
if (address == stack.address)
return true;
return false;
// TODO, this should depend on the snapshot?
static bool is_block_stack(int block)
{
- for (auto const& stack : mc_model_checker->process().stack_areas())
+ for (auto const& stack : mc_model_checker->get_remote_simulation().stack_areas())
if (block == stack.block)
return true;
return false;
if ((heap1->heaplimit != heap2->heaplimit) || (heap1->heapsize != heap2->heapsize))
return -1;
this->heaplimit = heap1->heaplimit;
- this->std_heap_copy = *mc_model_checker->process().get_heap();
+ this->std_heap_copy = *mc_model_checker->get_remote_simulation().get_heap();
this->processStates[0].initHeapInformation(heap1, i1);
this->processStates[1].initHeapInformation(heap2, i2);
return 0;
static bool mmalloc_heap_differ(StateComparator& state, const Snapshot& snapshot1, const Snapshot& snapshot2)
{
- const RemoteClientMemory& process = mc_model_checker->process();
+ const RemoteSimulation& process = mc_model_checker->get_remote_simulation();
/* Check busy blocks */
size_t i1 = 1;
const Snapshot& snapshot1, const Snapshot& snapshot2,
HeapLocationPairs* previous, int size, int check_ignore)
{
- const RemoteClientMemory& process = mc_model_checker->process();
+ const RemoteSimulation& 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);
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::RemoteClientMemory& process = mc_model_checker->process();
+ const simgrid::mc::RemoteSimulation& process = mc_model_checker->get_remote_simulation();
ssize_t block1;
ssize_t block2;
// TODO, make this a field of ModelChecker or something similar
static StateComparator state_comparator;
- const RemoteClientMemory& process = mc_model_checker->process();
+ const RemoteSimulation& 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_,
const char* name);
/** Augment the current module with informations about the other ones */
-XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteClientMemory* process,
+XBT_PRIVATE void postProcessObjectInformation(const simgrid::mc::RemoteSimulation* process,
simgrid::mc::ObjectInformation* info);
} // namespace mc
} // namespace simgrid
#include "src/mc/inspect/Variable.hpp"
#include "src/mc/inspect/mc_dwarf.hpp"
#include "src/mc/mc_private.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include <cinttypes>
#include <cstdint>
/*************************************************************************/
-void postProcessObjectInformation(const RemoteClientMemory* process, ObjectInformation* info)
+void postProcessObjectInformation(const RemoteSimulation* process, ObjectInformation* info)
{
for (auto& t : info->types) {
Type* type = &(t.second);
#include "src/mc/inspect/mc_unw.hpp"
#include "src/mc/inspect/Frame.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include <cstring>
return unw_create_addr_space(&UnwindContext::accessors, BYTE_ORDER);
}
-void UnwindContext::initialize(simgrid::mc::RemoteClientMemory* process, unw_context_t* c)
+void UnwindContext::initialize(simgrid::mc::RemoteSimulation* process, unw_context_t* c)
{
this->address_space_ = process;
this->process_ = process;
class UnwindContext {
simgrid::mc::AddressSpace* address_space_ = nullptr;
- simgrid::mc::RemoteClientMemory* process_ = nullptr;
+ simgrid::mc::RemoteSimulation* process_ = nullptr;
unw_context_t unwind_context_;
public:
- void initialize(simgrid::mc::RemoteClientMemory* process, unw_context_t* c);
+ void initialize(simgrid::mc::RemoteSimulation* process, unw_context_t* c);
unw_cursor_t cursor();
private: // Methods and virtual table for libunwind
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/mc/inspect/mc_unw.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include <sys/types.h>
#include <sys/uio.h>
#if SIMGRID_HAVE_MC
#include "src/mc/ModelChecker.hpp"
#include "src/mc/Session.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
using simgrid::mc::remote;
#endif
else {
simgrid::kernel::activity::ActivityImpl* addr;
- addr = mc_model_checker->process().read(remote(simcall_comm_waitany__getraw__comms(req) + value));
+ addr = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__getraw__comms(req) + value));
comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(addr));
}
checker->complete_comm_pattern(comm_addr, MC_smx_simcall_get_issuer(req)->get_pid(), backtracking);
class ChunkedData;
class ModelChecker;
class AddressSpace;
-class RemoteClientMemory;
+class RemoteSimulation;
class Snapshot;
class ObjectInformation;
class Member;
size_t* remote_size = simcall_comm_irecv__get__dst_buff_size(req);
size_t size = 0;
if (remote_size)
- mc_model_checker->process().read_bytes(&size, sizeof(size), remote(remote_size));
+ mc_model_checker->get_remote_simulation().read_bytes(&size, sizeof(size), remote(remote_size));
type = "iRecv";
char* p = pointer_to_string(simcall_comm_irecv__get__dst_buff(req));
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
const simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->process().read(temp_synchro,
- remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(
+ temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
act = temp_synchro.get_buffer();
} else
act = remote_act;
- smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
+ smx_actor_t src_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
+ smx_actor_t dst_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
args = bprintf("comm=%s [(%ld)%s (%s)-> (%ld)%s (%s)]", p, src_proc ? src_proc->get_pid() : 0,
src_proc ? MC_smx_actor_get_host_name(src_proc) : "",
src_proc ? MC_smx_actor_get_name(src_proc) : "", dst_proc ? dst_proc->get_pid() : 0,
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
const simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->process().read(temp_synchro,
- remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(
+ temp_synchro, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
act = temp_synchro.get_buffer();
} else
act = remote_act;
type = "Test TRUE";
p = pointer_to_string(remote_act);
- smx_actor_t src_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
- smx_actor_t dst_proc = mc_model_checker->process().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
+ smx_actor_t src_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(act->src_actor_.get()));
+ smx_actor_t dst_proc =
+ mc_model_checker->get_remote_simulation().resolve_actor(simgrid::mc::remote(act->dst_actor_.get()));
args = bprintf("comm=%s [(%ld)%s (%s) -> (%ld)%s (%s)]", p, src_proc->get_pid(),
MC_smx_actor_get_name(src_proc), MC_smx_actor_get_host_name(src_proc), dst_proc->get_pid(),
MC_smx_actor_get_name(dst_proc), MC_smx_actor_get_host_name(dst_proc));
size_t count = simcall_comm_waitany__get__count(req);
if (count > 0) {
simgrid::kernel::activity::CommImpl* remote_sync;
- remote_sync = mc_model_checker->process().read(remote(simcall_comm_waitany__get__comms(req) + value));
+ remote_sync =
+ mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__get__comms(req) + value));
char* p = pointer_to_string(remote_sync);
args = bprintf("comm=%s (%d of %zu)", p, value + 1, count);
xbt_free(p);
type = "Mutex TRYLOCK";
simgrid::mc::Remote<simgrid::kernel::activity::MutexImpl> mutex;
- mc_model_checker->process().read_bytes(mutex.get_buffer(), sizeof(mutex),
- remote(req->call_ == SIMCALL_MUTEX_LOCK
- ? simcall_mutex_lock__get__mutex(req)
- : simcall_mutex_trylock__get__mutex(req)));
+ mc_model_checker->get_remote_simulation().read_bytes(mutex.get_buffer(), sizeof(mutex),
+ remote(req->call_ == SIMCALL_MUTEX_LOCK
+ ? simcall_mutex_lock__get__mutex(req)
+ : simcall_mutex_trylock__get__mutex(req)));
args = bprintf("locked = %d, owner = %d, sleeping = n/a", mutex.get_buffer()->is_locked(),
mutex.get_buffer()->get_owner() != nullptr
- ? (int)mc_model_checker->process()
+ ? (int)mc_model_checker->get_remote_simulation()
.resolve_actor(simgrid::mc::remote(mutex.get_buffer()->get_owner()))
->get_pid()
: -1);
break;
case SIMCALL_COMM_WAITANY:
- remote_act = mc_model_checker->process().read(remote(simcall_comm_testany__get__comms(req) + idx));
+ remote_act = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_testany__get__comms(req) + idx));
break;
case SIMCALL_COMM_TESTANY:
- remote_act = mc_model_checker->process().read(remote(simcall_comm_testany__get__comms(req) + idx));
+ remote_act = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_testany__get__comms(req) + idx));
break;
default:
}
Remote<kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(remote_act));
+ mc_model_checker->get_remote_simulation().read(temp_comm, remote(remote_act));
const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
return comm->src_actor_.get() && comm->dst_actor_.get();
}
} else {
kernel::activity::ActivityImpl* remote_act = simcall_comm_wait__getraw__comm(req);
Remote<kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(temp_comm,
+ remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
const kernel::actor::ActorImpl* src_proc =
- mc_model_checker->process().resolve_actor(mc::remote(comm->src_actor_.get()));
+ mc_model_checker->get_remote_simulation().resolve_actor(mc::remote(comm->src_actor_.get()));
const kernel::actor::ActorImpl* dst_proc =
- mc_model_checker->process().resolve_actor(mc::remote(comm->dst_actor_.get()));
+ mc_model_checker->get_remote_simulation().resolve_actor(mc::remote(comm->dst_actor_.get()));
if (issuer->get_host())
label =
xbt::string_printf("[(%ld)%s] Wait [(%ld)->(%ld)]", issuer->get_pid(), MC_smx_actor_get_host_name(issuer),
case SIMCALL_COMM_TEST: {
kernel::activity::ActivityImpl* remote_act = simcall_comm_test__getraw__comm(req);
Remote<simgrid::kernel::activity::CommImpl> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
+ mc_model_checker->get_remote_simulation().read(temp_comm,
+ remote(static_cast<kernel::activity::CommImpl*>(remote_act)));
const kernel::activity::CommImpl* comm = temp_comm.get_buffer();
if (comm->src_actor_.get() == nullptr || comm->dst_actor_.get() == nullptr) {
if (issuer->get_host())
* @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::RemoteClientMemory* process,
+static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteSimulation* process,
std::vector<simgrid::mc::ActorInformation>& target,
simgrid::mc::RemotePtr<s_xbt_dynar_t> remote_dynar)
{
namespace simgrid {
namespace mc {
-void RemoteClientMemory::refresh_simix()
+void RemoteSimulation::refresh_simix()
{
- if (this->cache_flags_ & RemoteClientMemory::cache_simix_processes)
+ if (this->cache_flags_ & RemoteSimulation::cache_simix_processes)
return;
// TODO, avoid to reload `&simix_global`, `simix_global`, `*simix_global`
MC_process_refresh_simix_actor_dynar(this, this->smx_dead_actors_infos,
remote(simix_global.get_buffer()->dead_actors_vector));
- this->cache_flags_ |= RemoteClientMemory::cache_simix_processes;
+ this->cache_flags_ |= RemoteSimulation::cache_simix_processes;
}
}
auto address = simgrid::mc::remote(req->issuer_);
// Lookup by address:
- for (auto& actor : mc_model_checker->process().actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors())
if (actor.address == address)
return actor.copy.get_buffer();
- for (auto& actor : mc_model_checker->process().dead_actors())
+ for (auto& actor : mc_model_checker->get_remote_simulation().dead_actors())
if (actor.address == address)
return actor.copy.get_buffer();
if (mc_model_checker == nullptr)
return actor->get_host()->get_cname();
- const simgrid::mc::RemoteClientMemory* process = &mc_model_checker->process();
+ const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
// Read the simgrid::xbt::string in the MCed process:
simgrid::mc::ActorInformation* info = actor_info_cast(actor);
const char* MC_smx_actor_get_name(smx_actor_t actor)
{
- const simgrid::mc::RemoteClientMemory* process = &mc_model_checker->process();
+ const simgrid::mc::RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
if (mc_model_checker == nullptr)
return actor->get_cname();
{
unsigned long maxpid;
const char* name = "simgrid::kernel::actor::maxpid";
- if (mc_model_checker->process().find_variable(name) == nullptr)
+ if (mc_model_checker->get_remote_simulation().find_variable(name) == nullptr)
name = "maxpid"; // We seem to miss the namespaces when compiling with GCC
- mc_model_checker->process().read_variable(name, &maxpid, sizeof(maxpid));
+ mc_model_checker->get_remote_simulation().read_variable(name, &maxpid, sizeof(maxpid));
return maxpid;
}
#ifndef SIMGRID_MC_SMX_HPP
#define SIMGRID_MC_SMX_HPP
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
/** @file
* @brief (Cross-process, MCer/MCed) Access to SMX structures
simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__getraw__comm(&actor->simcall)));
simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
- mc_model_checker->process().read(temp_act, remote_act);
+ mc_model_checker->get_remote_simulation().read(temp_act, remote_act);
const simgrid::kernel::activity::CommImpl* act = temp_act.get_buffer();
if (act->src_actor_.get() && act->dst_actor_.get())
state->transition_.argument_ = 0; // OK
case SIMCALL_COMM_WAITANY: {
state->internal_req_.call_ = SIMCALL_COMM_WAIT;
simgrid::kernel::activity::CommImpl* remote_comm;
- remote_comm = mc_model_checker->process().read(
+ remote_comm = mc_model_checker->get_remote_simulation().read(
remote(simcall_comm_waitany__get__comms(req) + state->transition_.argument_));
- mc_model_checker->process().read(state->internal_comm_, remote(remote_comm));
+ mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(remote_comm));
simcall_comm_wait__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
simcall_comm_wait__set__timeout(&state->internal_req_, 0);
break;
state->internal_req_.call_ = SIMCALL_COMM_TEST;
if (state->transition_.argument_ > 0) {
- simgrid::kernel::activity::CommImpl* remote_comm = mc_model_checker->process().read(
+ simgrid::kernel::activity::CommImpl* remote_comm = mc_model_checker->get_remote_simulation().read(
remote(simcall_comm_testany__get__comms(req) + state->transition_.argument_));
- mc_model_checker->process().read(state->internal_comm_, remote(remote_comm));
+ mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(remote_comm));
}
simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
break;
case SIMCALL_COMM_WAIT:
- mc_model_checker->process().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
- remote(simcall_comm_wait__getraw__comm(req)));
+ mc_model_checker->get_remote_simulation().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
+ remote(simcall_comm_wait__getraw__comm(req)));
simcall_comm_wait__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
simcall_comm_wait__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
break;
case SIMCALL_COMM_TEST:
- mc_model_checker->process().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
- remote(simcall_comm_test__getraw__comm(req)));
+ mc_model_checker->get_remote_simulation().read_bytes(&state->internal_comm_, sizeof(state->internal_comm_),
+ remote(simcall_comm_test__getraw__comm(req)));
simcall_comm_test__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
break;
smx_simcall_t MC_state_choose_request(simgrid::mc::State* state)
{
- for (auto& actor : mc_model_checker->process().actors()) {
+ for (auto& actor : mc_model_checker->get_remote_simulation().actors()) {
/* Only consider the actors that were marked as interleaving by the checker algorithm */
if (not state->actor_states_[actor.copy.get_buffer()->get_pid()].is_todo())
continue;
#define _FILE_OFFSET_BITS 64 /* needed for pread_whole to work as expected on 32bits */
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include "src/mc/mc_smx.hpp"
#include "src/mc/sosp/Snapshot.hpp"
return open(buffer, flags);
}
-// ***** Process
+// ***** RemoteSimulation
-RemoteClientMemory::RemoteClientMemory(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {}
+RemoteSimulation::RemoteSimulation(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {}
-void RemoteClientMemory::init()
+void RemoteSimulation::init()
{
this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_);
this->init_memory_map_info();
this->unw_underlying_context = simgrid::unw::create_context(this->unw_underlying_addr_space, this->pid_);
}
-RemoteClientMemory::~RemoteClientMemory()
+RemoteSimulation::~RemoteSimulation()
{
if (this->memory_file >= 0)
close(this->memory_file);
* Do not use directly, this is used by the getters when appropriate
* in order to have fresh data.
*/
-void RemoteClientMemory::refresh_heap()
+void RemoteSimulation::refresh_heap()
{
// Read/dereference/refresh the std_heap pointer:
if (not this->heap)
this->heap.reset(new s_xbt_mheap_t());
this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address));
- this->cache_flags_ |= RemoteClientMemory::cache_heap;
+ this->cache_flags_ |= RemoteSimulation::cache_heap;
}
/** Refresh the information about the process
* Do not use directly, this is used by the getters when appropriate
* in order to have fresh data.
* */
-void RemoteClientMemory::refresh_malloc_info()
+void RemoteSimulation::refresh_malloc_info()
{
// Refresh process->heapinfo:
- if (this->cache_flags_ & RemoteClientMemory::cache_malloc)
+ if (this->cache_flags_ & RemoteSimulation::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_ |= RemoteClientMemory::cache_malloc;
+ this->cache_flags_ |= RemoteSimulation::cache_malloc;
}
/** @brief Finds the range of the different memory segments and binary paths */
-void RemoteClientMemory::init_memory_map_info()
+void RemoteSimulation::init_memory_map_info()
{
XBT_DEBUG("Get debug information ...");
this->maestro_stack_start_ = nullptr;
XBT_DEBUG("Get debug information done !");
}
-std::shared_ptr<simgrid::mc::ObjectInformation> RemoteClientMemory::find_object_info(RemotePtr<void> addr) const
+std::shared_ptr<simgrid::mc::ObjectInformation> RemoteSimulation::find_object_info(RemotePtr<void> 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)
return nullptr;
}
-std::shared_ptr<ObjectInformation> RemoteClientMemory::find_object_info_exec(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteSimulation::find_object_info_exec(RemotePtr<void> addr) const
{
for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
if (addr.address() >= (std::uint64_t)info->start_exec && addr.address() <= (std::uint64_t)info->end_exec)
return nullptr;
}
-std::shared_ptr<ObjectInformation> RemoteClientMemory::find_object_info_rw(RemotePtr<void> addr) const
+std::shared_ptr<ObjectInformation> RemoteSimulation::find_object_info_rw(RemotePtr<void> addr) const
{
for (std::shared_ptr<ObjectInformation> const& info : this->object_infos)
if (addr.address() >= (std::uint64_t)info->start_rw && addr.address() <= (std::uint64_t)info->end_rw)
return nullptr;
}
-simgrid::mc::Frame* RemoteClientMemory::find_function(RemotePtr<void> ip) const
+simgrid::mc::Frame* RemoteSimulation::find_function(RemotePtr<void> ip) const
{
std::shared_ptr<simgrid::mc::ObjectInformation> info = this->find_object_info_exec(ip);
return info ? info->find_function((void*)ip.address()) : nullptr;
/** Find (one occurrence of) the named variable definition
*/
-const simgrid::mc::Variable* RemoteClientMemory::find_variable(const char* name) const
+const simgrid::mc::Variable* RemoteSimulation::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
return nullptr;
}
-void RemoteClientMemory::read_variable(const char* name, void* target, size_t size) const
+void RemoteSimulation::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);
this->read_bytes(target, size, remote(var->address));
}
-std::string RemoteClientMemory::read_string(RemotePtr<char> address) const
+std::string RemoteSimulation::read_string(RemotePtr<char> address) const
{
if (not address)
return {};
}
}
-void* RemoteClientMemory::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
- ReadOptions /*options*/) const
+void* RemoteSimulation::read_bytes(void* buffer, std::size_t size, RemotePtr<void> 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_);
* @param len data size
* @param address target process memory address (target)
*/
-void RemoteClientMemory::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
+void RemoteSimulation::write_bytes(const void* buffer, size_t len, RemotePtr<void> address)
{
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 RemoteClientMemory::clear_bytes(RemotePtr<void> address, size_t len)
+void RemoteSimulation::clear_bytes(RemotePtr<void> address, size_t len)
{
pthread_once(&zero_buffer_flag, zero_buffer_init);
while (len) {
}
}
-void RemoteClientMemory::ignore_region(std::uint64_t addr, std::size_t size)
+void RemoteSimulation::ignore_region(std::uint64_t addr, std::size_t size)
{
IgnoredRegion region;
region.addr = addr;
ignored_regions_.insert(ignored_regions_.begin() + position, region);
}
-void RemoteClientMemory::ignore_heap(IgnoredHeapRegion const& region)
+void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region)
{
if (ignored_heap_.empty()) {
ignored_heap_.push_back(std::move(region));
ignored_heap_.insert(ignored_heap_.begin() + cursor, region);
}
-void RemoteClientMemory::unignore_heap(void* address, size_t size)
+void RemoteSimulation::unignore_heap(void* address, size_t size)
{
typedef std::vector<IgnoredHeapRegion>::size_type size_type;
}
}
-void RemoteClientMemory::ignore_local_variable(const char* var_name, const char* frame_name)
+void RemoteSimulation::ignore_local_variable(const char* var_name, const char* frame_name)
{
if (frame_name != nullptr && strcmp(frame_name, "*") == 0)
frame_name = nullptr;
info->remove_local_variable(var_name, frame_name);
}
-std::vector<simgrid::mc::ActorInformation>& RemoteClientMemory::actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteSimulation::actors()
{
this->refresh_simix();
return smx_actors_infos;
}
-std::vector<simgrid::mc::ActorInformation>& RemoteClientMemory::dead_actors()
+std::vector<simgrid::mc::ActorInformation>& RemoteSimulation::dead_actors()
{
this->refresh_simix();
return smx_dead_actors_infos;
}
-void RemoteClientMemory::dump_stack()
+void RemoteSimulation::dump_stack()
{
unw_addr_space_t as = unw_create_addr_space(&_UPT_accessors, BYTE_ORDER);
if (as == nullptr) {
* - stack unwinding;
* - etc.
*/
-class RemoteClientMemory final : public AddressSpace {
+class RemoteSimulation 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_simix_processes = 4;
public:
- RemoteClientMemory(pid_t pid);
- ~RemoteClientMemory();
+ RemoteSimulation(pid_t pid);
+ ~RemoteSimulation();
void init();
- RemoteClientMemory(RemoteClientMemory const&) = delete;
- RemoteClientMemory(RemoteClientMemory&&) = delete;
- RemoteClientMemory& operator=(RemoteClientMemory const&) = delete;
- RemoteClientMemory& operator=(RemoteClientMemory&&) = delete;
+ RemoteSimulation(RemoteSimulation const&) = delete;
+ RemoteSimulation(RemoteSimulation&&) = delete;
+ RemoteSimulation& operator=(RemoteSimulation const&) = delete;
+ RemoteSimulation& operator=(RemoteSimulation&&) = delete;
// Read memory:
void* read_bytes(void* buffer, std::size_t size, RemotePtr<void> address,
// Heap access:
xbt_mheap_t get_heap()
{
- if (not(this->cache_flags_ & RemoteClientMemory::cache_heap))
+ if (not(this->cache_flags_ & RemoteSimulation::cache_heap))
this->refresh_heap();
return this->heap.get();
}
const malloc_info* get_malloc_info()
{
- if (not(this->cache_flags_ & RemoteClientMemory::cache_malloc))
+ if (not(this->cache_flags_ & RemoteSimulation::cache_malloc))
this->refresh_malloc_info();
return this->heap_info.data();
}
- void clear_cache() { this->cache_flags_ = RemoteClientMemory::cache_none; }
+ void clear_cache() { this->cache_flags_ = RemoteSimulation::cache_none; }
std::vector<IgnoredRegion> const& ignored_regions() const { return ignored_regions_; }
void ignore_region(std::uint64_t address, std::size_t size);
void refresh_malloc_info();
void refresh_simix();
- pid_t pid_ = -1;
+ pid_t pid_ = -1;
bool running_ = false;
std::vector<xbt::VmMap> memory_map_;
RemotePtr<void> maestro_stack_start_;
private:
/** State of the cache (which variables are up to date) */
- int cache_flags_ = RemoteClientMemory::cache_none;
+ int cache_flags_ = RemoteSimulation::cache_none;
public:
/** Address of the heap structure in the MCed process. */
{
xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize - 1)) == 0, "Start address not at the beginning of a page");
- chunks_ = ChunkedData(mc_model_checker->page_store(), mc_model_checker->process(), RemotePtr<void>(start_addr),
- mmu::chunk_count(size));
+ chunks_ = ChunkedData(mc_model_checker->page_store(), mc_model_checker->get_remote_simulation(),
+ RemotePtr<void>(start_addr), mmu::chunk_count(size));
}
/** @brief Restore a region from a snapshot
for (size_t i = 0; i != get_chunks().page_count(); ++i) {
void* 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->process().write_bytes(source_page, xbt_pagesize, remote(target_page));
+ mc_model_checker->get_remote_simulation().write_bytes(source_page, xbt_pagesize, remote(target_page));
}
}
/************************************* Take Snapshot ************************************/
/****************************************************************************************/
-void Snapshot::snapshot_regions(RemoteClientMemory* process)
+void Snapshot::snapshot_regions(RemoteSimulation* process)
{
snapshot_regions_.clear();
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->process());
+ &mc_model_checker->get_remote_simulation());
if (not location.in_memory())
xbt_die("Cannot handle non-address variable");
static std::vector<s_mc_stack_frame_t> unwind_stack_frames(UnwindContext* stack_context)
{
- const RemoteClientMemory* process = &mc_model_checker->process();
+ const RemoteSimulation* process = &mc_model_checker->get_remote_simulation();
std::vector<s_mc_stack_frame_t> result;
unw_cursor_t c = stack_context->cursor();
return result;
}
-void Snapshot::snapshot_stacks(RemoteClientMemory* process)
+void Snapshot::snapshot_stacks(RemoteSimulation* process)
{
for (auto const& stack : process->stack_areas()) {
s_mc_snapshot_stack_t st;
static void snapshot_handle_ignore(Snapshot* snapshot)
{
- xbt_assert(snapshot->process());
+ xbt_assert(snapshot->get_remote_simulation());
// Copy the memory:
- for (auto const& region : snapshot->process()->ignored_regions()) {
+ for (auto const& region : snapshot->get_remote_simulation()->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:
- snapshot->process()->read_bytes(ignored_data.data.data(), region.size, remote(region.addr));
+ snapshot->get_remote_simulation()->read_bytes(ignored_data.data.data(), region.size, remote(region.addr));
snapshot->ignored_data_.push_back(std::move(ignored_data));
}
// Zero the memory:
- for (auto const& region : snapshot->process()->ignored_regions())
- snapshot->process()->clear_bytes(remote(region.addr), region.size);
+ for (auto const& region : snapshot->get_remote_simulation()->ignored_regions())
+ snapshot->get_remote_simulation()->clear_bytes(remote(region.addr), region.size);
}
static void snapshot_ignore_restore(const simgrid::mc::Snapshot* snapshot)
{
for (auto const& ignored_data : snapshot->ignored_data_)
- snapshot->process()->write_bytes(ignored_data.data.data(), ignored_data.data.size(), remote(ignored_data.start));
+ snapshot->get_remote_simulation()->write_bytes(ignored_data.data.data(), ignored_data.data.size(),
+ remote(ignored_data.start));
}
-Snapshot::Snapshot(int num_state, RemoteClientMemory* process) : AddressSpace(process), num_state_(num_state)
+Snapshot::Snapshot(int num_state, RemoteSimulation* process) : AddressSpace(process), num_state_(num_state)
{
XBT_DEBUG("Taking snapshot %i", num_state);
return buffer;
}
} else
- return this->process()->read_bytes(buffer, size, address, options);
+ return this->get_remote_simulation()->read_bytes(buffer, size, address, options);
}
/** @brief Find the snapshotted region from a pointer
*
return get_region(addr);
}
-void Snapshot::restore(RemoteClientMemory* process)
+void Snapshot::restore(RemoteSimulation* process)
{
XBT_DEBUG("Restore snapshot %i", num_state_);
#include "src/mc/ModelChecker.hpp"
#include "src/mc/inspect/mc_unw.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include "src/mc/sosp/Region.hpp"
// ***** MC Snapshot
class XBT_PRIVATE Snapshot final : public AddressSpace {
public:
/* Initialization */
- Snapshot(int num_state, RemoteClientMemory* process = &mc_model_checker->process());
+ Snapshot(int num_state, RemoteSimulation* get_remote_simulation = &mc_model_checker->get_remote_simulation());
~Snapshot() = default;
/* Regular use */
bool on_heap(const void* address) const
{
- const s_xbt_mheap_t* heap = process()->get_heap();
+ const s_xbt_mheap_t* heap = get_remote_simulation()->get_heap();
return address >= heap->heapbase && address < heap->breakval;
}
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(RemoteClientMemory* process);
+ void restore(RemoteSimulation* get_remote_simulation);
// To be private
int num_state_;
private:
void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size);
- void snapshot_regions(RemoteClientMemory* process);
- void snapshot_stacks(RemoteClientMemory* process);
+ void snapshot_regions(RemoteSimulation* get_remote_simulation);
+ void snapshot_stacks(RemoteSimulation* get_remote_simulation);
};
} // namespace mc
} // namespace simgrid
mc_model_checker = nullptr;
}
- static std::unique_ptr<simgrid::mc::RemoteClientMemory> process;
+ static std::unique_ptr<simgrid::mc::RemoteSimulation> process;
};
// static member variables init.
-std::unique_ptr<simgrid::mc::RemoteClientMemory> snap_test_helper::process = nullptr;
+std::unique_ptr<simgrid::mc::RemoteSimulation> snap_test_helper::process = nullptr;
void snap_test_helper::init_memory(void* mem, size_t size)
{
REQUIRE(xbt_pagesize == getpagesize());
REQUIRE(1 << xbt_pagebits == xbt_pagesize);
- process.reset(new simgrid::mc::RemoteClientMemory(getpid()));
+ process.reset(new simgrid::mc::RemoteSimulation(getpid()));
process->init();
mc_model_checker = new ::simgrid::mc::ModelChecker(std::move(process), -1);
}
#include "src/mc/inspect/ObjectInformation.hpp"
#include "src/mc/inspect/Type.hpp"
#include "src/mc/inspect/Variable.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include <cassert>
#include <cstdlib>
static std::default_random_engine rnd_engine;
-static simgrid::mc::RemoteClientMemory* process;
+static simgrid::mc::RemoteSimulation* process;
static uintptr_t eval_binary_operation(simgrid::dwarf::ExpressionContext const& state, int op, uintptr_t a, uintptr_t b)
{
int main()
{
- process = new simgrid::mc::RemoteClientMemory(getpid());
+ process = new simgrid::mc::RemoteSimulation(getpid());
process->init();
simgrid::dwarf::ExpressionContext state;
#include "src/mc/inspect/ObjectInformation.hpp"
#include "src/mc/inspect/Type.hpp"
#include "src/mc/inspect/Variable.hpp"
-#include "src/mc/remote/RemoteClientMemory.hpp"
+#include "src/mc/remote/RemoteSimulation.hpp"
#include <cassert>
#include <cstring>
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::RemoteClientMemory& process,
+static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteSimulation& process,
const simgrid::mc::ObjectInformation* info, const char* name,
void* address, long byte_size)
{
int i;
};
-static void test_type_by_name(const simgrid::mc::RemoteClientMemory& process, s_foo /*my_foo*/)
+static void test_type_by_name(const simgrid::mc::RemoteSimulation& 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());
}
const simgrid::mc::Variable* var;
simgrid::mc::Type* type;
- simgrid::mc::RemoteClientMemory process(getpid());
+ simgrid::mc::RemoteSimulation process(getpid());
process.init();
test_global_variable(process, process.binary_info.get(), "some_local_variable", &some_local_variable, sizeof(int));
src/mc/remote/Channel.hpp
src/mc/remote/CheckerSide.cpp
src/mc/remote/CheckerSide.hpp
- src/mc/remote/RemoteClientMemory.hpp
- src/mc/remote/RemoteClientMemory.cpp
+ src/mc/remote/RemoteSimulation.hpp
+ src/mc/remote/RemoteSimulation.cpp
src/mc/remote/RemotePtr.hpp
src/mc/remote/mc_protocol.h
src/mc/remote/mc_protocol.cpp