diff options
author | bubulle <bubulle@alioth.debian.org> | 2009-07-05 21:08:28 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2009-07-05 21:08:28 +0000 |
commit | e2df0615c76f228e5479482a880a01d64ef47a06 (patch) | |
tree | cf161609a937840fa6b42eac3d4c0db7ff534d34 /selftest/gdb_backtrace_test.c | |
parent | 130ad4cd047d74be152bdcf6ff6743b7978b99de (diff) | |
download | samba-e2df0615c76f228e5479482a880a01d64ef47a06.tar.gz |
Load samba-3.4.0 into branches/samba/upstream.upstream/3.4.0
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@2934 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'selftest/gdb_backtrace_test.c')
-rw-r--r-- | selftest/gdb_backtrace_test.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/selftest/gdb_backtrace_test.c b/selftest/gdb_backtrace_test.c new file mode 100644 index 0000000000..506784f675 --- /dev/null +++ b/selftest/gdb_backtrace_test.c @@ -0,0 +1,42 @@ +/* + +add a usefull tool to test the gdb_backtrace script + +just compile it with +cc -g -o gdb_backtrace_test gdb_backtrace_test.c + +and run it in the same directory where your gdb_backtrace script is. + +2006 - Stefan Metzmacher <metze@samba.org> + +*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> + +static const char *prog; + +static void sig_fault(int sig) +{ + int ret; + char cmdstr[200]; + + snprintf(cmdstr, sizeof(cmdstr), + "./gdb_backtrace %u %s", + getpid(), prog); + printf("sig_fault start: %s\n", cmdstr); + ret = system(cmdstr); + printf("sig_fault end: %d\n", ret); +} + +int main(int argc, const char **argv) +{ + prog = argv[0]; + + signal(SIGABRT, sig_fault); + + abort(); + return 0; +} |