summaryrefslogtreecommitdiff
path: root/crash
diff options
context:
space:
mode:
Diffstat (limited to 'crash')
-rw-r--r--crash/signals.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/crash/signals.c b/crash/signals.c
new file mode 100644
index 0000000..3a8c143
--- /dev/null
+++ b/crash/signals.c
@@ -0,0 +1,24 @@
1#include <stdio.h>
2#include <signal.h>
3#include <unistd.h>
4
5void handler(int sig){
6 printf("No debugger, or passed signals\n");
7
8 //Put your code here
9
10 _exit(0);
11}
12
13int main(){
14 /*
15 * Not everyone is clever enough to
16 * think that a SIGEGV/SIGILL is rightful ;)
17 */
18
19 signal(SIGSEGV, handler);
20 __asm__("movl $1, %eax");
21
22 signal(SIGILL, handler);
23 __asm__("ud2");
24}