common/octeontx2: fix memory mapping API usage
[dpdk.git] / lib / librte_eal / common / eal_common_debug.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #include <stdarg.h>
6 #include <rte_eal.h>
7 #include <rte_log.h>
8 #include <rte_debug.h>
9
10 /* not implemented */
11 void
12 rte_dump_registers(void)
13 {
14         return;
15 }
16
17 /* call abort(), it will generate a coredump if enabled */
18 void
19 __rte_panic(const char *funcname, const char *format, ...)
20 {
21         va_list ap;
22
23         rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
24         va_start(ap, format);
25         rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
26         va_end(ap);
27         rte_dump_stack();
28         rte_dump_registers();
29         abort();
30 }
31
32 /*
33  * Like rte_panic this terminates the application. However, no traceback is
34  * provided and no core-dump is generated.
35  */
36 void
37 rte_exit(int exit_code, const char *format, ...)
38 {
39         va_list ap;
40
41         if (exit_code != 0)
42                 RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
43                                 "  Cause: ", exit_code);
44
45         va_start(ap, format);
46         rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
47         va_end(ap);
48
49 #ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
50         if (rte_eal_cleanup() != 0)
51                 RTE_LOG(CRIT, EAL,
52                         "EAL could not release all resources\n");
53         exit(exit_code);
54 #else
55         rte_dump_stack();
56         rte_dump_registers();
57         abort();
58 #endif
59 }