All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/1] package/uftrace: new package
@ 2021-04-08 19:46 Asaf Kahlon
  2021-04-22 20:51 ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Asaf Kahlon @ 2021-04-08 19:46 UTC (permalink / raw)
  To: buildroot

The uftrace tool is to trace and analyze execution of a
program written in C/C++.

This package contains a ./configure script to check for possible
extentions. This script is called directly from the Makefile,
so we don't need to call it explicitly.

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
v1->v2:
* amend commit message
* use github macro
* add _ARCH_SUPPORT
* more minor refactors

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 19 +++++++++++++++++++
 package/uftrace/uftrace.hash |  3 +++
 package/uftrace/uftrace.mk   | 26 ++++++++++++++++++++++++++
 5 files changed, 50 insertions(+)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 7699c471d3..f8187dfb4d 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -240,6 +240,7 @@ F:	package/python*
 F:	package/snmpclitools/
 F:	package/spdlog/
 F:	package/uftp/
+F:	package/uftrace/
 F:	package/uvw/
 F:	package/zeromq/
 
diff --git a/package/Config.in b/package/Config.in
index 1269bc7b51..cd5cd17576 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -144,6 +144,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/trace-cmd/Config.in"
 	source "package/trinity/Config.in"
 	source "package/uclibc-ng-test/Config.in"
+	source "package/uftrace/Config.in"
 	source "package/valgrind/Config.in"
 	source "package/vmtouch/Config.in"
 	source "package/whetstone/Config.in"
diff --git a/package/uftrace/Config.in b/package/uftrace/Config.in
new file mode 100644
index 0000000000..2a969445f2
--- /dev/null
+++ b/package/uftrace/Config.in
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
+	bool
+	default y if BR2_arm
+	default y if BR2_aarch64
+	default y if BR2_i386
+	default y if BR2_x86_64
+
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
+	help
+	  The uftrace tool is to trace and analyze execution of a
+	  program written in C/C++. It was heavily inspired by the
+	  ftrace framework of the Linux kernel (especially function
+	  graph tracer) and supports userspace programs.
+	  It supports various kind of commands and filters to help
+	  analysis of the program execution and performance.
+
+	  https://github.com/namhyung/uftrace
diff --git a/package/uftrace/uftrace.hash b/package/uftrace/uftrace.hash
new file mode 100644
index 0000000000..fb1e116be6
--- /dev/null
+++ b/package/uftrace/uftrace.hash
@@ -0,0 +1,3 @@
+# Locally computed
+sha256	418d30c959d3b6d0dcafd55e588a5d414a9984b30f2522a5af004a268824a5a2  uftrace-0.9.4.tar.gz
+sha256	8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/uftrace/uftrace.mk b/package/uftrace/uftrace.mk
new file mode 100644
index 0000000000..20425a9c48
--- /dev/null
+++ b/package/uftrace/uftrace.mk
@@ -0,0 +1,26 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = 0.9.4
+UFTRACE_SITE = $(call github,namhyung,uftrace,v$(UFTRACE_VERSION))
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+# uftrace always compiles a small test program to check if elfutils exists, so
+# there's no special flag for it, we just need to make sure it's installed.
+ifeq ($(BR2_PACKAGE_ELFUTILS),y)
+UFTRACE_DEPENDENCIES += elfutils
+endif
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) ARCH=$(BR2_ARCH) $(MAKE) -C $(@D)
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+endef
+
+$(eval $(generic-package))
-- 
2.30.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/uftrace: new package
  2021-04-08 19:46 [Buildroot] [PATCH v2 1/1] package/uftrace: new package Asaf Kahlon
@ 2021-04-22 20:51 ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2021-04-22 20:51 UTC (permalink / raw)
  To: buildroot

Hello Asaf,

On Thu,  8 Apr 2021 22:46:31 +0300
Asaf Kahlon <asafka7@gmail.com> wrote:

> diff --git a/package/uftrace/uftrace.mk b/package/uftrace/uftrace.mk
> new file mode 100644
> index 0000000000..20425a9c48
> --- /dev/null
> +++ b/package/uftrace/uftrace.mk
> @@ -0,0 +1,26 @@
> +################################################################################
> +#
> +# uftrace
> +#
> +################################################################################
> +
> +UFTRACE_VERSION = 0.9.4
> +UFTRACE_SITE = $(call github,namhyung,uftrace,v$(UFTRACE_VERSION))
> +UFTRACE_LICENSE = GPL-2.0
> +UFTRACE_LICENSE_FILES = COPYING
> +
> +# uftrace always compiles a small test program to check if elfutils exists, so
> +# there's no special flag for it, we just need to make sure it's installed.
> +ifeq ($(BR2_PACKAGE_ELFUTILS),y)
> +UFTRACE_DEPENDENCIES += elfutils
> +endif

