DPDK  19.11.14
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"
18 #include "rte_branch_prediction.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
27 void rte_dump_stack(void);
28 
34 void rte_dump_registers(void);
35 
50 #define rte_panic(...) rte_panic_(__func__, __VA_ARGS__, "dummy")
51 #define rte_panic_(func, format, ...) __rte_panic(func, format "%.0s", __VA_ARGS__)
52 
53 #ifdef RTE_ENABLE_ASSERT
54 #define RTE_ASSERT(exp) RTE_VERIFY(exp)
55 #else
56 #define RTE_ASSERT(exp) do {} while (0)
57 #endif
58 #define RTE_VERIFY(exp) do { \
59  if (unlikely(!(exp))) \
60  rte_panic("line %d\tassert \"%s\" failed\n", __LINE__, #exp); \
61 } while (0)
62 
63 /*
64  * Provide notification of a critical non-recoverable error and stop.
65  *
66  * This function should not be called directly. Refer to rte_panic() macro
67  * documentation.
68  */
69 void __rte_panic(const char *funcname , const char *format, ...)
70 #ifdef __GNUC__
71 #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2))
72  __attribute__((cold))
73 #endif
74 #endif
75  __attribute__((noreturn))
76  __attribute__((format(printf, 2, 3)));
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* _RTE_DEBUG_H_ */
void rte_dump_registers(void)
void rte_dump_stack(void)