summaryrefslogtreecommitdiff
path: root/crash/signals.c
blob: 3a8c14390baed7689c81de10dca2bd418e023f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void handler(int sig){
    printf("No debugger, or passed signals\n");

    //Put your code here

    _exit(0);
}

int main(){
    /*
     * Not everyone is clever enough to
     * think that a SIGEGV/SIGILL is rightful ;)
     */

    signal(SIGSEGV, handler);
    __asm__("movl $1, %eax");

    signal(SIGILL, handler);
    __asm__("ud2");
}