Skip to contentSkip to conversation

uftrace: new package

PATCH New Vincent Stehle 4 participants 8 messages Jun 25, 2017 – Oct 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uftrace: new package

From: Vincent Stehl? <[email protected]>

Add a package for uftrace, a simple function call tracer for user programs.

The x86_64 and arm/aarch64 architectures are supported.

Tracing necessitates that the executable you want to trace be compiled with -pg or -finstrument-functions option.

See https://github.com/namhyung/uftrace

---
 DEVELOPERS                   |  3 ++-
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 20 ++++++++++++++++++++
 package/uftrace/uftrace.hash |  2 ++
 package/uftrace/uftrace.mk   | 28 ++++++++++++++++++++++++++++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +2 -1
index 9e421f4b4..5f2a6b0db 100644
@@ -1706,9 +1706,10 @@ F:	package/openmpi/
 F:	package/pinentry/
 F:	package/trinity/
 
-N:	Vincent Stehl? <[email protected]>
+N:	Vincent Stehl? <[email protected]>
 F:	package/i7z/
 F:	package/msr-tools/
+F:	package/uftrace/
 
 N:	Vinicius Tinti <[email protected]>
 F:	package/python-thrift/
package/Config.in +1 -0
index f69f67f3e..d9639b040 100644
@@ -121,6 +121,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/whetstone/Config.in"
 endmenu
package/uftrace/Config.in new file +20 -0
new file mode 100644
index 000000000..bb766238c
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !(BR2_arm &&?BR2_ARM_SOFT_FLOAT)
+	depends on BR2_PACKAGE_ELFUTILS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  A simple function call tracer for user programs.
+
+	  Note that the executable you want to trace should be compiled
+	  with -pg or -finstrument-functions option.
+
+	  https://github.com/namhyung/uftrace
+
+comment "uftrace needs a glibc toolchain and elfutils"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !BR2_PACKAGE_ELFUTILS || !BR2_TOOLCHAIN_USES_GLIBC
+
+comment "uftrace needs a toolchain with hardware floats on ARM"
+	depends on BR2_arm &&?BR2_ARM_SOFT_FLOAT
package/uftrace/uftrace.hash new file +2 -0
new file mode 100644
index 000000000..8509197cc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 afa698053ef10582c2ed3973ea134c0775d7ff4dcece3034905026185c52b272 uftrace-v0.7.tar.gz
package/uftrace/uftrace.mk new file +28 -0
new file mode 100644
index 000000000..e23f01816
@@ -0,0 +1,28 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = v0.7
+UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))
+UFTRACE_DEPENDENCIES = elfutils
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+define UFTRACE_CONFIGURE_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+	LD="$(TARGET_LD)" ARCH="$(ARCH)" \
+	./configure --prefix=/usr
+endef
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR="$(TARGET_DIR)"
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 uftrace: new package

Hi Vincent,

Le 25/06/2017 ? 21:37, Vincent Stehle a ?crit :

Quoted 28 lines

From: Vincent Stehl? <[email protected]>

Add a package for uftrace, a simple function call tracer for user programs.

The x86_64 and arm/aarch64 architectures are supported.

Tracing necessitates that the executable you want to trace be compiled with -pg or -finstrument-functions option.

See https://github.com/namhyung/uftrace

---
 DEVELOPERS                   |  3 ++-
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 20 ++++++++++++++++++++
 package/uftrace/uftrace.hash |  2 ++
 package/uftrace/uftrace.mk   | 28 ++++++++++++++++++++++++++++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +0 -0
index 9e421f4b4..5f2a6b0db 100644

DEVELOPERS F: package/openmpi/ · line 1709

Quoted 5 lines
DEVELOPERS +1 -1
@@ -1706,9 +1706,10 @@ F:	package/openmpi/
 F:	package/pinentry/
 F:	package/trinity/
 
-N:	Vincent Stehl? <[email protected]>
+N:	Vincent Stehl? <[email protected]>

This should be part of another commit since it's not related to uftrace.

Quoted 24 lines
DEVELOPERS +1 -0
 F:	package/i7z/
 F:	package/msr-tools/
+F:	package/uftrace/
 
 N:	Vinicius Tinti <[email protected]>
 F:	package/python-thrift/
package/Config.in +1 -0
index f69f67f3e..d9639b040 100644
@@ -121,6 +121,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/whetstone/Config.in"
 endmenu
