From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 843ADA00C2; Sat, 12 Feb 2022 19:44:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0D10410F0; Sat, 12 Feb 2022 19:44:42 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id C3A364069D for ; Sat, 12 Feb 2022 19:44:40 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id x12so184019pln.2 for ; Sat, 12 Feb 2022 10:44:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CeciaiVxaCiSR7MRPGLw8IZcpib50Ze4mrpeOEU72w4=; b=D3/0skKXS0AtV8F+Wrtn4aw5yL2hrt1H15igQd1XTwpIe5ywWQ8LW7D+1h4keIpt2G WW3r9EhYf/7U3o2fNj2PipYhfxvR0+9TCHmRkCkrS037zL7zR8ZO6lMrwWivDFPYaKHP QtwR30xeSBTCF8gxpeywwyxD08AGgfZWXhuNY/BH6wyuBkI3FJ1T8/bfemrRNfNo3GXR 7Yx/NW74VnB4KIcehU0KtIh43jXoOAWuPDP8YcBESOxzlzHhrUSXaddN03fJzsIXVh95 ebnwYGBxP+NNxmP0QBj62DrASIjLiOqKHuWNL8mBiYwmqV3xrUNuhGIdEOzKuc4qy/Je 9pDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CeciaiVxaCiSR7MRPGLw8IZcpib50Ze4mrpeOEU72w4=; b=1BZiA5b3k/TMECyDWK9+ztgXWzUS4JdHaBiFyv9CXHAblR4pd7zZ0l6QEJXuupI/S+ veG8dirOYbrsT+jfmmhBsGxufDW0xfUuZxpFUflmOTVSSUdvPudQd+JexF+znZe4IoV5 dB9kfNeg7/v1NPDTOP3h41GhifcyITS7/NoAA4Ic60OgfP7dhgULRGrmag7QypOW9MV9 M9uvovZehnlIINltwTufShy4GfSVkI4MIXrm1lIIgpy+qkPqK/K4wpYW4cRsSzWJ2s3H 0epjYm4mU4ad8N9nX8h6nBRNJkAR1Ffz7jPmduPgZN7BQ3Jxc8DwDt16FSkXETuIZJ46 IC+w== X-Gm-Message-State: AOAM533CeCYLihEfJaKw2l2EdXrfllbt+rDXg4CB8tcMmUoEx6J+ukZ9 AgZmrScbH5/POcNt+ANvn8nvjVLwbuyjarjp X-Google-Smtp-Source: ABdhPJwBI5vuqc6CfKH7DJ0Wh5VKxf2ns/3UdSvHIqVl2CX6XY2QzlclbFSaOqtpXCb/hc0Cl2mAhg== X-Received: by 2002:a17:90b:33cd:: with SMTP id lk13mr6319996pjb.91.1644691479676; Sat, 12 Feb 2022 10:44:39 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id 16sm20105141pfm.200.2022.02.12.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Feb 2022 10:44:39 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2 2/2] eal: common rte_dump_stack for both Linux and FreeBSD Date: Sat, 12 Feb 2022 10:44:33 -0800 Message-Id: <20220212184433.66791-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220212184433.66791-1-stephen@networkplumber.org> References: <20220129011039.264377-1-stephen@networkplumber.org> <20220212184433.66791-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.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 --- 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 -#endif -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#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