Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Read rdv->name from MCed in mc_comm_determinism.c
[simgrid.git] / src / mc / mc_comm_determinism.c
index bc1c9ce..aed01ee 100644 (file)
@@ -172,19 +172,33 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
     /* Create comm pattern */
     pattern->type = SIMIX_COMM_SEND;
     pattern->comm = simcall_comm_isend__get__result(request);
-    // TODO, resolve comm
-    // FIXME, remote access to rdv->name
-    pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name);
-    pattern->src_proc = MC_smx_resolve_process(pattern->comm->comm.src_proc)->pid;
+
+    s_smx_synchro_t synchro;
+    MC_process_read_simple(&mc_model_checker->process,
+      &synchro, pattern->comm, sizeof(synchro));
+
+    char* remote_name;
+    MC_process_read_simple(&mc_model_checker->process, &remote_name,
+      synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name,
+      sizeof(remote_name));
+    pattern->rdv =
+      MC_process_read_string(&mc_model_checker->process, remote_name);
+    pattern->src_proc = MC_smx_resolve_process(synchro.comm.src_proc)->pid;
     pattern->src_host = MC_smx_process_get_host_name(issuer);
-    pattern->tag = ((MPI_Request)simcall_comm_isend__get__data(request))->tag;
-    if(pattern->comm->comm.src_buff != NULL){
-      pattern->data_size = pattern->comm->comm.src_buff_size;
+
+    struct s_smpi_mpi_request mpi_request;
+    MC_process_read_simple(&mc_model_checker->process,
+      &mpi_request, (MPI_Request) simcall_comm_isend__get__data(request),
+      sizeof(mpi_request));
+    pattern->tag = mpi_request.tag;
+
+    if(synchro.comm.src_buff != NULL){
+      pattern->data_size = synchro.comm.src_buff_size;
       pattern->data = xbt_malloc0(pattern->data_size);
       MC_process_read_simple(&mc_model_checker->process,
-        pattern->data, pattern->comm->comm.src_buff, pattern->data_size);
+        pattern->data, synchro.comm.src_buff, pattern->data_size);
     }
-    if(((MPI_Request)simcall_comm_isend__get__data(request))->detached){
+    if(mpi_request.detached){
       if (!initial_global_state->initial_communications_pattern_done) {
         /* Store comm pattern */
         xbt_dynar_push(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, pattern->src_proc, mc_list_comm_pattern_t))->list, &pattern);
@@ -198,11 +212,24 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
   } else if (call_type == MC_CALL_TYPE_RECV) {                      
     pattern->type = SIMIX_COMM_RECEIVE;
     pattern->comm = simcall_comm_irecv__get__result(request);
-    // TODO, remote access
-    pattern->tag = ((MPI_Request)simcall_comm_irecv__get__data(request))->tag;
-    pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name);
-    pattern->dst_proc = MC_smx_resolve_process(pattern->comm->comm.dst_proc)->pid;
-    // FIXME, remote process access
+
+    struct s_smpi_mpi_request mpi_request;
+    MC_process_read_simple(&mc_model_checker->process,
+      &mpi_request, (MPI_Request) simcall_comm_irecv__get__data(request),
+      sizeof(mpi_request));
+    pattern->tag = mpi_request.tag;
+
+    s_smx_synchro_t synchro;
+    MC_process_read_simple(&mc_model_checker->process,
+      &synchro, pattern->comm, sizeof(synchro));
+
+    char* remote_name;
+    MC_process_read_simple(&mc_model_checker->process, &remote_name,
+      synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name,
+      sizeof(remote_name));
+    pattern->rdv =
+      MC_process_read_string(&mc_model_checker->process, remote_name);
+    pattern->dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc)->pid;
     pattern->dst_host = MC_smx_process_get_host_name(issuer);
   } else {
     xbt_die("Unexpected call_type %i", (int) call_type);