package/uftrace/Config.in new file +0 -0
new file mode 100644
index 000000000..bb766238c

package/uftrace/Config.in line 4

Quoted 4 lines
package/uftrace/Config.in new file +4 -0
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !(BR2_arm && BR2_ARM_SOFT_FLOAT)

This could be:

	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64

Btw, can you explain why only armhf is supported ?

package/uftrace/Config.in line 5

Quoted 1 line
package/uftrace/Config.in new file +1 -0
+	depends on BR2_PACKAGE_ELFUTILS

Can you select BR2_PACKAGE_ELFUTILS and add reverse decencies

depends on BR2_USE_WCHAR # elfutils
depends on !BR2_STATIC_LIBS # elfutils

Also add thread dependency:
depends on BR2_TOOLCHAIN_HAS_THREADS

package/uftrace/Config.in line 6

Quoted 1 line
package/uftrace/Config.in new file +1 -0
+	depends on BR2_TOOLCHAIN_USES_GLIBC

Why it's restricted to glibc based toolchain ? At least you can keep the elfutils reverse dependencies:

	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils

It should be fine with uClibc-ng toolchains.

package/uftrace/Config.in line 17

Quoted 11 lines
package/uftrace/Config.in new file +11 -0
+	help
+	  A simple function call tracer for user programs.
+
+	  Note that the executable you want to trace should be compiled
+	  with -pg or -finstrument-functions option.
+
+	  https://github.com/namhyung/uftrace
+
+comment "uftrace needs a glibc toolchain and elfutils"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !BR2_PACKAGE_ELFUTILS || !BR2_TOOLCHAIN_USES_GLIBC

update the comment dependencies accordingly:
comment "uftrace needs a glibc or uClibc toolchain w/ dynamic library, threads, wchar"

	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64
	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
		|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
Quoted 25 lines
package/uftrace/Config.in new file +3 -0
+
+comment "uftrace needs a toolchain with hardware floats on ARM"
+	depends on BR2_arm && BR2_ARM_SOFT_FLOAT
package/uftrace/uftrace.hash new file +2 -0
new file mode 100644
index 000000000..8509197cc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 afa698053ef10582c2ed3973ea134c0775d7ff4dcece3034905026185c52b272 uftrace-v0.7.tar.gz
package/uftrace/uftrace.mk new file +8 -0
new file mode 100644
index 000000000..e23f01816
@@ -0,0 +1,28 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = v0.7
+UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))

package/uftrace/uftrace.mk line 18

Quoted 10 lines
package/uftrace/uftrace.mk new file +10 -0
+UFTRACE_DEPENDENCIES = elfutils
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+define UFTRACE_CONFIGURE_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+	LD="$(TARGET_LD)" ARCH="$(ARCH)" \
+	./configure --prefix=/usr
+endef

Use $(TARGET_CONFIGURE_OPTS) instead of defining CC, CFLAGS etc on the command line. Also add parenthesis
Something like:

	(cd $(@D) && \
	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
	ARCH="$(ARCH)" \
	./configure --prefix=/usr)

package/uftrace/uftrace.mk line 21

Quoted 3 lines
package/uftrace/uftrace.mk new file +3 -0
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)

Keep $(TARGET_CONFIGURE_OPTS) and ARCH="$(ARCH)"

package/uftrace/uftrace.mk line 25

Quoted 4 lines
package/uftrace/uftrace.mk new file +4 -0
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR="$(TARGET_DIR)"

Same here.

Best regards,
Romain

Quoted 4 lines
package/uftrace/uftrace.mk new file +3 -0
+endef
+
+$(eval $(generic-package))
#2 lore raw

PATCH 1/1 uftrace: new package

Quoted 8 lines · Romain Naour

Use $(TARGET_CONFIGURE_OPTS) instead of defining CC, CFLAGS etc on the command line. Also add parenthesis
Something like:

	(cd $(@D) && \
	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
	ARCH="$(ARCH)" \
	./configure --prefix=/usr)

No, don't add parenthesis. Somebody a long time ago started doing that but
there is absolutely no reason for it, it just creates an additional shell level that serves no purpose whatsoever.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/1 uftrace: new package

In reply to Romain Naour
Quoted 2 lines · Romain Naour

