*
* Please don't use directly: you should use MC_is_active. */
extern XBT_PUBLIC(int) _sg_do_model_check;
-extern XBT_PUBLIC(int) _sg_mc_visited;
+extern XBT_PUBLIC(int) _sg_mc_max_visited_states;
#define MC_is_active() _sg_do_model_check
-#define MC_visited_reduction() _sg_mc_visited
+#define MC_visited_reduction() _sg_mc_max_visited_states
/** Assertion for the model-checker
*
extern XBT_PRIVATE int _sg_mc_timeout;
extern XBT_PRIVATE int _sg_mc_hash;
extern XBT_PRIVATE int _sg_mc_max_depth;
-extern XBT_PUBLIC(int) _sg_mc_visited;
+extern XBT_PUBLIC(int) _sg_mc_max_visited_states;
extern XBT_PRIVATE char* _sg_mc_dot_output_file;
extern XBT_PUBLIC(int) _sg_mc_comms_determinism;
extern XBT_PUBLIC(int) _sg_mc_send_determinism;
this->refresh_heap();
return this->heap.get();
}
- malloc_info* get_malloc_info()
+ const malloc_info* get_malloc_info()
{
if (!(this->cache_flags_ & Process::cache_malloc))
this->refresh_malloc_info();
void VisitedStates::prune()
{
- while (states_.size() > (std::size_t) _sg_mc_visited) {
+ while (states_.size() > (std::size_t)_sg_mc_max_visited_states) {
XBT_DEBUG("Try to remove visited state (maximum number of stored states reached)");
auto min_element = boost::range::min_element(states_,
[](std::unique_ptr<simgrid::mc::VisitedState>& a, std::unique_ptr<simgrid::mc::VisitedState>& b) {
bool compare_snapshots = all_communications_are_finished()
&& this->initial_communications_pattern_done;
- if (_sg_mc_visited == 0
- || (visited_state = visitedStates_.addVisitedState(
- expandedStatesCount_, next_state.get(), compare_snapshots)) == nullptr) {
+ if (_sg_mc_max_visited_states == 0 ||
+ (visited_state = visitedStates_.addVisitedState(expandedStatesCount_, next_state.get(), compare_snapshots)) ==
+ nullptr) {
/* Get enabled actors and insert them in the interleave set of the next state */
for (auto& actor : mc_model_checker->process().actors())
*/
int LivenessChecker::insertVisitedPair(std::shared_ptr<VisitedPair> visited_pair, simgrid::mc::Pair* pair)
{
- if (_sg_mc_visited == 0)
+ if (_sg_mc_max_visited_states == 0)
return -1;
if (visited_pair == nullptr)
void LivenessChecker::purgeVisitedPairs()
{
- if (_sg_mc_visited != 0 && visitedPairs_.size() > (std::size_t) _sg_mc_visited) {
+ if (_sg_mc_max_visited_states != 0 && visitedPairs_.size() > (std::size_t)_sg_mc_max_visited_states) {
// Remove the oldest entry with a linear search:
visitedPairs_.erase(boost::min_element(visitedPairs_,
[](std::shared_ptr<VisitedPair> const a, std::shared_ptr<VisitedPair> const& b) {
this->checkNonTermination(next_state.get());
/* Check whether we already explored next_state in the past (but only if interested in state-equality reduction) */
- if (_sg_mc_visited == true)
+ if (_sg_mc_max_visited_states == true)
visitedState_ = visitedStates_.addVisitedState(expandedStatesCount_, next_state.get(), true);
/* If this is a new state (or if we don't care about state-equality reduction) */
#if HAVE_MC
// Fetch from MCed memory:
// HACK, type puning
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
if (mc_model_checker != nullptr) {
+ simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
mc_model_checker->process().read(temp_comm, remote(act));
act = static_cast<simgrid::kernel::activity::Comm*>(temp_comm.getBuffer());
}
snapshot->to_ignore = mc_model_checker->process().ignored_heap();
- if (_sg_mc_visited > 0 || strcmp(_sg_mc_property_file, "")) {
+ if (_sg_mc_max_visited_states > 0 || strcmp(_sg_mc_property_file, "")) {
snapshot->stacks = take_snapshot_stacks(snapshot.get());
if (_sg_mc_hash)
snapshot->hash = simgrid::mc::hash(*snapshot);
char *_sg_mc_property_file = nullptr;
int _sg_mc_hash = 0;
int _sg_mc_max_depth = 1000;
-int _sg_mc_visited = 0;
+int _sg_mc_max_visited_states = 0;
char *_sg_mc_dot_output_file = nullptr;
int _sg_mc_comms_determinism = 0;
int _sg_mc_send_determinism = 0;
xbt_die
("You are specifying a number of stored visited states after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
- _sg_mc_visited = xbt_cfg_get_int(name);
+ _sg_mc_max_visited_states = xbt_cfg_get_int(name);
}
void _mc_cfg_cb_dot_output(const char *name)
if (!req)
return nullptr;
- // Fetch the data of the request and translate it:
-
state->transition.pid = process->pid;
-
state->executed_req = *req;
+ // Fetch the data of the request and translate it:
+ state->internal_req = *req;
/* The waitany and testany request are transformed into a wait or test request
* over the corresponding communication action so it can be treated later by
switch (req->call) {
case SIMCALL_COMM_WAITANY: {
state->internal_req.call = SIMCALL_COMM_WAIT;
- state->internal_req.issuer = req->issuer;
smx_activity_t remote_comm;
read_element(mc_model_checker->process(),
&remote_comm, remote(simcall_comm_waitany__get__comms(req)),
case SIMCALL_COMM_TESTANY:
state->internal_req.call = SIMCALL_COMM_TEST;
- state->internal_req.issuer = req->issuer;
if (state->transition.argument > 0) {
smx_activity_t remote_comm = mc_model_checker->process().read(
break;
case SIMCALL_COMM_WAIT:
- state->internal_req = *req;
mc_model_checker->process().read_bytes(&state->internal_comm ,
sizeof(state->internal_comm), remote(simcall_comm_wait__get__comm(req)));
simcall_comm_wait__set__comm(&state->executed_req, state->internal_comm.getBuffer());
break;
case SIMCALL_COMM_TEST:
- state->internal_req = *req;
mc_model_checker->process().read_bytes(&state->internal_comm,
sizeof(state->internal_comm), remote(simcall_comm_test__get__comm(req)));
simcall_comm_test__set__comm(&state->executed_req, state->internal_comm.getBuffer());
break;
default:
- state->internal_req = *req;
+ /* No translation needed */
break;
}