summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-10-06 18:04:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:44 -0500
commitb510a0bed9525dd7e082e4e5dbb6b317770cb120 (patch)
treef91ca939afa625b0493eb4f2a22b2694c1dea439 /source4
parent9db9ce6087d93d9d8b7d262b9df3b81ae624181c (diff)
downloadsamba-b510a0bed9525dd7e082e4e5dbb6b317770cb120.tar.gz
samba-b510a0bed9525dd7e082e4e5dbb6b317770cb120.tar.bz2
samba-b510a0bed9525dd7e082e4e5dbb6b317770cb120.zip
r19150: 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. metze (This used to be commit 56ae0171bafe4576c6163a0198a18b8163314e20)
Diffstat (limited to 'source4')
-rw-r--r--source4/script/gdb_backtrace_test.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source4/script/gdb_backtrace_test.c b/source4/script/gdb_backtrace_test.c
new file mode 100644
index 0000000000..506784f675
--- /dev/null
+++ b/source4/script/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;
+}