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] Move methods in Process class
[simgrid.git]
/
src
/
mc
/
mc_server.cpp
diff --git
a/src/mc/mc_server.cpp
b/src/mc/mc_server.cpp
index
4b8da8b
..
ef4dae3
100644
(file)
--- a/
src/mc/mc_server.cpp
+++ b/
src/mc/mc_server.cpp
@@
-15,11
+15,16
@@
#include <xbt/log.h>
#include <xbt/log.h>
-#include "
mc_model_checker.h
"
+#include "
ModelChecker.hpp
"
#include "mc_protocol.h"
#include "mc_server.h"
#include "mc_private.h"
#include "mc_ignore.h"
#include "mc_protocol.h"
#include "mc_server.h"
#include "mc_private.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");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_server, mc, "MC server logic");
@@
-39,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, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
- &value, callback->value, sizeof(value), MC_PROCESS_INDEX_ANY);
+ callback->process->read_bytes(&value, sizeof(value), remote(callback->value));
return value;
}
return value;
}
@@
-90,7
+94,7
@@
void s_mc_server::shutdown()
{
XBT_DEBUG("Shuting down model-checker");
{
XBT_DEBUG("Shuting down model-checker");
- mc_process_t process = &mc_model_checker->process;
+ mc_process_t process = &mc_model_checker->process
()
;
int status = process->status;
if (process->running) {
XBT_DEBUG("Killing process");
int status = process->status;
if (process->running) {
XBT_DEBUG("Killing process");
@@
-105,13
+109,13
@@
void s_mc_server::shutdown()
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");
@@
-124,7
+128,7
@@
void s_mc_server::resume(mc_process_t process)
int res = MC_protocol_send_simple_message(socket, MC_MESSAGE_CONTINUE);
if (res)
throw std::system_error(res, std::system_category());
int res = MC_protocol_send_simple_message(socket, MC_MESSAGE_CONTINUE);
if (res)
throw std::system_error(res, std::system_category());
- process->cache_flags = (
e_
mc_process_cache_flags_t) 0;
+ process->cache_flags = (mc_process_cache_flags_t) 0;
}
static
}
static
@@
-184,7
+188,7
@@
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_
remove_ignore_heap
(message.addr, message.size);
+ MC_
heap_region_ignore_remove
(message.addr, message.size);
break;
}
break;
}
@@
-194,7
+198,7
@@
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,
+ MC_process_ignore_memory(&mc_model_checker->process
()
,
message.addr, message.size);
break;
}
message.addr, message.size);
break;
}
@@
-222,7
+226,7
@@
bool s_mc_server::handle_events()
XBT_DEBUG("Received symbol: %s", message.name);
struct mc_symbol_pointer_callback* callback = xbt_new(struct mc_symbol_pointer_callback, 1);
XBT_DEBUG("Received symbol: %s", message.name);
struct mc_symbol_pointer_callback* callback = xbt_new(struct mc_symbol_pointer_callback, 1);
- callback->process = &mc_model_checker->process;
+ callback->process = &mc_model_checker->process
()
;
callback->value = message.data;
MC_automaton_new_propositional_symbol_callback(message.name,
callback->value = message.data;
MC_automaton_new_propositional_symbol_callback(message.name,
@@
-268,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();
}
@@
-301,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;
@@
-311,11
+315,11
@@
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
()
.status = status;
+ mc_model_checker->process
()
.running = false;
}
}
}
}
}
}
@@
-335,7
+339,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;
}
@@
-348,9
+352,9
@@
void MC_server_simcall_handle(mc_process_t process, unsigned long pid, int value
m.type = MC_MESSAGE_SIMCALL_HANDLE;
m.pid = pid;
m.value = value;
m.type = MC_MESSAGE_SIMCALL_HANDLE;
m.pid = pid;
m.value = value;
- MC_protocol_send(mc_model_checker->process.socket, &m, sizeof(m));
- process->cache_flags = (
e_
mc_process_cache_flags_t) 0;
- while (mc_model_checker->process.running) {
+ 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) {
if (!mc_server->handle_events())
return;
}
if (!mc_server->handle_events())
return;
}
@@
-360,3
+364,5
@@
void MC_server_loop(mc_server_t server)
{
server->loop();
}
{
server->loop();
}
+
+}