1 /* Copyright (c) 2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
13 #include <simgrid/simix.h>
15 #include "mc_process.h"
16 #include "mc_protocol.h"
19 * @brief (Cross-process, MCer/MCed) Access to SMX structures
21 * We copy some C data structure from the MCed process in the MCer process.
22 * This is implemented by:
24 * - `model_checker->process.smx_process_infos`
25 * (copy of `simix_global->process_list`);
27 * - `model_checker->process.smx_old_process_infos`
28 * (copy of `simix_global->process_to_destroy`);
30 * - `model_checker->hostnames`.
32 * The process lists are currently refreshed each time MCed code is executed.
33 * We don't try to give a persistent MCer address for a given MCed process.
34 * For this reason, a MCer mc_process_t is currently not reusable after
40 struct s_mc_smx_process_info {
41 /** MCed address of the process */
43 /** (Flat) Copy of the process data structure */
44 struct s_smx_process copy;
45 /** Hostname (owned by `mc_modelchecker->hostnames`) */
49 xbt_dynar_t MC_smx_process_info_list_new(void);
51 void MC_process_smx_refresh(mc_process_t process);
53 /** Get the issuer of a simcall (`req->issuer`)
55 * In split-process mode, it does the black magic necessary to get an address
56 * of a (shallow) copy of the data structure the issuer SIMIX process in the local
59 * @param process the MCed process
60 * @param req the simcall (copied in the local process)
62 smx_process_t MC_smx_simcall_get_issuer(smx_simcall_t req);
64 const char* MC_smx_process_get_host_name(smx_process_t p);
66 #define MC_EACH_SIMIX_PROCESS(process, code) \
67 if (MC_process_is_self(&mc_model_checker->process)) { \
68 xbt_swag_foreach(process, simix_global->process_list) { \
72 MC_process_smx_refresh(&mc_model_checker->process); \
73 unsigned int _smx_process_index; \
74 mc_smx_process_info_t _smx_process_info; \
75 xbt_dynar_foreach_ptr(mc_model_checker->process.smx_process_infos, _smx_process_index, _smx_process_info) { \
76 smx_process_t process = &_smx_process_info->copy; \
81 /** Execute a given simcall */
82 void MC_simcall_handle(smx_simcall_t req, int value);
86 /* ***** Resolve (local/MCer structure from remote/MCed addresses) ***** */
88 /** Get a local copy of the process from the process remote address */
89 smx_process_t MC_smx_resolve_process(smx_process_t process_remote_address);
91 /** Get the process info structure from the process remote address */
92 mc_smx_process_info_t MC_smx_resolve_process_info(smx_process_t process_remote_address);