};
// In MC mode, the application sends these pointers to the MC
-void* simix_global_get_actors_addr();
-void* simix_global_get_dead_actors_addr();
+xbt_dynar_t simix_global_get_actors_addr();
+xbt_dynar_t simix_global_get_dead_actors_addr();
} // namespace simix
} // namespace simgrid
{
return maxpid;
}
-void* get_maxpid_addr()
+unsigned long* get_maxpid_addr()
{
return &maxpid;
}
XBT_PUBLIC void create_maestro(const std::function<void()>& code);
XBT_PUBLIC unsigned long get_maxpid();
-XBT_PUBLIC void* get_maxpid_addr(); // In MC mode, the application sends this pointers to the MC
+XBT_PUBLIC unsigned long* get_maxpid_addr(); // In MC mode, the application sends this pointers to the MC
} // namespace actor
} // namespace kernel
if (this->cache_flags_ & RemoteProcess::cache_simix_processes)
return;
- RemotePtr<s_xbt_dynar_t> actor_vector;
- RemotePtr<s_xbt_dynar_t> dead_actor_vector;
- get_actor_vectors(actor_vector, dead_actor_vector);
-
- MC_process_refresh_simix_actor_dynar(this, this->smx_actors_infos, actor_vector);
- MC_process_refresh_simix_actor_dynar(this, this->smx_dead_actors_infos, dead_actor_vector);
+ MC_process_refresh_simix_actor_dynar(this, this->smx_actors_infos, actors_addr_);
+ MC_process_refresh_simix_actor_dynar(this, this->smx_dead_actors_infos, dead_actors_addr_);
this->cache_flags_ |= RemoteProcess::cache_simix_processes;
}
RemoteProcess::RemoteProcess(pid_t pid) : AddressSpace(this), pid_(pid), running_(true) {}
-void RemoteProcess::init(xbt_mheap_t mmalloc_default_mdp, void* maxpid, void* actors, void* dead_actors)
+void RemoteProcess::init(xbt_mheap_t mmalloc_default_mdp, unsigned long* maxpid, xbt_dynar_t actors,
+ xbt_dynar_t dead_actors)
{
this->heap_address = remote(mmalloc_default_mdp);
- this->maxpid_addr_ = maxpid;
- this->actors_addr_ = actors;
- this->dead_actors_addr_ = dead_actors;
+ this->maxpid_addr_ = remote(maxpid);
+ this->actors_addr_ = remote(actors);
+ this->dead_actors_addr_ = remote(dead_actors);
this->memory_map_ = simgrid::xbt::get_memory_map(this->pid_);
this->init_memory_map_info();
_UPT_destroy(context);
unw_destroy_addr_space(as);
}
-
-unsigned long RemoteProcess::get_maxpid() const
-{
- unsigned long maxpid;
- this->read_bytes(&maxpid, sizeof(unsigned long), remote(maxpid_addr_));
- return maxpid;
-}
-
-void RemoteProcess::get_actor_vectors(RemotePtr<s_xbt_dynar_t>& actors, RemotePtr<s_xbt_dynar_t>& dead_actors)
-{
- actors = remote(static_cast<s_xbt_dynar_t*>(actors_addr_));
- dead_actors = remote(static_cast<s_xbt_dynar_t*>(dead_actors_addr_));
-}
} // namespace mc
} // namespace simgrid
public:
explicit RemoteProcess(pid_t pid);
~RemoteProcess() override;
- void init(xbt_mheap_t mmalloc_default_mdp, void* maxpid, void* actors, void* dead_actors);
+ void init(xbt_mheap_t mmalloc_default_mdp, unsigned long* maxpid, xbt_dynar_t actors, xbt_dynar_t dead_actors);
RemoteProcess(RemoteProcess const&) = delete;
RemoteProcess(RemoteProcess&&) = delete;
/* ***************** */
private:
// Cache the address of the variables we read directly in the memory of remote
- void* maxpid_addr_;
- void* actors_addr_;
- void* dead_actors_addr_;
+ RemotePtr<unsigned long> maxpid_addr_;
+ RemotePtr<s_xbt_dynar_t> actors_addr_;
+ RemotePtr<s_xbt_dynar_t> dead_actors_addr_;
public:
std::vector<ActorInformation>& actors();
return nullptr;
}
- unsigned long get_maxpid() const;
- void get_actor_vectors(RemotePtr<s_xbt_dynar_t>& actors, RemotePtr<s_xbt_dynar_t>& dead_actors);
+ unsigned long get_maxpid() const { return this->read(maxpid_addr_); }
void dump_stack() const;
#include "simgrid/forward.h" // aid_t
#include <array>
#include <cstdint>
+#include <xbt/dynar.h>
#include <xbt/mmalloc.h>
#include <xbt/utility.hpp>
struct s_mc_message_initial_addresses_t {
simgrid::mc::MessageType type;
xbt_mheap_t mmalloc_default_mdp;
- void* maxpid;
- void* actors;
- void* dead_actors;
+ unsigned long* maxpid;
+ xbt_dynar_t actors;
+ xbt_dynar_t dead_actors;
};
struct s_mc_message_ignore_heap_t {
namespace simix {
config::Flag<bool> cfg_verbose_exit{"debug/verbose-exit", "Display the actor status at exit", true};
-void* simix_global_get_actors_addr()
+xbt_dynar_t simix_global_get_actors_addr()
{
#if SIMGRID_HAVE_MC
return simix_global->actors_vector;
xbt_die("This function is intended to be used when compiling with MC");
#endif
}
-void* simix_global_get_dead_actors_addr()
+xbt_dynar_t simix_global_get_dead_actors_addr()
{
#if SIMGRID_HAVE_MC
return simix_global->dead_actors_vector;