DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v2 2/2] eal: common rte_dump_stack for both Linux and FreeBSD
Date: Sat, 12 Feb 2022 10:44:33 -0800	[thread overview]
Message-ID: <20220212184433.66791-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20220212184433.66791-1-stephen@networkplumber.org>

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%)

diff --git a/lib/eal/freebsd/eal_debug.c b/lib/eal/freebsd/eal_debug.c
deleted file mode 100644
index 64dab4e0da24..000000000000
--- a/lib/eal/freebsd/eal_debug.c
+++ /dev/null
@@ -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 */
-}
diff --git a/lib/eal/freebsd/meson.build b/lib/eal/freebsd/meson.build
index 398ceab71d03..85cca5a096ca 100644
--- a/lib/eal/freebsd/meson.build
+++ b/lib/eal/freebsd/meson.build
@@ -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',
diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build
index 65f2ac6b4798..3cccfa36c0a4 100644
--- a/lib/eal/linux/meson.build
+++ b/lib/eal/linux/meson.build
@@ -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',
diff --git a/lib/eal/linux/eal_debug.c b/lib/eal/unix/eal_debug.c
similarity index 100%
rename from lib/eal/linux/eal_debug.c
rename to lib/eal/unix/eal_debug.c
diff --git a/lib/eal/unix/meson.build b/lib/eal/unix/meson.build
index a22ea7cabc46..9f724bfd5d7a 100644
--- a/lib/eal/unix/meson.build
+++ b/lib/eal/unix/meson.build
@@ -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',
 )
-- 
2.34.1


  parent reply	other threads:[~2022-02-12 18:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-29  1:10 [RFC] eal_debug: do not use malloc in rte_dump_stack Stephen Hemminger
2022-01-29  8:25 ` Morten Brørup
2022-02-12 18:44 ` [PATCH v2 0/2] rte_dump_stack: improvements Stephen Hemminger
2022-02-12 18:44   ` [PATCH v2 1/2] eal_debug: do not use malloc in rte_dump_stack Stephen Hemminger
2022-02-13 11:41     ` Thomas Monjalon
2022-03-17 23:13       ` Stephen Hemminger
2022-02-12 18:44   ` Stephen Hemminger [this message]
2022-02-14 11:10   ` [PATCH v2 0/2] rte_dump_stack: improvements Morten Brørup
2022-02-14 11:51     ` Bruce Richardson
2022-04-07 12:45   ` David Marchand
2022-04-07 23:06     ` Stephen Hemminger
2022-04-14 19:41 ` [PATCH v3] rte_dump_stack: make in async signal safe Stephen Hemminger
2022-04-14 20:19 ` [PATCH v4] " Stephen Hemminger
2022-06-23  7:51   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220212184433.66791-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).