r8678: setup for gdb backtrace in 'make test'
[kai/samba-autobuild/.git] / source4 / script / gdb_backtrace
diff --git a/source4/script/gdb_backtrace b/source4/script/gdb_backtrace
new file mode 100755 (executable)
index 0000000..0ba8c0e
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# we want everything on stderr, so the program is not disturbed
+exec 1>&2
+
+PID=$1
+PROG=$2
+
+TMPFILE=/tmp/gdb.$$
+cat << EOF  > $TMPFILE
+set height 1000
+bt full
+quit
+EOF
+
+gdb -batch -x $TMPFILE $PROG $PID < /dev/null 
+/bin/rm -f $TMPFILE