All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Yang <wen.yang@linux.dev>
To: openembedded-core@lists.openembedded.org,
	openembedded-devel@lists.openembedded.org
Cc: Wen Yang <wen.yang@linux.dev>
Subject: [oe-core][PATCH] pstack: add recipe
Date: Sun, 29 Jun 2025 17:07:57 +0800	[thread overview]
Message-ID: <20250629090757.11773-1-wen.yang@linux.dev> (raw)

This recipe provides pstack for C/C++, Go, Rust, and Python.

Signed-off-by: Wen Yang <wen.yang@linux.dev>
---
 meta/conf/distro/include/maintainers.inc      |  1 +
 ...e-issue-of-cross-compilation-failure.patch | 28 +++++++++++++
 meta/recipes-devtools/pstack/pstack.inc       | 39 +++++++++++++++++++
 meta/recipes-devtools/pstack/pstack_git.bb    |  8 ++++
 4 files changed, 76 insertions(+)
 create mode 100644 meta/recipes-devtools/pstack/files/0001-tests-fix-the-issue-of-cross-compilation-failure.patch
 create mode 100644 meta/recipes-devtools/pstack/pstack.inc
 create mode 100644 meta/recipes-devtools/pstack/pstack_git.bb

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index d94fb693e3..2f04c69445 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -609,6 +609,7 @@ RECIPE_MAINTAINER:pn-procps = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-pseudo = "Robert Yang <liezhi.yang@windriver.com>"
 RECIPE_MAINTAINER:pn-psmisc = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-psplash = "Yi Zhao <yi.zhao@windriver.com>"
+RECIPE_MAINTAINER:pn-pstack = "Wen Yang <wen.yang@linux.dev>"
 RECIPE_MAINTAINER:pn-ptest-runner = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-pulseaudio = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-pulseaudio-client-conf-sato = "Unassigned <unassigned@yoctoproject.org>"
diff --git a/meta/recipes-devtools/pstack/files/0001-tests-fix-the-issue-of-cross-compilation-failure.patch b/meta/recipes-devtools/pstack/files/0001-tests-fix-the-issue-of-cross-compilation-failure.patch
new file mode 100644
index 0000000000..2b54750e7a
--- /dev/null
+++ b/meta/recipes-devtools/pstack/files/0001-tests-fix-the-issue-of-cross-compilation-failure.patch
@@ -0,0 +1,28 @@
+From a8c3996d3f8d9b8f3a2888b7062c1139263c5aba Mon Sep 17 00:00:00 2001
+From: Wen Yang <yellowriver2010@hotmail.com>
+Date: Mon, 23 Jun 2025 02:06:53 +0800
+Subject: [PATCH] tests: fix the issue of cross compilation failure
+
+By replacing objcopy with MAKE_OBJCOPY, pstack could support both
+native and cross compilation.
+
+Upstream-Status: Backport [https://github.com/peadar/pstack/pull/38]
+---
+ tests/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 71a62a7..bf11a04 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -38,7 +38,7 @@ SET_TARGET_PROPERTIES(noreturn PROPERTIES COMPILE_FLAGS "-O2 -g")
+
+ add_custom_command(
+    OUTPUT basic-no-unwind-gen
+-   COMMAND objcopy --strip-debug --remove-section .eh_frame basic basic-no-unwind
++   COMMAND ${CMAKE_OBJCOPY} --strip-debug --remove-section .eh_frame basic basic-no-unwind
+    VERBATIM )
+
+ add_custom_target(basic-no-unwind ALL DEPENDS basic basic-no-unwind-gen)
+--
+2.25.1
diff --git a/meta/recipes-devtools/pstack/pstack.inc b/meta/recipes-devtools/pstack/pstack.inc
new file mode 100644
index 0000000000..9831a74d1a
--- /dev/null
+++ b/meta/recipes-devtools/pstack/pstack.inc
@@ -0,0 +1,39 @@
+SUMMARY = "A utility to print stack traces of running processes"
+DESCRIPTION = "A from-scratch implementation of pstack using DWARF debugging and unwind information. \
+Works for C/C++, Go, Rust, and Python. A traditional pstack command can generally print a backtrace \
+of each thread in a running program, and sometimes from a core file. This version of pstack uses its \
+own self contained ELF and DWARF parsing library, libdwelf to parse the DWARF debug and unwind \
+information, to get a stack trace."
+HOMEPAGE = "https://github.com/peadar/pstack"
+SECTION = "devel"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=671019a96ba80415b696240ed2ca5e80"
+
+inherit cmake
+
+S = "${UNPACKDIR}/${BPN}-${PV}"
+DEPENDS += "zlib xz libunwind elfutils"
+
+RDEPENDS:${PN} += "elfutils"
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 ${B}/pstack ${D}${bindir}/pstack
+
+    install -d ${D}${libdir}
+    install -m 0755 ${B}/libprocman.so.${PV} ${D}${libdir}/libprocman.so.${PV}
+    ln -sf libprocman.so.${PV} ${D}${libdir}/libprocman.so
+    install -m 0755 ${B}/libdwelf.so.${PV}  ${D}${libdir}/libdwelf.so.${PV}
+    ln -sf libdwelf.so.${PV}  ${D}${libdir}/libdwelf.so
+}
+
+PACKAGES = "${PN}"
+FILES:${PN} = "${bindir}/pstack"
+FILES:${PN} += "${libdir}/libprocman.so.${PV}"
+FILES:${PN} += "${libdir}/libdwelf.so.${PV}"
+
+PACKAGES += "${PN}-dbg"
+FILES:${PN}-dbg += "${base_bindir}/.debug ${base_sbindir}/.debug ${bindir}/.debug ${sbindir}/.debug"
+
+PACKAGES += "${PN}-dev"
+FILES:${PN}-dev += "${base_libdir}/*.so"
diff --git a/meta/recipes-devtools/pstack/pstack_git.bb b/meta/recipes-devtools/pstack/pstack_git.bb
new file mode 100644
index 0000000000..cc6721f9e3
--- /dev/null
+++ b/meta/recipes-devtools/pstack/pstack_git.bb
@@ -0,0 +1,8 @@
+require pstack.inc
+
+SRCREV = "1e1734be3adb6d9c81b57c5cc3d0c8fbc43bdee3"
+PV = "2.11"
+
+SRC_URI = "git://github.com/peadar/pstack.git;branch=master;protocol=https \
+           file://0001-tests-fix-the-issue-of-cross-compilation-failure.patch \
+          "
-- 
2.25.1



             reply	other threads:[~2025-06-29 13:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-29  9:07 Wen Yang [this message]
2025-06-30  9:36 ` [oe] [oe-core][PATCH] pstack: add recipe Alexander Kanavin
2025-06-30 17:04   ` Wen Yang

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=20250629090757.11773-1-wen.yang@linux.dev \
    --to=wen.yang@linux.dev \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=openembedded-devel@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.