> +
> +define UFTRACE_BUILD_CMDS
> +	$(TARGET_CONFIGURE_OPTS) ARCH=$(BR2_ARCH) $(MAKE) -C $(@D)
> +endef

Why don't you use the configure script? It is not autotools-based, but
the official build instructions suggest to use it:

    $ ./configure
    $ make
    $ sudo make install

The configure script allows to explicit disable unused feature, using
--without-<foo> options.

Could you have a look at this?

Also, the manual says that on ARM, only ARM >= v6 is supported. So this
probably means that:

config BR2_PACKAGE_UFTRACE_ARCH_SUPPORTS
        bool
        default y if BR2_arm

should instead be:

	default y if BR2_ARM_CPU_ARMV6 || BR2_ARM_CPU_ARMV7A

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/uftrace: new package
  2020-10-27 15:14 ` [Buildroot] [PATCH v2 " Giacomo Longo
@ 2020-11-03 20:31   ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2020-11-03 20:31 UTC (permalink / raw)
  To: buildroot

Hello Giaocomo,

On Tue, 27 Oct 2020 16:14:07 +0100
Giacomo Longo <gabibbo97@gmail.com> wrote:

> First of all, thanks Thomas for your kind words and helping me finding
> my way around (this mail is my first git-send-patch).
> 
> I have tried to incorporate the feedback inside this second version of
> the patch.

Thanks for your new iteration. I will reply directly on the patch
itself for additional comments.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 1/1] package/uftrace: new package
  2020-10-27  9:36 [Buildroot] [PATCH " Thomas Petazzoni
@ 2020-10-27 15:14 ` Giacomo Longo
  2020-11-03 20:31   ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Giacomo Longo @ 2020-10-27 15:14 UTC (permalink / raw)
  To: buildroot

First of all, thanks Thomas for your kind words and helping me finding
my way around (this mail is my first git-send-patch).

I have tried to incorporate the feedback inside this second version of
the patch.

Here's a list of the changes I've made:

I added myself to the DEVELOPERS file.

I decided to remove the configuration options concerning TUI and
luajit, replacing them with an if inside the makefile. These are not
core functionalities and probably are not worth of an extra
configuration flag.

I removed the dependency on UTIL_LINUX that was not needed.

I have converted BR2_INSTALL_LIBSTDCPP from "selects" to "depends on".

The flags BR2_USE_WCHAR, BR2_TOOLCHAIN_HAS_THREADS coming from the
selection of BR2_PACKAGE_ELFUTILS have been included as
depends on.

Comment has been moved to the end of the file, and a dependency on the
correct architecture has been added.

The makefile has been shuffled around:

- Standard configuration options are now at the top
- Architecture configuration follows
- Optional feature flags are at the bottom

Concerning the uClibc and musl incompatibility, build fails on non-glibc with this error:

uftrace-v0.9.4/cmds/record.c:2078:19: error: ?ADDR_NO_RANDOMIZE? undeclared (first use in this function)
   if (personality(ADDR_NO_RANDOMIZE) < 0)

I have been able to find the symbol in musl at
https://git.musl-libc.org/cgit/musl/tree/include/sys/personality.h but
apparently it does not work.

The patch as it is passes ./utils/test-pkg with 45 builds, 36 skipped, 0
build failed, 0 legal-info failed and ./utils/check-package
package/uftrace/* with 62 lines processed and 0 warnings generated.

I have been able to test the package by assembling and running buildroot
on QEMU system arm emulation (target arch Cortex A7).

Thanks again for your understanding, have a nice day.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-22 20:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 19:46 [Buildroot] [PATCH v2 1/1] package/uftrace: new package Asaf Kahlon
2021-04-22 20:51 ` Thomas Petazzoni
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27  9:36 [Buildroot] [PATCH " Thomas Petazzoni
2020-10-27 15:14 ` [Buildroot] [PATCH v2 " Giacomo Longo
2020-11-03 20:31   ` Thomas Petazzoni

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.