X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c8880fd8bfe302109bdec0629929499479d714b0..31a999f9a0f6420f98301e553cb0e5f0c8b2a1c8:/src/mc/mc_global.c diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index dbdbc7cc6d..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" @@ -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; +}