#include <sys/mman.h>
#include <libgen.h>
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
#include "simgrid/sg_config.h"
#include "../surf/surf_private.h"
#include "../simix/smx_private.h"
//xbt_abort();
}
-int SIMIX_pre_mc_random(smx_simcall_t simcall, int min, int max)
+int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max)
{
return simcall->mc_value;
xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
req = &process->simcall;
if (req->call != SIMCALL_NONE && !MC_request_is_visible(req))
- SIMIX_simcall_enter(req, 0);
+ SIMIX_simcall_handle(req, 0);
}
}
}
break;
case MC_CALL_TYPE_WAIT:
{
- smx_action_t current_comm = NULL;
+ smx_synchro_t current_comm = NULL;
if (call_type == MC_CALL_TYPE_WAIT)
current_comm = simcall_comm_wait__get__comm(req);
else
- current_comm = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t);
+ current_comm = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_synchro_t);
// First wait only must be considered:
if (current_comm->comm.refcount == 1)
complete_comm_pattern(pattern, current_comm);
call = mc_get_call_type(req);
}
- SIMIX_simcall_enter(req, value);
+ SIMIX_simcall_handle(req, value);
if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
MC_SET_MC_HEAP;
}
- SIMIX_simcall_enter(req, value);
+ SIMIX_simcall_handle(req, value);
MC_wait_for_requests();
}
MC_SET_MC_HEAP;
}
+
+void MC_dump_stacks(FILE* file)
+{
+ int raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
+ MC_SET_MC_HEAP;
+
+ int nstack = 0;
+ stack_region_t current_stack;
+ unsigned cursor;
+ xbt_dynar_foreach(stacks_areas, cursor, current_stack) {
+ unw_context_t * context = (unw_context_t *)current_stack->context;
+ fprintf(file, "Stack %i:\n", nstack);
+
+ int nframe = 0;
+ char buffer[100];
+ unw_cursor_t c;
+ unw_init_local (&c, context);
+ unw_word_t off;
+ do {
+ const char * name = !unw_get_proc_name(&c, buffer, 100, &off) ? buffer : "?";
+ fprintf(file, " %i: %s\n", nframe, name);
+ ++nframe;
+ } while(unw_step(&c));
+
+ ++nstack;
+ }
+
+ if (raw_mem_set)
+ MC_SET_MC_HEAP;
+}