#ifndef MC_PROCESS_H
#define MC_PROCESS_H
-#include <stdbool.h>
+#include <type_traits>
+
#include <sys/types.h>
#include <vector>
pid_t pid() const { return pid_; }
+ bool in_maestro_stack(remote_ptr<void> p) const
+ {
+ return p >= this->maestro_stack_start_ && p < this->maestro_stack_end_;
+ }
+
+ bool running() const
+ {
+ return running_;
+ }
+
+ void terminate(int status)
+ {
+ status_ = status;
+ running_ = false;
+ }
+
+ int status() const
+ {
+ return status_;
+ }
+
+ template<class M>
+ typename std::enable_if< std::is_class<M>::value && std::is_trivial<M>::value, int >::type
+ send_message(M const& m)
+ {
+ return MC_protocol_send(this->socket_, &m, sizeof(M));
+ }
+
+ int send_message(e_mc_message_type message_id)
+ {
+ return MC_protocol_send_simple_message(this->socket_, message_id);
+ }
+
+ template<class M>
+ typename std::enable_if< std::is_class<M>::value && std::is_trivial<M>::value, ssize_t >::type
+ receive_message(M& m)
+ {
+ return MC_receive_message(this->socket_, &m, sizeof(M), 0);
+ }
+
private:
void init_memory_map_info();
void refresh_heap();
private:
mc_process_flags_t process_flags;
pid_t pid_;
-public: // to be private
- int socket;
- int status;
- bool running;
- memory_map_t memory_map;
- void *maestro_stack_start, *maestro_stack_end;
+ int socket_;
+ int status_;
+ bool running_;
+ std::vector<VmMap> memory_map_;
+ remote_ptr<void> maestro_stack_start_, maestro_stack_end_;
+ int memory_file;
+ std::vector<IgnoredRegion> ignored_regions_;
+
+public: // object info
+ // TODO, make private (first, objectify mc_object_info_t)
mc_object_info_t libsimgrid_info;
mc_object_info_t binary_info;
mc_object_info_t* object_infos;
size_t object_infos_size;
- int memory_file;
+public: // Copies of MCed SMX data structures
/** Copy of `simix_global->process_list`
*
* See mc_smx.c.
*/
malloc_info* heap_info;
- // ***** Libunwind-data
+public: // Libunwind-data
/** Full-featured MC-aware libunwind address space for the process
*
/** The corresponding context
*/
void* unw_underlying_context;
-
-private:
- std::vector<IgnoredRegion> ignored_regions_;
};
/** Open a FD to a remote process memory (`/dev/$pid/mem`)