Hi Vincent,

Hi Romain,

Thank you for reviewing!

Quoted 32 lines

Le 25/06/2017 ? 21:37, Vincent Stehle a ?crit :

Quoted 31 lines

From: Vincent Stehl? <[email protected]>

Add a package for uftrace, a simple function call tracer for user programs.

The x86_64 and arm/aarch64 architectures are supported.

Tracing necessitates that the executable you want to trace be compiled with -pg or -finstrument-functions option.

See https://github.com/namhyung/uftrace

---
 DEVELOPERS                   |  3 ++-
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 20 ++++++++++++++++++++
 package/uftrace/uftrace.hash |  2 ++
 package/uftrace/uftrace.mk   | 28 ++++++++++++++++++++++++++++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +0 -0
index 9e421f4b4..5f2a6b0db 100644
@@ -1706,9 +1706,10 @@ F:	package/openmpi/
 F:	package/pinentry/
 F:	package/trinity/
 
Quoted 4 lines

DEVELOPERS F: package/openmpi/ · line 1709

Quoted 2 lines
DEVELOPERS +1 -1
-N:	Vincent Stehl? <[email protected]>
+N:	Vincent Stehl? <[email protected]>

This should be part of another commit since it's not related to uftrace.

If you insist I can separate this update from the patch, sure.

Note that half the commits in the tree touching the DEVELOPERS file do in fact modify something else in the mean time so I guess we are still somewhat in the "tradition" :)

Quoted 31 lines
Quoted 25 lines
DEVELOPERS +1 -0
 F:	package/i7z/
 F:	package/msr-tools/
+F:	package/uftrace/
 
 N:	Vinicius Tinti <[email protected]>
 F:	package/python-thrift/
package/Config.in +1 -0
index f69f67f3e..d9639b040 100644
@@ -121,6 +121,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/whetstone/Config.in"
 endmenu
package/uftrace/Config.in new file +0 -0
new file mode 100644
index 000000000..bb766238c

package/uftrace/Config.in line 4

Quoted 4 lines
package/uftrace/Config.in new file +4 -0
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !(BR2_arm && BR2_ARM_SOFT_FLOAT)

This could be:

Quoted 1 line
	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64

This is clearer, thanks.

Quoted 2 lines

Btw, can you explain why only armhf is supported ?

Certainly: the inline assembly fragments used to retrieve the registers access the NEON/float registers without any #ifdef:

https://github.com/namhyung/uftrace/blob/master/arch/arm/mcount-support.c#L353

I guess it should be possible to "port" uftrace to arm soft float as well.

Quoted 10 lines

package/uftrace/Config.in line 5

Quoted 2 lines
package/uftrace/Config.in new file +1 -0
+	depends on BR2_PACKAGE_ELFUTILS

Can you select BR2_PACKAGE_ELFUTILS and add reverse decencies

depends on BR2_USE_WCHAR # elfutils
depends on !BR2_STATIC_LIBS # elfutils

Also add thread dependency:
depends on BR2_TOOLCHAIN_HAS_THREADS

Ok I'll go for select + "propagating" the dependencies, thanks.

Quoted 9 lines

package/uftrace/Config.in line 6

Quoted 2 lines
package/uftrace/Config.in new file +1 -0
+	depends on BR2_TOOLCHAIN_USES_GLIBC

Why it's restricted to glibc based toolchain ? At least you can keep the elfutils reverse dependencies:

	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils

It should be fine with uClibc-ng toolchains.

When I tested with test-pkg I found no way of making it build properly on uClibc/musl based toolchains. Let me retry with the select/depends reworked as you proposed and I'll let you know how it goes.

Quoted 16 lines

package/uftrace/Config.in line 17

Quoted 12 lines
package/uftrace/Config.in new file +11 -0
+	help
+	  A simple function call tracer for user programs.
+
+	  Note that the executable you want to trace should be compiled
+	  with -pg or -finstrument-functions option.
+
+	  https://github.com/namhyung/uftrace
+
+comment "uftrace needs a glibc toolchain and elfutils"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !BR2_PACKAGE_ELFUTILS || !BR2_TOOLCHAIN_USES_GLIBC

update the comment dependencies accordingly:
comment "uftrace needs a glibc or uClibc toolchain w/ dynamic library, threads, wchar"

Quoted 3 lines
	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64
	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
		|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)

