Skip to contentSkip to conversation

valgrind: allow selecting which tools to install

PATCH New Thomas De Schampheleire 3 participants 4 messages Mar 14, 2012 – Apr 5, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 valgrind: allow selecting which tools to install

The full valgrind installation takes more than 20 MB, while one typically does not use all of its tools. This patch adds extra config options to select which tools to install.

---
 package/valgrind/Config.in   |  70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 package/valgrind/valgrind.mk |  95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+), 0 deletions(-)
package/valgrind/Config.in +70 -0
@@ -6,3 +6,73 @@ config BR2_PACKAGE_VALGRIND
 	  Tool for debugging and profiling Linux programs.
 
 	  http://valgrind.kde.org/
+
+if BR2_PACKAGE_VALGRIND
+
+config BR2_PACKAGE_VALGRIND_MEMCHECK
+	bool "Memcheck: a memory error detector"
+	default y
+	help
+	  This option allows to install the Memcheck tool
+
+config BR2_PACKAGE_VALGRIND_CACHEGRIND
+	bool "Cachegrind: a cache and branch-prediction profiler"
+	default y
+	help
+	  This option allows to install the Cachegrind tool
+
+config BR2_PACKAGE_VALGRIND_CALLGRIND
+	bool "Callgrind: a call-graph generating cache and branch prediction profiler"
+	default y
+	help
+	  This option allows to install the Callgrind tool
+
+config BR2_PACKAGE_VALGRIND_HELGRIND
+	bool "Helgrind: a thread error detector"
+	default y
+	help
+	  This option allows to install the Helgrind tool
+
+config BR2_PACKAGE_VALGRIND_DRD
+	bool "DRD: a thread error detector"
+	default y
+	help
+	  This option allows to install the DRD tool
+
+config BR2_PACKAGE_VALGRIND_MASSIF
+	bool "Massif: a heap profiler"
+	default y
+	help
+	  This option allows to install the Massif tool
+
+config BR2_PACKAGE_VALGRIND_DHAT
+	bool "DHAT: a dynamic heap analysis tool"
+	default y
+	help
+	  This option allows to install the DHAT tool
+
+config BR2_PACKAGE_VALGRIND_PTRCHECK
+	bool "Ptrcheck: an experimental head, stack and global array overrun detector"
+	default y
+	help
+	  This option allows to install the Ptrcheck tool
+
+config BR2_PACKAGE_VALGRIND_BBV
+	bool "BBV: an experimental basic block vector generation tool"
+	default y
+	help
+	  This option allows to install the BBV tool
+
+config BR2_PACKAGE_VALGRIND_LACKEY
+	bool "Lackey: an example tool"
+	default y
+	help
+	  This option allows to install the Lackey tool
+
+config BR2_PACKAGE_VALGRIND_NULGRIND
+	bool "Nulgrind: the minimal Valgrind tool"
+	default y
+	help
+	  This option allows to install the Nulgrind tool
+
+endif
package/valgrind/valgrind.mk +95 -0

99 lines not on this page · raw message

#1 lore raw

PATCH 1/1 valgrind: allow selecting which tools to install

Quoted 190 lines · Thomas De Schampheleire

The full valgrind installation takes more than 20 MB, while one typically does not use all of its tools. This patch adds extra config options to select which tools to install.

---
?package/valgrind/Config.in ? | ?70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ?package/valgrind/valgrind.mk | ?95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ?2 files changed, 165 insertions(+), 0 deletions(-)

package/valgrind/Config.in +0 -0
@@ -6,3 +6,73 @@ config BR2_PACKAGE_VALGRIND

? ? ? ? ?Tool for debugging and profiling Linux programs.

? ? ? ? ?http://valgrind.kde.org/

