drd: Add a consistency check
[valgrind.git] / gdbserver_tests / gone.c
blob53274e9677757c74e1596c0cf762ce0c5122c37e
1 #include <signal.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <unistd.h>
7 int
8 main (int argc, char **argv)
10 fprintf(stderr, "starting ...\n");
12 // Three ways of going away...
13 if (argc > 1)
15 // Explicit exit() with exit code.
16 if (strcmp (argv[1], "exit") == 0)
18 fprintf(stderr, "exiting ...\n");
19 exit (1);
22 // Get killed by a signal.
23 if (strcmp (argv[1], "abort") == 0)
25 fprintf(stderr, "aborting ...\n");
26 kill(getpid(), SIGABRT);
30 // And finally, just return from main with success.
31 fprintf(stderr, "returning ...\n");
32 return 0;