X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d2782615cdbeb1ad4c5e994a4c681739927e3aff..31a999f9a0f6420f98301e553cb0e5f0c8b2a1c8:/src/mc/mc_global.c diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index 6b8d8b04af..5d163b1ccc 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -11,6 +11,9 @@ #include #include +#define UNW_LOCAL_ONLY +#include + #include "simgrid/sg_config.h" #include "../surf/surf_private.h" #include "../simix/smx_private.h" @@ -322,7 +325,7 @@ void MC_exit(void) //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; @@ -380,11 +383,11 @@ void mc_update_comm_pattern(mc_call_type call_type, smx_simcall_t req, int value 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); @@ -824,3 +827,33 @@ void MC_automaton_new_propositional_symbol(const char *id, void *fct) 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; +}