A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[mc] Mark some Process attributes as private
[simgrid.git]
/
src
/
mc
/
mc_server.cpp
diff --git
a/src/mc/mc_server.cpp
b/src/mc/mc_server.cpp
index
7613b16
..
9ea15bd
100644
(file)
--- a/
src/mc/mc_server.cpp
+++ b/
src/mc/mc_server.cpp
@@
-22,6
+22,8
@@
#include "mc_ignore.h"
#include "mcer_ignore.h"
#include "mc_ignore.h"
#include "mcer_ignore.h"
+using simgrid::mc::remote;
+
extern "C" {
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_server, mc, "MC server logic");
extern "C" {
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_server, mc, "MC server logic");
@@
-42,8
+44,7
@@
static int mc_symbol_pointer_callback_evaluate(void* p)
{
struct mc_symbol_pointer_callback* callback = (struct mc_symbol_pointer_callback*) p;
int value;
{
struct mc_symbol_pointer_callback* callback = (struct mc_symbol_pointer_callback*) p;
int value;
- MC_process_read(callback->process, simgrid::mc::AddressSpace::Normal,
- &value, callback->value, sizeof(value), simgrid::mc::ProcessIndexAny);
+ callback->process->read_bytes(&value, sizeof(value), remote(callback->value));
return value;
}
return value;
}
@@
-94,27
+95,27
@@
void s_mc_server::shutdown()
XBT_DEBUG("Shuting down model-checker");
mc_process_t process = &mc_model_checker->process();
XBT_DEBUG("Shuting down model-checker");
mc_process_t process = &mc_model_checker->process();
- int status = process->status;
- if (process->running) {
+ int status = process->status
()
;
+ if (process->running
()
) {
XBT_DEBUG("Killing process");
XBT_DEBUG("Killing process");
- kill(process->pid, SIGTERM);
- if (waitpid(process->pid, &status, 0) == -1)
+ kill(process->pid
()
, SIGTERM);
+ if (waitpid(process->pid
()
, &status, 0) == -1)
throw std::system_error(errno, std::system_category());
// TODO, handle the case when the process does not want to die with a timeout
throw std::system_error(errno, std::system_category());
// TODO, handle the case when the process does not want to die with a timeout
- process->
status = status
;
+ process->
terminate(status)
;
}
}
void s_mc_server::exit()
{
// Finished:
}
}
void s_mc_server::exit()
{
// Finished:
- int status = mc_model_checker->process().status;
+ int status = mc_model_checker->process().status
()
;
if (WIFEXITED(status))
::exit(WEXITSTATUS(status));
else if (WIFSIGNALED(status)) {
// Try to uplicate the signal of the model-checked process.
// This is a temporary hack so we don't try too hard.
if (WIFEXITED(status))
::exit(WEXITSTATUS(status));
else if (WIFSIGNALED(status)) {
// Try to uplicate the signal of the model-checked process.
// This is a temporary hack so we don't try too hard.
- kill(mc_model_checker->process().pid, WTERMSIG(status));
+ kill(mc_model_checker->process().pid
()
, WTERMSIG(status));
abort();
} else {
xbt_die("Unexpected status from model-checked process");
abort();
} else {
xbt_die("Unexpected status from model-checked process");
@@
-197,8
+198,8
@@
bool s_mc_server::handle_events()
if (size != sizeof(message))
xbt_die("Broken messsage");
memcpy(&message, buffer, sizeof(message));
if (size != sizeof(message))
xbt_die("Broken messsage");
memcpy(&message, buffer, sizeof(message));
- MC_process_ignore_memory(&mc_model_checker->process(),
- message.addr, message.size);
+ mc_model_checker->process().ignore_region(
+
(std::uint64_t)
message.addr, message.size);
break;
}
break;
}
@@
-271,7
+272,7
@@
bool s_mc_server::handle_events()
void s_mc_server::loop()
{
void s_mc_server::loop()
{
- while (mc_model_checker->process().running)
+ while (mc_model_checker->process().running
()
)
this->handle_events();
}
this->handle_events();
}
@@
-304,7
+305,7
@@
void s_mc_server::handle_waitpid()
if (pid == -1) {
if (errno == ECHILD) {
// No more children:
if (pid == -1) {
if (errno == ECHILD) {
// No more children:
- if (mc_model_checker->process().running)
+ if (mc_model_checker->process().running
()
)
xbt_die("Inconsistent state");
else
break;
xbt_die("Inconsistent state");
else
break;
@@
-314,11
+315,10
@@
void s_mc_server::handle_waitpid()
}
}
}
}
- if (pid == mc_model_checker->process().pid) {
+ if (pid == mc_model_checker->process().pid
()
) {
if (WIFEXITED(status) || WIFSIGNALED(status)) {
XBT_DEBUG("Child process is over");
if (WIFEXITED(status) || WIFSIGNALED(status)) {
XBT_DEBUG("Child process is over");
- mc_model_checker->process().status = status;
- mc_model_checker->process().running = false;
+ mc_model_checker->process().terminate(status);
}
}
}
}
}
}
@@
-338,7
+338,7
@@
void s_mc_server::on_signal(const struct signalfd_siginfo* info)
void MC_server_wait_client(mc_process_t process)
{
mc_server->resume(process);
void MC_server_wait_client(mc_process_t process)
{
mc_server->resume(process);
- while (mc_model_checker->process().running) {
+ while (mc_model_checker->process().running
()
) {
if (!mc_server->handle_events())
return;
}
if (!mc_server->handle_events())
return;
}
@@
-353,7
+353,7
@@
void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value
m.value = value;
MC_protocol_send(mc_model_checker->process().socket, &m, sizeof(m));
process->cache_flags = (mc_process_cache_flags_t) 0;
m.value = value;
MC_protocol_send(mc_model_checker->process().socket, &m, sizeof(m));
process->cache_flags = (mc_process_cache_flags_t) 0;
- while (mc_model_checker->process().running) {
+ while (mc_model_checker->process().running
()
) {
if (!mc_server->handle_events())
return;
}
if (!mc_server->handle_events())
return;
}