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
Build ID are somewhat gnu/linux specific.
[simgrid.git]
/
src
/
mc
/
Client.cpp
diff --git
a/src/mc/Client.cpp
b/src/mc/Client.cpp
index
5503344
..
7d326ff
100644
(file)
--- a/
src/mc/Client.cpp
+++ b/
src/mc/Client.cpp
@@
-16,6
+16,8
@@
#include <xbt/mmalloc.h>
#include <xbt/swag.h>
#include <xbt/mmalloc.h>
#include <xbt/swag.h>
+#include <simgrid/modelchecker.h>
+
#include "src/internal_config.h"
#include "src/mc/mc_protocol.h"
#include "src/internal_config.h"
#include "src/mc/mc_protocol.h"
@@
-44,10
+46,7
@@
Client* Client::initialize()
if (client_)
return client_.get();
if (client_)
return client_.get();
- // Check and set the mode:
- if (mc_mode != MC_MODE_NONE)
- abort();
- mc_mode = MC_MODE_CLIENT;
+ _sg_do_model_check = 1;
// Fetch socket from MC_ENV_SOCKET_FD:
char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
// Fetch socket from MC_ENV_SOCKET_FD:
char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
@@
-68,7
+67,7
@@
Client* Client::initialize()
client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
// Wait for the model-checker:
client_ = std::unique_ptr<Client>(new simgrid::mc::Client(fd));
// Wait for the model-checker:
- if (ptrace(PTRACE_TRACEME, 0, nullptr,
NULL
) == -1 || raise(SIGSTOP) != 0)
+ if (ptrace(PTRACE_TRACEME, 0, nullptr,
nullptr
) == -1 || raise(SIGSTOP) != 0)
xbt_die("Could not wait for the model-checker");
client_->handleMessages();
xbt_die("Could not wait for the model-checker");
client_->handleMessages();
@@
-96,7
+95,7
@@
void Client::handleMessages()
{
// Check deadlock:
bool deadlock = false;
{
// Check deadlock:
bool deadlock = false;
- smx_
process
_t process;
+ smx_
actor
_t process;
if (xbt_swag_size(simix_global->process_list)) {
deadlock = true;
xbt_swag_foreach(process, simix_global->process_list)
if (xbt_swag_size(simix_global->process_list)) {
deadlock = true;
xbt_swag_foreach(process, simix_global->process_list)
@@
-124,7
+123,7
@@
void Client::handleMessages()
if (s != sizeof(message))
xbt_die("Unexpected size for SIMCALL_HANDLE");
memcpy(&message, message_buffer, sizeof(message));
if (s != sizeof(message))
xbt_die("Unexpected size for SIMCALL_HANDLE");
memcpy(&message, message_buffer, sizeof(message));
- smx_
process
_t process = SIMIX_process_from_PID(message.pid);
+ smx_
actor
_t process = SIMIX_process_from_PID(message.pid);
if (!process)
xbt_die("Invalid pid %lu", (unsigned long) message.pid);
SIMIX_simcall_handle(&process->simcall, message.value);
if (!process)
xbt_die("Invalid pid %lu", (unsigned long) message.pid);
SIMIX_simcall_handle(&process->simcall, message.value);
@@
-139,13
+138,14
@@
void Client::handleMessages()
if (s != sizeof(message))
xbt_die("Unexpected size for SIMCALL_HANDLE");
memcpy(&message, message_buffer, sizeof(message));
if (s != sizeof(message))
xbt_die("Unexpected size for SIMCALL_HANDLE");
memcpy(&message, message_buffer, sizeof(message));
+#if HAVE_SMPI
smpi_really_switch_data_segment(message.index);
smpi_really_switch_data_segment(message.index);
+#endif
}
break;
default:
}
break;
default:
- xbt_die("%s received unexpected message %s (%i)",
- MC_mode_name(mc_mode),
+ xbt_die("Received unexpected message %s (%i)",
MC_message_type_name(message.type),
message.type
);
MC_message_type_name(message.type),
message.type
);
@@
-156,10
+156,10
@@
void Client::handleMessages()
void Client::mainLoop(void)
{
while (1) {
void Client::mainLoop(void)
{
while (1) {
+ simgrid::mc::wait_for_requests();
if (channel_.send(MC_MESSAGE_WAITING))
xbt_die("Could not send WAITING mesage to model-checker");
this->handleMessages();
if (channel_.send(MC_MESSAGE_WAITING))
xbt_die("Could not send WAITING mesage to model-checker");
this->handleMessages();
- simgrid::mc::wait_for_requests();
}
}
}
}
@@
-228,7
+228,7
@@
void Client::declareSymbol(const char *name, int* value)
xbt_die("Could send REGISTER_SYMBOL message to model-checker");
}
xbt_die("Could send REGISTER_SYMBOL message to model-checker");
}
-void Client::declareStack(void *stack, size_t size, smx_
process
_t process, ucontext_t* context)
+void Client::declareStack(void *stack, size_t size, smx_
actor
_t process, ucontext_t* context)
{
xbt_mheap_t heap = mmalloc_get_current_heap();
{
xbt_mheap_t heap = mmalloc_get_current_heap();