1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
11 * Debug Functions in RTE
13 * This file defines a generic API for debug operations. Part of
14 * the implementation is architecture-specific.
18 #include "rte_branch_prediction.h"
25 * Dump the stack of the calling core to the standard error.
27 void rte_dump_stack(void);
30 * Provide notification of a critical non-recoverable error and terminate
31 * execution abnormally.
33 * Display the format string and its expanded arguments (printf-like).
35 * In a linux environment, this function dumps the stack and calls
36 * abort() resulting in a core dump if enabled.
38 * The function never returns.
41 * The format string, followed by the variable list of arguments.
43 #define rte_panic(...) rte_panic_(__func__, __VA_ARGS__, "dummy")
44 #define rte_panic_(func, format, ...) __rte_panic(func, format "%.0s", __VA_ARGS__)
46 #ifdef RTE_ENABLE_ASSERT
47 #define RTE_ASSERT(exp) RTE_VERIFY(exp)
49 #define RTE_ASSERT(exp) do {} while (0)
51 #define RTE_VERIFY(exp) do { \
52 if (unlikely(!(exp))) \
53 rte_panic("line %d\tassert \"%s\" failed\n", __LINE__, #exp); \
57 * Provide notification of a critical non-recoverable error and stop.
59 * This function should not be called directly. Refer to rte_panic() macro
62 void __rte_panic(const char *funcname , const char *format, ...)
64 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
69 __rte_format_printf(2, 3);
75 #endif /* _RTE_DEBUG_H_ */