From 5f018d07981bc22519eb854f6b4dbffcb76e6797 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 7 Jun 2019 11:45:39 +1000 Subject: [PATCH] Tools: scripts: add dumpstack Given a pid this script attempts to dump a stack trace of that process to stderr --- Tools/scripts/dumpstack | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 Tools/scripts/dumpstack diff --git a/Tools/scripts/dumpstack b/Tools/scripts/dumpstack new file mode 100755 index 0000000000..fe9a0168bc --- /dev/null +++ b/Tools/scripts/dumpstack @@ -0,0 +1,15 @@ +#!/bin/sh + +# we want everything on stderr, so the program is not disturbed +exec 1>&2 + +PID=$1 +TMPFILE=/tmp/gdb.$$ +cat << EOF > $TMPFILE +set height 0 +bt full +thread apply all bt full +quit +EOF +gdb -batch -x $TMPFILE --pid $PID < /dev/null 2>&1 +/bin/rm -f $TMPFILE