X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c0b8222b84f1084085608ef4d3da724f7f3710e8..657f548c2a0af5ed612a7b22ff442b1f0295b61c:/src/mc/mc_global.cpp diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index 9f231b9675..93defaf036 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -29,7 +29,7 @@ #include "src/mc/mc_request.h" #include "src/mc/mc_safety.h" #include "src/mc/mc_snapshot.h" -#include "src/mc/mc_liveness.h" +#include "src/mc/LivenessChecker.hpp" #include "src/mc/mc_private.h" #include "src/mc/mc_unw.h" #include "src/mc/mc_smx.h" @@ -105,6 +105,7 @@ void MC_run() xbt_swag_foreach(process, simix_global->process_list) MC_ignore_heap(&(process->process_hookup), sizeof(process->process_hookup)); simgrid::mc::Client::get()->mainLoop(); + simgrid::mc::processes_time.clear(); } /** @@ -236,25 +237,11 @@ void MC_show_stack_safety(xbt_fifo_t stack) } } -void MC_show_deadlock(smx_simcall_t req) +void MC_show_deadlock(void) { - /*char *req_str = nullptr; */ XBT_INFO("**************************"); XBT_INFO("*** DEAD-LOCK DETECTED ***"); XBT_INFO("**************************"); - XBT_INFO("Locked request:"); - /*req_str = simgrid::mc::request_to_string(req); - XBT_INFO("%s", req_str); - xbt_free(req_str); */ - XBT_INFO("Counter-example execution trace:"); - MC_dump_stack_safety(mc_stack); - MC_print_statistics(mc_stats); -} - -void MC_show_non_termination(void){ - XBT_INFO("******************************************"); - XBT_INFO("*** NON-PROGRESSIVE CYCLE DETECTED ***"); - XBT_INFO("******************************************"); XBT_INFO("Counter-example execution trace:"); MC_dump_stack_safety(mc_stack); MC_print_statistics(mc_stats); @@ -307,35 +294,39 @@ void MC_automaton_load(const char *file) xbt_automaton_load(simgrid::mc::property_automaton, file); } -// TODO, fix cross-process access (this function is not used) static void MC_dump_stacks(FILE* file) { int nstack = 0; for (auto const& stack : mc_model_checker->process().stack_areas()) { - xbt_die("Fix cross-process access to the context"); - unw_context_t * context = (unw_context_t *)stack.context; fprintf(file, "Stack %i:\n", nstack); int nframe = 0; char buffer[100]; - unw_cursor_t c; - unw_init_local (&c, context); + + simgrid::mc::UnwindContext context; + unw_context_t raw_context = + mc_model_checker->process().read( + simgrid::mc::remote((unw_context_t *)stack.context)); + context.initialize(&mc_model_checker->process(), &raw_context); + + unw_cursor_t cursor = context.cursor(); + unw_word_t off; do { - const char * name = !unw_get_proc_name(&c, buffer, 100, &off) ? buffer : "?"; + const char * name = !unw_get_proc_name(&cursor, buffer, 100, &off) ? buffer : "?"; #if defined(__x86_64__) unw_word_t rip = 0; unw_word_t rsp = 0; - unw_get_reg(&c, UNW_X86_64_RIP, &rip); - unw_get_reg(&c, UNW_X86_64_RSP, &rsp); + unw_get_reg(&cursor, UNW_X86_64_RIP, &rip); + unw_get_reg(&cursor, UNW_X86_64_RSP, &rsp); fprintf(file, " %i: %s (RIP=0x%" PRIx64 " RSP=0x%" PRIx64 ")\n", nframe, name, (std::uint64_t) rip, (std::uint64_t) rsp); #else fprintf(file, " %i: %s\n", nframe, name); #endif ++nframe; - } while(unw_step(&c)); + } while(unw_step(&cursor)); ++nstack; }