From 4a0da762d5f21b86137ff61356c4ddb338eed888 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Mon, 22 Nov 2021 11:06:50 +0100 Subject: [PATCH] [PR] dev: enable tracing of functions return trap (#3281) - via environment variable ARMBIAN_ENABLE_CALL_TRACING=yes Signed-off-by: Ricardo Pardini --- compile.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compile.sh b/compile.sh index 6e83a3556..32f9ffa6b 100755 --- a/compile.sh +++ b/compile.sh @@ -20,6 +20,13 @@ grep -q "[[:space:]]" <<<"${SRC}" && { echo "\"${SRC}\" contains whitespace. Not cd "${SRC}" || exit +if [[ "${ARMBIAN_ENABLE_CALL_TRACING}" == "yes" ]]; then + set -T # inherit return/debug traps + mkdir -p "${SRC}"/output/debug + echo -n "" > "${SRC}"/output/debug/calls.txt + trap 'echo "${BASH_LINENO[@]}|${BASH_SOURCE[@]}|${FUNCNAME[@]}" >> ${SRC}/output/debug/calls.txt ;' RETURN +fi + if [[ -f "${SRC}"/lib/general.sh ]]; then # shellcheck source=lib/general.sh