Example #1
0
static void
handle_signal(int signal, siginfo_t *siginfo, ucontext_t *ucxt)
{
    if (signal == SIGILL) {
        sigcontext_t *sc = SIGCXT_FROM_UCXT(ucxt);
        if (sc->TEST_REG_SIG != DRREG_TEST_3_C)
            print("ERROR: spilled register value was not preserved!\n");
    } else if (signal == SIGSEGV) {
        sigcontext_t *sc = SIGCXT_FROM_UCXT(ucxt);
        if (((sc->TEST_FLAGS_SIG) & DRREG_TEST_AFLAGS_C) != DRREG_TEST_AFLAGS_C)
            print("ERROR: spilled flags value was not preserved!\n");
    }
    SIGLONGJMP(mark, 1);
}
Example #2
0
static void
signal_handler(int sig, siginfo_t *siginfo, ucontext_t *ucxt)
{
#if VERBOSE
    print("thread %d signal_handler: sig=%d, retaddr=" PFX ", fpregs=" PFX "\n", getpid(),
          sig, *(&sig - 1), ucxt->uc_mcontext.fpregs);
#endif

    switch (sig) {
    case SIGUSR1: {
        sigcontext_t *sc = SIGCXT_FROM_UCXT(ucxt);
        void *pc = (void *)sc->SC_XIP;
#if VERBOSE
        print("thread %d got SIGUSR1 @ " PFX "\n", getpid(), pc);
#endif
        break;
    }
    case SIGSEGV:
#if VERBOSE
        print("thread %d got SIGSEGV @ " PFX "\n", getpid(), pc);
#endif
        SIGLONGJMP(mark, 1);
        break;
    default: assert(0);
    }
}
Example #3
0
static void
signal_handler(int sig, siginfo_t *siginfo, ucontext_t *ucxt)
{
    if (sig == SIGSEGV || sig == SIGILL) {
        sigcontext_t *sc = SIGCXT_FROM_UCXT(ucxt);
        if (sig == SIGILL)
            print("Illegal instruction\n");
        print_fault_code((unsigned char *)sc->SC_XIP);
        SIGLONGJMP(mark, count++);
    }
    exit(-1);
}
Example #4
0
static void
signal_handler(int sig, siginfo_t *siginfo, void *context)
{
    if (sig == SIGSEGV || sig == SIGBUS) {
        ucontext_t *ucxt = (ucontext_t *)context;
        sigcontext_t *sc = (sigcontext_t *)SIGCXT_FROM_UCXT(ucxt);
        if (sc->XAX != xax_val)
            fprintf(stderr, "eax is wrong\n");
        else
            fprintf(stderr, "eax is correct\n");
        fprintf(stderr, "done\n");
    }
    exit(1);
}
Example #5
0
void handler(int signum, siginfo_t *info, void *ucontext_)
{
    ucontext_t *ucontext = ucontext_;
    sigcontext_t *sc = SIGCXT_FROM_UCXT(ucontext);
    siglongjmp(env, 1 + (sc->SC_XIP == (uintptr_t)nanosleep_interrupted));
}