Beispiel #1
0
void
MR_trace_start(MR_bool enabled)
{
    MR_trace_event_number = 0;
    MR_trace_call_seqno = 0;
    MR_trace_call_depth = 0;
    MR_trace_from_full = MR_TRUE;
    MR_debug_enabled = enabled;
    MR_update_trace_func_enabled();

#ifdef  MR_TABLE_DEBUG
    /*
    ** Restore the value saved by MR_trace_init.
    */

    MR_tabledebug = MR_saved_tabledebug;
#endif

    /*
    ** Install the SIGINT signal handler.
    ** We only do this if tracing is enabled, and only
    ** for the internal debugger.  (This is a bit conservative:
    ** it might work fine for the external debugger too,
    ** but I'm just not certain of that.)
    */
    if (enabled &&
        MR_address_of_trace_interrupt_handler != NULL &&
        MR_trace_handler == MR_TRACE_INTERNAL)
    {
        MR_setup_signal(SIGINT,
            (MR_Code *) MR_address_of_trace_interrupt_handler,
            MR_FALSE, "mdb: cannot install SIGINT signal handler");
    }
}
void
MR_setup_signals(void)
{
/*
** When using Microsoft Visual C structured exceptions don't set any
** signal handlers.
** See mercury_wrapper.c for the reason why.
*/
#ifndef MR_MSVC_STRUCTURED_EXCEPTIONS
  #ifdef SIGBUS
    MR_setup_signal(SIGBUS, (MR_Code *) bus_handler, MR_TRUE,
        "cannot set SIGBUS handler");
  #endif
    MR_setup_signal(SIGSEGV, (MR_Code *) segv_handler, MR_TRUE,
        "cannot set SIGSEGV handler");
#endif
}
Beispiel #3
0
void
MR_prof_init(void)
{
#ifdef MR_MPROF_PROFILE_TIME
    MR_init_time_profile_method();
#endif

#if defined(MR_MPROF_PROFILE_TIME) || defined(MR_MPROF_PROFILE_CALLS) \
        || defined(MR_MPROF_PROFILE_MEMORY)
    MR_checked_atexit(MR_prof_finish);
  #ifdef SIGINT
    MR_setup_signal(SIGINT, prof_handle_sigint, MR_FALSE,
        "cannot install signal handler");
  #endif
#endif
}