r8680: try harder to find the binary for gdb in the backtrace
authorAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2005 12:35:00 +0000 (12:35 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:29:53 +0000 (13:29 -0500)
(This used to be commit e84871dd3232de73104bee81dd877cc329cd1970)

source4/script/gdb_backtrace

index 0ba8c0eaad1b3923b4bbc0a2159beedf255a88e3..72d1f75be994a6f51159a781defa6d9c8e9d12c6 100755 (executable)
@@ -13,5 +13,16 @@ bt full
 quit
 EOF
 
+if [ ! -f $PROG ]; then
+    PROG=`which $PROG`
+fi
+if [ ! -f $PROG ]; then
+    PROG=/proc/$PID/exe
+fi
+if [ ! -f $PROG ]; then
+    echo "Unable to find binary"
+    exit 1
+fi
+
 gdb -batch -x $TMPFILE $PROG $PID < /dev/null 
 /bin/rm -f $TMPFILE