[v2,2/2] eal: common rte_dump_stack for both Linux and FreeBSD
Checks
Commit Message
The core functions used by rte_dump_stack() are backtrace_symbols
and dladdr. Both of those functions are the same in Linux and
FreeBSD so the code for decoding stack should be common.
Also, the filenames unix/meson.build are now resorted.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/freebsd/eal_debug.c | 43 -----------------------------
lib/eal/freebsd/meson.build | 1 -
lib/eal/linux/meson.build | 1 -
lib/eal/{linux => unix}/eal_debug.c | 0
lib/eal/unix/meson.build | 5 ++--
5 files changed, 3 insertions(+), 47 deletions(-)
delete mode 100644 lib/eal/freebsd/eal_debug.c
rename lib/eal/{linux => unix}/eal_debug.c (100%)
deleted file mode 100644
@@ -1,43 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifdef RTE_BACKTRACE
-#include <execinfo.h>
-#endif
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-#include <rte_eal.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-#ifdef RTE_BACKTRACE
- void *func[BACKTRACE_SIZE];
- char **symb = NULL;
- int size;
-
- size = backtrace(func, BACKTRACE_SIZE);
- symb = backtrace_symbols(func, size);
-
- if (symb == NULL)
- return;
-
- while (size > 0) {
- rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
- "%d: [%s]\n", size, symb[size - 1]);
- size --;
- }
-
- free(symb);
-#endif /* RTE_BACKTRACE */
-}
@@ -7,7 +7,6 @@ sources += files(
'eal.c',
'eal_alarm.c',
'eal_cpuflags.c',
- 'eal_debug.c',
'eal_dev.c',
'eal_hugepage_info.c',
'eal_interrupts.c',
@@ -7,7 +7,6 @@ sources += files(
'eal.c',
'eal_alarm.c',
'eal_cpuflags.c',
- 'eal_debug.c',
'eal_dev.c',
'eal_hugepage_info.c',
'eal_interrupts.c',
similarity index 100%
rename from lib/eal/linux/eal_debug.c
rename to lib/eal/unix/eal_debug.c
@@ -2,10 +2,11 @@
# Copyright(c) 2020 Dmitry Kozlyuk
sources += files(
+ 'eal_debug.c',
'eal_file.c',
+ 'eal_filesystem.c',
+ 'eal_firmware.c',
'eal_unix_memory.c',
'eal_unix_timer.c',
- 'eal_firmware.c',
- 'eal_filesystem.c',
'rte_thread.c',
)