package/valgrind/Config.in +70 -0
+
+if BR2_PACKAGE_VALGRIND
+
+config BR2_PACKAGE_VALGRIND_MEMCHECK
+ ? ? ? bool "Memcheck: a memory error detector"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Memcheck tool
+
+config BR2_PACKAGE_VALGRIND_CACHEGRIND
+ ? ? ? bool "Cachegrind: a cache and branch-prediction profiler"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Cachegrind tool
+
+config BR2_PACKAGE_VALGRIND_CALLGRIND
+ ? ? ? bool "Callgrind: a call-graph generating cache and branch prediction profiler"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Callgrind tool
+
+config BR2_PACKAGE_VALGRIND_HELGRIND
+ ? ? ? bool "Helgrind: a thread error detector"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Helgrind tool
+
+config BR2_PACKAGE_VALGRIND_DRD
+ ? ? ? bool "DRD: a thread error detector"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the DRD tool
+
+config BR2_PACKAGE_VALGRIND_MASSIF
+ ? ? ? bool "Massif: a heap profiler"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Massif tool
+
+config BR2_PACKAGE_VALGRIND_DHAT
+ ? ? ? bool "DHAT: a dynamic heap analysis tool"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the DHAT tool
+
+config BR2_PACKAGE_VALGRIND_PTRCHECK
+ ? ? ? bool "Ptrcheck: an experimental head, stack and global array overrun detector"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Ptrcheck tool
+
+config BR2_PACKAGE_VALGRIND_BBV
+ ? ? ? bool "BBV: an experimental basic block vector generation tool"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the BBV tool
+
+config BR2_PACKAGE_VALGRIND_LACKEY
+ ? ? ? bool "Lackey: an example tool"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Lackey tool
+
+config BR2_PACKAGE_VALGRIND_NULGRIND
+ ? ? ? bool "Nulgrind: the minimal Valgrind tool"
+ ? ? ? default y
+ ? ? ? help
+ ? ? ? ? This option allows to install the Nulgrind tool
+
+endif
package/valgrind/valgrind.mk +0 -0
@@ -25,4 +25,99 @@ endef
 

?VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_INSTALL_UCLIBC_SUPP

