DPDK 25.07.0
rte_debug.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef _RTE_DEBUG_H_
6#define _RTE_DEBUG_H_
7
17#include "rte_log.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
27void rte_dump_stack(void);
28
43#define rte_panic(...) rte_panic_(__func__, __VA_ARGS__, "dummy")
44#define rte_panic_(func, format, ...) __rte_panic(func, format "%.0s", __VA_ARGS__)
45
46#ifdef RTE_ENABLE_ASSERT
47#define RTE_ASSERT(exp) RTE_VERIFY(exp)
48#else
49/*
50 * If RTE_ENABLE_ASSERT is not set, the exp is not checked
51 * but not evaluated because of the use of sizeof().
52 * The ternary operator is to allow function pointers and bit fields,
53 * and to suppress the evaluation of any variable length arrays.
54 */
55#define RTE_ASSERT(exp) do { \
56 (void)sizeof((exp) ? 1 : 0); \
57} while (0)
58#endif
59
60#define RTE_VERIFY(exp) do { \
61 if (unlikely(!(exp))) \
62 rte_panic("line %d\tassert \"%s\" failed\n", __LINE__, #exp); \
63} while (0)
64
65/*
66 * Provide notification of a critical non-recoverable error and stop.
67 *
68 * This function should not be called directly. Refer to rte_panic() macro
69 * documentation.
70 */
71void __rte_panic(const char *funcname , const char *format, ...)
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* _RTE_DEBUG_H_ */
#define __rte_cold
Definition: rte_common.h:517
#define __rte_format_printf(format_index, first_arg)
Definition: rte_common.h:280
#define __rte_noreturn
Definition: rte_common.h:443
void rte_dump_stack(void)