From ebb107f1a16771a52d04f23b00a1397036c6d49f Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sun, 3 Apr 2022 16:14:18 +0200 Subject: [PATCH] posix env: print call stack in case of BUG() Signed-off-by: Adam Rutkowski --- env/posix/ocf_env.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/env/posix/ocf_env.h b/env/posix/ocf_env.h index ecc2fa5..4fa163a 100644 --- a/env/posix/ocf_env.h +++ b/env/posix/ocf_env.h @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Intel Corporation + * Copyright(c) 2019-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -67,11 +67,13 @@ typedef uint64_t sector_t; #define ENV_MEM_ATOMIC 0 /* DEBUGING */ +void env_stack_trace(void); + #define ENV_WARN(cond, fmt...) printf(fmt) #define ENV_WARN_ON(cond) ; #define ENV_WARN_ONCE(cond, fmt...) ENV_WARN(cond, fmt) -#define ENV_BUG() assert(0) +#define ENV_BUG() do {env_stack_trace(); assert(0);} while(0) #define ENV_BUG_ON(cond) do { if (cond) ENV_BUG(); } while (0) #define ENV_BUILD_BUG_ON(cond) _Static_assert(!(cond), "static "\ "assertion failure")