package/valgrind/valgrind.mk +95 -0
+ifeq ($(BR2_PACKAGE_VALGRIND_MEMCHECK),)
+define VALGRIND_REMOVE_MEMCHECK
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*memcheck*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_MEMCHECK
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_CACHEGRIND),)
+define VALGRIND_REMOVE_CACHEGRIND
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*cachegrind*
+ ? ? ? for i in cg_annotate cg_diff cg_merge; do \
+ ? ? ? ? ? ? ? rm -f $(TARGET_DIR)/usr/bin/$$i ; \
+ ? ? ? done
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_CACHEGRIND
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_CALLGRIND),)
+define VALGRIND_REMOVE_CALLGRIND
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*callgrind*
+ ? ? ? for i in callgrind_annotate callgrind_control ; do \
+ ? ? ? ? ? ? ? rm -f $(TARGET_DIR)/usr/bin/$$i ; \
+ ? ? ? done
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_CALLGRIND
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_HELGRIND),)
+define VALGRIND_REMOVE_HELGRIND
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*helgrind*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_HELGRIND
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_DRD),)
+define VALGRIND_REMOVE_DRD
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*drd*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_DRD
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_MASSIF),)
+define VALGRIND_REMOVE_MASSIF
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*massif*
+ ? ? ? rm -f $(TARGET_DIR)/usr/bin/ms_script
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_MASSIF
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_DHAT),)
+define VALGRIND_REMOVE_DHAT
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*dhat*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_DHAT
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_PTRCHECK),)
+define VALGRIND_REMOVE_PTRCHECK
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*ptrcheck*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_PTRCHECK
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_BBV),)
+define VALGRIND_REMOVE_BBV
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*bbv*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_BBV
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_LACKEY),)
+define VALGRIND_REMOVE_LACKEY
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*lackey*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_LACKEY
+endif
+
+ifeq ($(BR2_PACKAGE_VALGRIND_NULGRIND),)
+define VALGRIND_REMOVE_NULGRIND
+ ? ? ? rm -f $(TARGET_DIR)/usr/lib/valgrind/*none*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_NULGRIND
+endif
+
Quoted 1 line

?$(eval $(call AUTOTARGETS))

bump

#2 lore raw

PATCH 1/1 valgrind: allow selecting which tools to install

In reply to Thomas De Schampheleire
Quoted 5 lines · On Wednesday 14 March 2012 17:50:59 Thomas De Schampheleire wrote:

The full valgrind installation takes more than 20 MB, while one typically does not use all of its tools. This patch adds extra config options to select which tools to install.

Strange that this patch didn't get any feedback before... I guess we
all trust Thomas enough to make good patches :-)

I'm a bit at loss as to what to do now. I believe this patch is useful
and good enough to go in as it is. So:

On the other hand, I do have some ideas how to make it even better.
But if I write these down, I'm afraid it will slow down the inclusion of a useful and well-implemented feature... Well, I'll take the risk:

[snip]

package/valgrind/Config.in config BR2_PACKAGE_VALGRIND · line 22

Quoted 11 lines
package/valgrind/Config.in +11 -0
+config BR2_PACKAGE_VALGRIND_MEMCHECK
+	bool "Memcheck: a memory error detector"
+	default y
+	help
+	  This option allows to install the Memcheck tool
+
+config BR2_PACKAGE_VALGRIND_CACHEGRIND
+	bool "Cachegrind: a cache and branch-prediction profiler"
+	default y
+	help
+	  This option allows to install the Cachegrind tool

Even though this breaks existing configurations, I believe that all
tools (with the possible exception of memcheck) should default to no. For existing configurations, that's what most people will want anyway. And for new configurations, I think it's usually just one, maybe two tools that are needed, so it's a lot of work to disable all of them.

[snip]

package/valgrind/Config.in config BR2_PACKAGE_VALGRIND · line 58

Quoted 5 lines
package/valgrind/Config.in +5 -0
+config BR2_PACKAGE_VALGRIND_PTRCHECK
+	bool "Ptrcheck: an experimental head, stack and global array overrun detector"
+	default y
+	help
+	  This option allows to install the Ptrcheck tool

At the very least, the experimental ones should default to no.

[snip]

package/valgrind/Config.in config BR2_PACKAGE_VALGRIND · line 76

Quoted 5 lines
package/valgrind/Config.in +5 -0
+config BR2_PACKAGE_VALGRIND_NULGRIND
+	bool "Nulgrind: the minimal Valgrind tool"
+	default y
+	help
+	  This option allows to install the Nulgrind tool

And this one definitely should default to no.

[snip]

package/valgrind/valgrind.mk endef · line 34

Quoted 7 lines
package/valgrind/valgrind.mk +7 -0
+ifeq ($(BR2_PACKAGE_VALGRIND_MEMCHECK),)
+define VALGRIND_REMOVE_MEMCHECK
+	rm -f $(TARGET_DIR)/usr/lib/valgrind/*memcheck*
+endef
+
+VALGRIND_POST_INSTALL_TARGET_HOOKS += VALGRIND_REMOVE_MEMCHECK
+endif

It's probably just personal preference, but I like to see:

define VALGRIND_REMOVE_MEMCHECK

	rm -f $(TARGET_DIR)/usr/lib/valgrind/*memcheck*

endef

VALGRIND_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_VALGRIND_MEMCHECK),,VALGRIND_REMOVE_MEMCHECK)

(although the double comma isn't making things very clear either...)

It would actually be better to not build the unneeded tools at all, by
setting
VALGRIND_MAKE_OPT = TOOLS="..." EXP_TOOLS="..."

Unfortunately, Makefile.autotools.in doesn't use PKG_MAKE_OPT for the
install targets (which is probably a bug...), so that won't work.

[snip]

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 valgrind: allow selecting which tools to install

In reply to Thomas De Schampheleire
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

Thomas> The full valgrind installation takes more than 20 MB, while one Thomas> typically does not use all of its tools. This patch adds extra Thomas> config options to select which tools to install.

Committed with Arnout's suggestion to not default the experimental tools to 'y' - Thanks.

Signature · 1 line
Bye, Peter Korsgaard