doc: add Meson coding style to contributors guide
[dpdk.git] / lib / librte_eal / freebsd / eal_debug.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifdef RTE_BACKTRACE
6 #include <execinfo.h>
7 #endif
8 #include <stdarg.h>
9 #include <signal.h>
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <stdint.h>
13
14 #include <rte_log.h>
15 #include <rte_debug.h>
16 #include <rte_common.h>
17 #include <rte_eal.h>
18
19 #define BACKTRACE_SIZE 256
20
21 /* dump the stack of the calling core */
22 void rte_dump_stack(void)
23 {
24 #ifdef RTE_BACKTRACE
25         void *func[BACKTRACE_SIZE];
26         char **symb = NULL;
27         int size;
28
29         size = backtrace(func, BACKTRACE_SIZE);
30         symb = backtrace_symbols(func, size);
31
32         if (symb == NULL)
33                 return;
34
35         while (size > 0) {
36                 rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
37                         "%d: [%s]\n", size, symb[size - 1]);
38                 size --;
39         }
40
41         free(symb);
42 #endif /* RTE_BACKTRACE */
43 }