Imre Kis | ef5c264 | 2021-12-17 14:07:35 +0100 | [diff] [blame^] | 1 | // SPDX-License-Identifier: BSD-3-Clause |
| 2 | /* |
| 3 | * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #include "assert_fail_handler.h" |
| 7 | #include "compiler.h" |
| 8 | #include "trace.h" |
| 9 | |
| 10 | /* |
| 11 | * The generic trace function called on assert fail. |
| 12 | */ |
| 13 | void __noreturn assert_fail_handler(const char *file, int line, |
| 14 | const char *func, const char *failedexpr) |
| 15 | { |
| 16 | #if TRACE_LEVEL >= TRACE_LEVEL_ERROR |
| 17 | trace_printf(func, line, TRACE_LEVEL_ERROR, "assertion %s failed", failedexpr); |
| 18 | #endif /* TRACE_LEVEL */ |
| 19 | |
| 20 | while (1) |
| 21 | ; |
| 22 | } |