Ok, I'll update the comments, thanks.

Quoted 41 lines
Quoted 26 lines
package/uftrace/Config.in new file +3 -0
+
+comment "uftrace needs a toolchain with hardware floats on ARM"
+	depends on BR2_arm && BR2_ARM_SOFT_FLOAT
package/uftrace/uftrace.hash new file +2 -0
new file mode 100644
index 000000000..8509197cc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 afa698053ef10582c2ed3973ea134c0775d7ff4dcece3034905026185c52b272 uftrace-v0.7.tar.gz
package/uftrace/uftrace.mk new file +8 -0
new file mode 100644
index 000000000..e23f01816
@@ -0,0 +1,28 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = v0.7
+UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))

package/uftrace/uftrace.mk line 18

Quoted 10 lines
package/uftrace/uftrace.mk new file +10 -0
+UFTRACE_DEPENDENCIES = elfutils
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+define UFTRACE_CONFIGURE_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+	LD="$(TARGET_LD)" ARCH="$(ARCH)" \
+	./configure --prefix=/usr
+endef

Use $(TARGET_CONFIGURE_OPTS) instead of defining CC, CFLAGS etc on the command line. Also add parenthesis
Something like:

Quoted 4 lines
	(cd $(@D) && \
	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
	ARCH="$(ARCH)" \
	./configure --prefix=/usr)

This one I'll drop if you don't mind.

Quoted 7 lines

package/uftrace/uftrace.mk line 21

Quoted 4 lines
package/uftrace/uftrace.mk new file +3 -0
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)

Keep $(TARGET_CONFIGURE_OPTS) and ARCH="$(ARCH)"

Quoted 6 lines

package/uftrace/uftrace.mk line 25

Quoted 4 lines
package/uftrace/uftrace.mk new file +4 -0
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR="$(TARGET_DIR)"

Same here.

Well some of the environment settings and configure options are "sampled" by this configure script of theirs (which resembles autoconf and is not). This ends up being stored in a file, which is reused afterwards.

I did not want to add the conf opts and arch to the following steps and give the impression that they were taken into account while this is the local configuration file in fact, which has the priority.

Can I please keep it as is?

Meanwhile I'll work on a v2. Thank you for spending time reviewing this patch!

Best regards,

Vincent.

Quoted 9 lines

Best regards,
Romain

Quoted 4 lines
package/uftrace/uftrace.mk new file +3 -0
+endef
+
+$(eval $(generic-package))
#4 lore raw

PATCH 1/1 uftrace: new package

Quoted 4 lines · Vincent Stehl?

Well some of the environment settings and configure options are "sampled" by this configure script of theirs (which resembles autoconf and is not). This ends up being stored in a file, which is reused afterwards.

Please keep this explanation either in the commit log or in a comment in the
.mk file itself, otherwise people will ask the same question again.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 uftrace: new package

In reply to Vincent Stehlé

Hi Vincent,

Le 03/07/2017 ? 22:47, Vincent Stehl? a ?crit :

Quoted 40 lines · Romain Naour
Quoted 2 lines

Hi Vincent,

Hi Romain,

Thank you for reviewing!

Quoted 32 lines

Le 25/06/2017 ? 21:37, Vincent Stehle a ?crit :

Quoted 31 lines

From: Vincent Stehl? <[email protected]>

Add a package for uftrace, a simple function call tracer for user programs.

The x86_64 and arm/aarch64 architectures are supported.

Tracing necessitates that the executable you want to trace be compiled with -pg or -finstrument-functions option.

See https://github.com/namhyung/uftrace

---
 DEVELOPERS                   |  3 ++-
 package/Config.in            |  1 +
 package/uftrace/Config.in    | 20 ++++++++++++++++++++
 package/uftrace/uftrace.hash |  2 ++
 package/uftrace/uftrace.mk   | 28 ++++++++++++++++++++++++++++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 package/uftrace/Config.in
 create mode 100644 package/uftrace/uftrace.hash
 create mode 100644 package/uftrace/uftrace.mk
DEVELOPERS +0 -0
index 9e421f4b4..5f2a6b0db 100644
@@ -1706,9 +1706,10 @@ F:	package/openmpi/
 F:	package/pinentry/
 F:	package/trinity/
 
Quoted 6 lines
Quoted 4 lines

