summaryrefslogtreecommitdiff
path: root/source4/script/gdb_backtrace
diff options
context:
space:
mode:
Diffstat (limited to 'source4/script/gdb_backtrace')
-rwxr-xr-xsource4/script/gdb_backtrace17
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/script/gdb_backtrace b/source4/script/gdb_backtrace
new file mode 100755
index 0000000000..0ba8c0eaad
--- /dev/null
+++ b/source4/script/gdb_backtrace
@@ -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