// From PTRACE_O_TRACEEXIT:
#ifdef __linux__
if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) {
- xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status) != -1, "Could not get exit status");
+ int ptrace_res = ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status);
+ xbt_assert(ptrace_res != -1, "Could not get exit status");
if (WIFSIGNALED(status)) {
MC_report_crash(status);
this->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
// Make sure we do not outlive our parent
sigset_t mask;
sigemptyset (&mask);
- xbt_assert(sigprocmask(SIG_SETMASK, &mask, nullptr) >= 0, "Could not unblock signals");
- xbt_assert(prctl(PR_SET_PDEATHSIG, SIGHUP) == 0, "Could not PR_SET_PDEATHSIG");
+ int sigprocmask_res = sigprocmask(SIG_SETMASK, &mask, nullptr);
+ xbt_assert(sigprocmask_res >= 0, "Could not unblock signals");
+ int prctl_res = prctl(PR_SET_PDEATHSIG, SIGHUP);
+ xbt_assert(prctl_res == 0, "Could not PR_SET_PDEATHSIG");
#endif
// Remove CLOEXEC to pass the socket to the application
- int fdflags = fcntl(socket, F_GETFD, 0);
- xbt_assert(fdflags != -1 && fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) != -1,
- "Could not remove CLOEXEC for socket");
+ int fdflags = fcntl(socket, F_GETFD, 0);
+ int fcntl_res = fdflags != -1 ? fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) : -1;
+ xbt_assert(fcntl_res != -1, "Could not remove CLOEXEC for socket");
// Disable lazy relocation in the model-checked process to prevent the application from
// modifying its .got.plt during snapshot.
s_mc_message_initial_addresses_t message{
MessageType::INITIAL_ADDRESSES, mmalloc_preinit(), simgrid::kernel::actor::get_maxpid_addr(),
simgrid::simix::simix_global_get_actors_addr(), simgrid::simix::simix_global_get_dead_actors_addr()};
- xbt_assert(instance_->channel_.send(message) == 0, "Could not send the initial message with addresses.");
+ int send_res = instance_->channel_.send(message);
+ xbt_assert(send_res == 0, "Could not send the initial message with addresses.");
instance_->handle_messages();
return instance_.get();
// Send result:
s_mc_message_int_t answer{MessageType::DEADLOCK_CHECK_REPLY, deadlock};
- xbt_assert(channel_.send(answer) == 0, "Could not send response");
+ int send_res = channel_.send(answer);
+ xbt_assert(send_res == 0, "Could not send response");
}
void AppSide::handle_simcall_execute(const s_mc_message_simcall_handle_t* message) const
{
// Send result:
s_mc_message_simcall_is_visible_answer_t answer{MessageType::SIMCALL_IS_VISIBLE_ANSWER, value};
- xbt_assert(channel_.send(answer) == 0, "Could not send response");
+ int send_res = channel_.send(answer);
+ xbt_assert(send_res == 0, "Could not send response");
break;
}
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
- xbt_assert(channel_.send(answer) == 0, "Could not send response");
+ int send_res = channel_.send(answer);
+ xbt_assert(send_res == 0, "Could not send response");
break;
}
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
- xbt_assert(channel_.send(answer) == 0, "Could not send response");
+ int send_res = channel_.send(answer);
+ xbt_assert(send_res == 0, "Could not send response");
break;
}
SMPI_finalize();
#endif
s_mc_message_int_t answer{MessageType::DEADLOCK_CHECK_REPLY, 0};
- xbt_assert(channel_.send(answer) == 0, "Could answer to FINALIZE");
+ int send_res = channel_.send(answer);
+ xbt_assert(send_res == 0, "Could answer to FINALIZE");
break;
}
{
while (true) {
simgrid::mc::execute_actors();
- xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send WAITING message to model-checker");
+ int send_res = channel_.send(MessageType::WAITING);
+ xbt_assert(send_res == 0, "Could not send WAITING message to model-checker");
this->handle_messages();
}
}