DEVELOPERS F: package/openmpi/ · line 1709

Quoted 2 lines
DEVELOPERS +1 -1
-N:	Vincent Stehl? <[email protected]>
+N:	Vincent Stehl? <[email protected]>

This should be part of another commit since it's not related to uftrace.

If you insist I can separate this update from the patch, sure.

It seems you're doing the same change in pixz package so it will conflict while applying. It's just an advice to avoid this :)

Quoted 4 lines

Note that half the commits in the tree touching the DEVELOPERS file do in fact modify something else in the mean time so I guess we are still somewhat in the "tradition" :)

Touching the DEVEOPERS file should be done only when adding a new package. (I forgot to do so earlier today with my llvm series :-/)

Quoted 37 lines
Quoted 32 lines
Quoted 26 lines
DEVELOPERS +1 -0
 F:	package/i7z/
 F:	package/msr-tools/
+F:	package/uftrace/
 
 N:	Vinicius Tinti <[email protected]>
 F:	package/python-thrift/
package/Config.in +1 -0
index f69f67f3e..d9639b040 100644
@@ -121,6 +121,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/whetstone/Config.in"
 endmenu
package/uftrace/Config.in new file +0 -0
new file mode 100644
index 000000000..bb766238c

package/uftrace/Config.in line 4

Quoted 4 lines
package/uftrace/Config.in new file +4 -0
@@ -0,0 +1,20 @@
+config BR2_PACKAGE_UFTRACE
+	bool "uftrace"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !(BR2_arm && BR2_ARM_SOFT_FLOAT)

This could be:

Quoted 1 line
	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64

This is clearer, thanks.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Btw, can you explain why only armhf is supported ?

Certainly: the inline assembly fragments used to retrieve the registers access the NEON/float registers without any #ifdef:

https://github.com/namhyung/uftrace/blob/master/arch/arm/mcount-support.c#L353

I guess it should be possible to "port" uftrace to arm soft float as well.

Maybe you can add this info in the commit log, it's not obvious.

Quoted 20 lines
Quoted 11 lines

package/uftrace/Config.in line 5

Quoted 3 lines
package/uftrace/Config.in new file +1 -0
+	depends on BR2_PACKAGE_ELFUTILS

Can you select BR2_PACKAGE_ELFUTILS and add reverse decencies

depends on BR2_USE_WCHAR # elfutils
depends on !BR2_STATIC_LIBS # elfutils

Also add thread dependency:
depends on BR2_TOOLCHAIN_HAS_THREADS

Ok I'll go for select + "propagating" the dependencies, thanks.

Quoted 6 lines

package/uftrace/Config.in line 6

Quoted 2 lines
package/uftrace/Config.in new file +1 -0
+	depends on BR2_TOOLCHAIN_USES_GLIBC

Why it's restricted to glibc based toolchain ? At least you can keep the elfutils reverse dependencies:

Quoted 7 lines
Quoted 3 lines
	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils

It should be fine with uClibc-ng toolchains.

When I tested with test-pkg I found no way of making it build properly on uClibc/musl based toolchains. Let me retry with the select/depends reworked as you proposed and I'll let you know how it goes.

I did some testing with test-pkg script today and it uftrace build fine with uClibc-ng toolchains. musl toolchains can't be enabled due to elfutils dependencies.

Quoted 85 lines
Quoted 17 lines

package/uftrace/Config.in line 17

Quoted 13 lines
package/uftrace/Config.in new file +11 -0
+	help
+	  A simple function call tracer for user programs.
+
+	  Note that the executable you want to trace should be compiled
+	  with -pg or -finstrument-functions option.
+
+	  https://github.com/namhyung/uftrace
+
+comment "uftrace needs a glibc toolchain and elfutils"
+	depends on BR2_aarch64 || BR2_arm || BR2_x86_64
+	depends on !BR2_PACKAGE_ELFUTILS || !BR2_TOOLCHAIN_USES_GLIBC

update the comment dependencies accordingly:
comment "uftrace needs a glibc or uClibc toolchain w/ dynamic library, threads, wchar"

Quoted 3 lines
	depends on BR2_aarch64 || (BR2_arm && !BR2_ARM_SOFT_FLOAT) || BR2_x86_64
	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS \
		|| !(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)

Ok, I'll update the comments, thanks.

