Merge "Add PS4 to show file/function/line in debug output"

This commit is contained in:
Jenkins 2016-06-07 01:14:08 +00:00 committed by Gerrit Code Review
commit a10a664a2a
1 changed files with 11 additions and 0 deletions

View File

@ -216,6 +216,17 @@ if [ "$CLEAR_ENV" = "1" -a "$HOME" != "" ]; then
exec -c $0 "$@"
fi
# Display the current file/function/line in the debug output
function _ps4 {
IFS=" " called=($(caller 0))
local f=$(readlink -f ${called[2]})
printf "%-80s " "$f:${called[1]}:${called[0]}"
}
export -f _ps4
export PS4='+ $(_ps4): '
source $_LIB/img-defaults
source $_LIB/common-functions
source $_LIB/img-functions