From 78d58ed662329886283547e7681e9384bf8cc867 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Mon, 23 Jan 2006 07:48:45 +0000 Subject: bash tracebacks. :) svn path=/main/trunk/; revision=2572 --- bin/ebuild.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index afd0343c2..5334abdf4 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -272,7 +272,7 @@ diefunc() { shift 3 echo >&2 echo "!!! ERROR: $CATEGORY/$PF failed." >&2 - echo "!!! Function $funcname, Line $lineno, Exitcode $exitcode" >&2 + dump_trace 2 1>&2 echo "!!! ${*:-(no error message)}" >&2 echo "!!! If you need support, post the topmost build error, NOT this status message." >&2 echo >&2 @@ -284,6 +284,22 @@ diefunc() { exit 1 } +dump_trace() { + local skip funcname sourcefile lineno + if [[ -n $1 ]]; then + declare -i skip=$1 + else + skip=1 + fi + echo "Call stack:" + for (( n = $skip ; n < ${#FUNCNAME[@]} ; ++n )) ; do + funcname=${FUNCNAME[${n}]} + sourcefile=$(basename ${BASH_SOURCE[$(( n - 1 ))]}) + lineno=${BASH_LINENO[$(( n - 1 ))]} + echo " File ${sourcefile}, line ${lineno}, in ${funcname}" + done +} + #if no perms are specified, dirs/files will have decent defaults #(not secretive, but not stupid) umask 022 -- cgit v1.2.3-1-g7c22