| 1 | #include <signal.h> |
|---|---|
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | void handler(int sig) |
| 6 | { |
| 7 | printf(format: "Set a breakpoint here.\n"); |
| 8 | exit(status: 0); |
| 9 | } |
| 10 | |
| 11 | void abort_caller() { |
| 12 | abort(); |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | if (signal(SIGABRT, handler: handler) == SIG_ERR) |
| 18 | { |
| 19 | perror(s: "signal"); |
| 20 | return 1; |
| 21 | } |
| 22 | |
| 23 | abort_caller(); |
| 24 | return 2; |
| 25 | } |
| 26 |
