VERSION: Move on to beta9
[Samba/bb.git] / selftest / gdb_backtrace_test.c
blob993596d2c2a931a9ec1c2b48e51d7ff82666b2e6
1 /*
3 add a useful tool to test the gdb_backtrace script
5 just compile it with
6 cc -g -o gdb_backtrace_test gdb_backtrace_test.c
8 and run it in the same directory where your gdb_backtrace script is.
10 2006 - Stefan Metzmacher <metze@samba.org>
13 #include <stdio.h>
14 #include <string.h>
15 #include <stdlib.h>
16 #include <unistd.h>
17 #include <signal.h>
19 static const char *prog;
21 static void sig_fault(int sig)
23 int ret;
24 char cmdstr[200];
26 snprintf(cmdstr, sizeof(cmdstr),
27 "./gdb_backtrace %u %s",
28 getpid(), prog);
29 printf("sig_fault start: %s\n", cmdstr);
30 ret = system(cmdstr);
31 printf("sig_fault end: %d\n", ret);
34 int main(int argc, const char **argv)
36 prog = argv[0];
38 signal(SIGABRT, sig_fault);
40 abort();
41 return 0;