From: Sean Bright Date: Wed, 3 Oct 2018 22:02:27 +0000 (-0400) Subject: ast_coredumper: Remove .gdbinit file on exit X-Git-Tag: 13.24.0-rc1~66^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a19205ac7d1e3602aaeef5bfbb418db1aa249af;p=thirdparty%2Fasterisk.git ast_coredumper: Remove .gdbinit file on exit Change-Id: I1297de78628773ca368e687c6f148bf74857cae9 --- diff --git a/contrib/scripts/ast_coredumper b/contrib/scripts/ast_coredumper index b2ab4ace6a..a098e5d870 100755 --- a/contrib/scripts/ast_coredumper +++ b/contrib/scripts/ast_coredumper @@ -419,8 +419,12 @@ fi # Extract the gdb scripts from the end of this script # and save them to /tmp/.gdbinit +gdbinit=${OUTPUTDIR:-/tmp}/.ast_coredumper.gdbinit + +trap "rm $gdbinit" EXIT + ss=`egrep -n "^#@@@SCRIPTSTART@@@" $0 |cut -f1 -d:` -tail -n +${ss} $0 >${OUTPUTDIR:-/tmp}/.ast_coredumper.gdbinit +tail -n +${ss} $0 >$gdbinit # Now iterate over the coredumps and dump the debugging info for i in ${!COREDUMPS[@]} ; do @@ -431,7 +435,7 @@ for i in ${!COREDUMPS[@]} ; do cfname=`basename ${cf}` outputdir=${OUTPUTDIR:-${cfdir}} - ${GDB} -n --batch -q --ex "source ${OUTPUTDIR:-/tmp}/.ast_coredumper.gdbinit" "$asterisk_bin" "$cf" 2>/dev/null | ( + ${GDB} -n --batch -q --ex "source $gdbinit" "$asterisk_bin" "$cf" 2>/dev/null | ( of=/dev/null while IFS= read line ; do if [[ "$line" =~ !@!@!@!\ ([^\ ]+)\ !@!@!@! ]] ; then