const-ness, try_emplace, attribute noreturn, ...
The most important one is the TransitionObjectAccess one, where a
field in the subclass was hiding a field of the same name in the
superclass. Maybe the bug I was experiencing in that area was related.
m.times_considered_ = times_considered;
checker_side_->get_channel().send(m);
- auto* memory = get_remote_process_memory();
- if (memory != nullptr)
+ if (auto* memory = get_remote_process_memory(); memory != nullptr)
memory->clear_cache();
if (checker_side_->running())
checker_side_->dispatch_events(); // The app may send messages while processing the transition
if (not parent_state_->get_transition()->depends(&transition)) {
- sleep_set_.emplace(aid, transition);
+ sleep_set_.try_emplace(aid, transition);
if (guide->actors_to_run_.count(aid) != 0) {
XBT_DEBUG("Actor %ld will not be explored, for it is in the sleep set", aid);
void set_system_state(std::shared_ptr<Snapshot> state) { system_state_ = std::move(state); }
std::map<aid_t, Transition> const& get_sleep_set() const { return sleep_set_; }
- void add_sleep_set(Transition* t)
+ void add_sleep_set(const Transition* t)
{
sleep_set_.insert_or_assign(t->aid_, Transition(t->type_, t->aid_, t->times_considered_));
}
}
}
-void Exploration::report_crash(int status)
+XBT_ATTRIB_NORETURN void Exploration::report_crash(int status)
{
XBT_INFO("**************************");
XBT_INFO("** CRASH IN THE PROGRAM **");
if (xbt_log_no_loc) {
XBT_INFO("Stack trace not displayed because you passed --log=no_loc");
} else {
- auto* memory = get_remote_app().get_remote_process_memory();
+ const auto* memory = get_remote_app().get_remote_process_memory();
if (memory) {
XBT_INFO("Stack trace:");
memory->dump_stack();
system_exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
}
-void Exploration::report_assertion_failure()
+XBT_ATTRIB_NORETURN void Exploration::report_assertion_failure()
{
XBT_INFO("**************************");
XBT_INFO("*** PROPERTY NOT VALID ***");
system_exit(SIMGRID_MC_EXIT_SAFETY);
}
-void Exploration::system_exit(int status)
+void Exploration::system_exit(int status) const
{
::exit(status);
}
virtual void run() = 0;
/** Produce an error message indicating that the application crashed (status was produced by waitpid) */
- void report_crash(int status);
+ XBT_ATTRIB_NORETURN void report_crash(int status);
/** Produce an error message indicating that a property was violated */
- void report_assertion_failure();
+ XBT_ATTRIB_NORETURN void report_assertion_failure();
/** Kill the application and the model-checker (which exits with `status`)*/
- XBT_ATTRIB_NORETURN void system_exit(int status);
+ XBT_ATTRIB_NORETURN void system_exit(int status) const;
/* These methods are callbacks called by the model-checking engine
* to get and display information about the current state of the
socket_event_ = event_new(
base, get_channel().get_socket(), EV_READ | EV_PERSIST,
- [](evutil_socket_t sig, short events, void* arg) {
+ [](evutil_socket_t, short events, void* arg) {
auto checker = static_cast<simgrid::mc::CheckerSide*>(arg);
if (events == EV_READ) {
std::array<char, MC_MESSAGE_LENGTH> buffer;
s_mc_message_ignore_memory_t message;
xbt_assert(size == sizeof(message), "Broken message");
memcpy(&message, buffer, sizeof(message));
- get_remote_memory()->unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
+ get_remote_memory()->unignore_heap((void*)message.addr, message.size);
} else {
XBT_INFO("Ignoring an UNIGNORE_HEAP message because we don't need to introspect memory.");
}
namespace simgrid::mc {
-Region::Region(PageStore& store, RemoteProcessMemory& memory, RegionType region_type, void* start_addr, size_t size)
+Region::Region(PageStore& store, const RemoteProcessMemory& memory, RegionType region_type, void* start_addr,
+ size_t size)
: region_type_(region_type), start_addr_(start_addr), size_(size)
{
xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize - 1)) == 0, "Start address not at the beginning of a page");
*
* @param region Target region
*/
-void Region::restore(RemoteProcessMemory& memory) const
+void Region::restore(const RemoteProcessMemory& memory) const
{
xbt_assert(((start().address()) & (xbt_pagesize - 1)) == 0, "Not at the beginning of a page");
xbt_assert(simgrid::mc::mmu::chunk_count(size()) == get_chunks().page_count());
ChunkedData chunks_;
public:
- Region(PageStore& store, RemoteProcessMemory& memory, RegionType type, void* start_addr, size_t size);
+ Region(PageStore& store, const RemoteProcessMemory& memory, RegionType type, void* start_addr, size_t size);
Region(Region const&) = delete;
Region& operator=(Region const&) = delete;
Region(Region&& that) = delete;
bool contain(RemotePtr<void> p) const { return p >= start() && p < end(); }
/** @brief Restore a region from a snapshot */
- void restore(RemoteProcessMemory& memory) const;
+ void restore(const RemoteProcessMemory& memory) const;
/** @brief Read memory that was snapshotted in this region
*
}
}
-int some_global_variable = 42;
-void* some_global_pointer = &some_global_variable;
+const int some_global_variable = 42;
+const void* some_global_pointer = &some_global_variable;
void snap_test_helper::read_pointer()
{
prologue_return ret = prologue(1);
{
short s;
xbt_assert(stream >> s >> objaddr_ >> objname_ >> file_ >> line_);
- type_ = static_cast<simgrid::mc::ObjectAccessType>(s);
+ access_type_ = static_cast<simgrid::mc::ObjectAccessType>(s);
}
std::string ObjectAccessTransition::to_string(bool verbose) const
{
std::string res;
- if (type_ == ObjectAccessType::ENTER)
+ if (access_type_ == ObjectAccessType::ENTER)
res = std::string("BeginObjectAccess(");
- else if (type_ == ObjectAccessType::EXIT)
+ else if (access_type_ == ObjectAccessType::EXIT)
res = std::string("EndObjectAccess(");
else
res = std::string("ObjectAccess(");
XBT_DECLARE_ENUM_CLASS(ObjectAccessType, ENTER, EXIT, BOTH);
class ObjectAccessTransition : public Transition {
- ObjectAccessType type_;
+ ObjectAccessType access_type_;
void* objaddr_;
std::string objname_;
std::string file_;