Quoted 41 lines
Quoted 26 lines
package/uftrace/Config.in new file +3 -0
+
+comment "uftrace needs a toolchain with hardware floats on ARM"
+	depends on BR2_arm && BR2_ARM_SOFT_FLOAT
package/uftrace/uftrace.hash new file +2 -0
new file mode 100644
index 000000000..8509197cc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256 afa698053ef10582c2ed3973ea134c0775d7ff4dcece3034905026185c52b272 uftrace-v0.7.tar.gz
package/uftrace/uftrace.mk new file +8 -0
new file mode 100644
index 000000000..e23f01816
@@ -0,0 +1,28 @@
+################################################################################
+#
+# uftrace
+#
+################################################################################
+
+UFTRACE_VERSION = v0.7
+UFTRACE_SITE = $(call github,namhyung,uftrace,$(UFTRACE_VERSION))

package/uftrace/uftrace.mk line 18

Quoted 10 lines
package/uftrace/uftrace.mk new file +10 -0
+UFTRACE_DEPENDENCIES = elfutils
+UFTRACE_LICENSE = GPL-2.0
+UFTRACE_LICENSE_FILES = COPYING
+
+define UFTRACE_CONFIGURE_CMDS
+	cd $(@D) && \
+	$(TARGET_MAKE_ENV) CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+	LD="$(TARGET_LD)" ARCH="$(ARCH)" \
+	./configure --prefix=/usr
+endef

Use $(TARGET_CONFIGURE_OPTS) instead of defining CC, CFLAGS etc on the command line. Also add parenthesis
Something like:

Quoted 4 lines
	(cd $(@D) && \
	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
	ARCH="$(ARCH)" \
	./configure --prefix=/usr)

This one I'll drop if you don't mind.

Quoted 7 lines

package/uftrace/uftrace.mk line 21

Quoted 4 lines
package/uftrace/uftrace.mk new file +3 -0
+
+define UFTRACE_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)

Keep $(TARGET_CONFIGURE_OPTS) and ARCH="$(ARCH)"

Quoted 6 lines

package/uftrace/uftrace.mk line 25

Quoted 4 lines
package/uftrace/uftrace.mk new file +4 -0
+endef
+
+define UFTRACE_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) install DESTDIR="$(TARGET_DIR)"

Same here.

Quoted 8 lines

Well some of the environment settings and configure options are "sampled" by this configure script of theirs (which resembles autoconf and is not). This ends up being stored in a file, which is reused afterwards.

I did not want to add the conf opts and arch to the following steps and give the impression that they were taken into account while this is the local configuration file in fact, which has the priority.

Indeed, I just see this file using the "override" keyword on each Make variable...

Quoted 2 lines

Can I please keep it as is?

Sure, no problem it was a suggestion.

Quoted 3 lines

Meanwhile I'll work on a v2. Thank you for spending time reviewing this patch!

Thanks for you contribution.

Best regards,
Romain

Quoted 15 lines

Best regards,

Vincent.

Quoted 9 lines

Best regards,
Romain

Quoted 4 lines
package/uftrace/uftrace.mk new file +3 -0
+endef
+
+$(eval $(generic-package))
#6 lore raw

PATCH 1/1 uftrace: new package

In reply to Vincent Stehle

Hi!

Quoted 3 lines · Vincent Stehle

From: Vincent Stehl? <[email protected]>

Add a package for uftrace, a simple function call tracer for user programs.

Any update on this patch series?

Quoted 5 lines

The x86_64 and arm/aarch64 architectures are supported.

Tracing necessitates that the executable you want to trace be compiled with -pg or -finstrument-functions option.

How can those flags be passed when compiling Buildroot packages?

Regards,

--
ELB

#7 lore raw

PATCH 1/1 uftrace: new package

Quoted 1 line · Eric Le Bihan

Any update on this patch series?

Bonjour Eric,

I am sorry, it has been a while since I worked on those patches :(

(-pg or -finstrument-functions)

Quoted 1 line

How can those flags be passed when compiling Buildroot packages?

I am not sure if we have a clean way through a configuration variable.

The way I did it was a bit of a hack as I edited the concerned package makefile directly (and I find it one strength of buildroot that you can do that type of modification so easily when needed.)

Maybe we need a way to add arbitrary options to the CFLAGS, per package?

Best regards,

Vincent.