summaryrefslogtreecommitdiff
path: root/package/devel/valgrind
diff options
context:
space:
mode:
Diffstat (limited to 'package/devel/valgrind')
-rw-r--r--package/devel/valgrind/Makefile164
-rw-r--r--package/devel/valgrind/files/default.supp42
-rw-r--r--package/devel/valgrind/patches/100-fix_configure_check.patch11
-rw-r--r--package/devel/valgrind/patches/110-add_a_out_h.patch157
-rw-r--r--package/devel/valgrind/src/abort.c3
5 files changed, 377 insertions, 0 deletions
diff --git a/package/devel/valgrind/Makefile b/package/devel/valgrind/Makefile
new file mode 100644
index 0000000..c4f3697
--- /dev/null
+++ b/package/devel/valgrind/Makefile
@@ -0,0 +1,164 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=valgrind
+PKG_VERSION:=3.8.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://valgrind.org/downloads/
+PKG_MD5SUM:=ec04dfd1256307432b2a7b520398c526
+
+PKG_MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
+
+PKG_FIXUP = autoreconf
+PKG_INSTALL := 1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+define Package/valgrind
+ SECTION:=utils
+ CATEGORY:=Utilities
+ DEPENDS:=@mips||mipsel||i386||powerpc||TARGET_omap4 +libpthread +librt
+ TITLE:=debugging and profiling tools for Linux
+ URL:=http://www.valgrind.org
+endef
+
+define Package/valgrind/default
+ $(Package/valgrind)
+ DEPENDS := valgrind
+endef
+
+define Package/valgrind-cachegrind
+ $(Package/valgrind/default)
+ TITLE += (cache profiling)
+endef
+
+define Package/valgrind-callgrind
+ $(Package/valgrind/default)
+ TITLE += (callgraph profiling)
+endef
+
+define Package/valgrind-drd
+ $(Package/valgrind/default)
+ TITLE += (thread error detection)
+endef
+
+define Package/valgrind-massif
+ $(Package/valgrind/default)
+ TITLE += (heap profiling)
+endef
+
+define Package/valgrind-helgrind
+ $(Package/valgrind/default)
+ TITLE += (thread debugging)
+endef
+
+define Package/valgrind-vgdb
+ $(Package/valgrind/default)
+ TITLE += (GDB interface)
+endef
+
+define Package/valgrind/description
+ Valgrind is an award-winning suite of tools for debugging and
+ profiling Linux programs. With the tools that come with Valgrind,
+ you can automatically detect many memory management and threading
+ bugs, avoiding hours of frustrating bug-hunting, making your
+ programs more stable. You can also perform detailed profiling,
+ to speed up and reduce memory use of your programs.
+endef
+
+CPU := $(patsubst x86,i386,$(LINUX_KARCH))
+
+CONFIGURE_VARS += \
+ UNAME_R=$(LINUX_VERSION)
+
+CONFIGURE_ARGS += \
+ --enable-only32bit \
+ --enable-tls \
+ --without-x \
+ --without-uiout \
+ --disable-valgrindmi \
+ --disable-tui \
+ --disable-valgrindtk \
+ --without-included-gettext
+
+define Package/valgrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/valgrind* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ ./files/default.supp \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/none-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_core*.so \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/$(CPU)-*.xml \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/32bit-core*.xml \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/32bit-linux*.xml \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/memcheck-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_memcheck*.so \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-cachegrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cg_* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/cachegrind-* \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-callgrind/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/callgrind* $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/callgrind-* \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-drd/install
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/drd-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_drd*.so \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-massif/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ms_print $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/massif-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_massif*.so \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-helgrind/install
+ $(INSTALL_DIR) $(1)/usr/lib/valgrind
+ $(CP) \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/helgrind-* \
+ $(PKG_INSTALL_DIR)/usr/lib/valgrind/vgpreload_helgrind*.so \
+ $(1)/usr/lib/valgrind/
+endef
+
+define Package/valgrind-vgdb/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vgdb $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,valgrind))
+$(eval $(call BuildPackage,valgrind-cachegrind))
+$(eval $(call BuildPackage,valgrind-callgrind))
+$(eval $(call BuildPackage,valgrind-drd))
+$(eval $(call BuildPackage,valgrind-massif))
+$(eval $(call BuildPackage,valgrind-helgrind))
+$(eval $(call BuildPackage,valgrind-vgdb))
diff --git a/package/devel/valgrind/files/default.supp b/package/devel/valgrind/files/default.supp
new file mode 100644
index 0000000..beff559
--- /dev/null
+++ b/package/devel/valgrind/files/default.supp
@@ -0,0 +1,42 @@
+{
+ ld(Addr1)
+ Memcheck:Addr1
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Addr2)
+ Memcheck:Addr2
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Addr4)
+ Memcheck:Addr4
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ ld(Cond)
+ Memcheck:Cond
+ fun:*
+ obj:/lib/ld-*
+}
+{
+ strlen(Cond)
+ Memcheck:Cond
+ fun:strlen
+ fun:*
+}
+{
+ strnlen(Cond)
+ Memcheck:Cond
+ fun:strnlen
+ fun:*
+}
+{
+ index(Cond)
+ Memcheck:Cond
+ fun:index
+ fun:*
+}
diff --git a/package/devel/valgrind/patches/100-fix_configure_check.patch b/package/devel/valgrind/patches/100-fix_configure_check.patch
new file mode 100644
index 0000000..b06cc3b
--- /dev/null
+++ b/package/devel/valgrind/patches/100-fix_configure_check.patch
@@ -0,0 +1,11 @@
+--- a/configure.in
++++ b/configure.in
+@@ -260,7 +260,7 @@ case "${host_os}" in
+ # Ok, this is linux. Check the kernel version
+ AC_MSG_CHECKING([for the kernel version])
+
+- kernel=`uname -r`
++ kernel=${UNAME_R:-`uname -r`}
+
+ case "${kernel}" in
+ 2.6.*|3.*)
diff --git a/package/devel/valgrind/patches/110-add_a_out_h.patch b/package/devel/valgrind/patches/110-add_a_out_h.patch
new file mode 100644
index 0000000..7d95fb3
--- /dev/null
+++ b/package/devel/valgrind/patches/110-add_a_out_h.patch
@@ -0,0 +1,157 @@
+--- /dev/null
++++ b/include/a.out.h
+@@ -0,0 +1,138 @@
++#ifndef __A_OUT_GNU_H__
++#define __A_OUT_GNU_H__
++
++#include <bits/a.out.h>
++
++#define __GNU_EXEC_MACROS__
++
++struct exec
++{
++ unsigned long a_info; /* Use macros N_MAGIC, etc for access. */
++ unsigned int a_text; /* Length of text, in bytes. */
++ unsigned int a_data; /* Length of data, in bytes. */
++ unsigned int a_bss; /* Length of uninitialized data area for file, in bytes. */
++ unsigned int a_syms; /* Length of symbol table data in file, in bytes. */
++ unsigned int a_entry; /* Start address. */
++ unsigned int a_trsize;/* Length of relocation info for text, in bytes. */
++ unsigned int a_drsize;/* Length of relocation info for data, in bytes. */
++};
++
++enum machine_type
++{
++ M_OLDSUN2 = 0,
++ M_68010 = 1,
++ M_68020 = 2,
++ M_SPARC = 3,
++ M_386 = 100,
++ M_MIPS1 = 151,
++ M_MIPS2 = 152
++};
++
++#define N_MAGIC(exec) ((exec).a_info & 0xffff)
++#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
++#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
++#define N_SET_INFO(exec, magic, type, flags) \
++ ((exec).a_info = ((magic) & 0xffff) \
++ | (((int)(type) & 0xff) << 16) \
++ | (((flags) & 0xff) << 24))
++#define N_SET_MAGIC(exec, magic) \
++ ((exec).a_info = ((exec).a_info & 0xffff0000) | ((magic) & 0xffff))
++#define N_SET_MACHTYPE(exec, machtype) \
++ ((exec).a_info = \
++ ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
++#define N_SET_FLAGS(exec, flags) \
++ ((exec).a_info = \
++ ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
++
++/* Code indicating object file or impure executable. */
++#define OMAGIC 0407
++/* Code indicating pure executable. */
++#define NMAGIC 0410
++/* Code indicating demand-paged executable. */
++#define ZMAGIC 0413
++/* This indicates a demand-paged executable with the header in the text.
++ The first page is unmapped to help trap NULL pointer references. */
++#define QMAGIC 0314
++/* Code indicating core file. */
++#define CMAGIC 0421
++
++#define N_TRSIZE(a) ((a).a_trsize)
++#define N_DRSIZE(a) ((a).a_drsize)
++#define N_SYMSIZE(a) ((a).a_syms)
++#define N_BADMAG(x) \
++ (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC \
++ && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC)
++#define _N_HDROFF(x) (1024 - sizeof (struct exec))
++#define N_TXTOFF(x) \
++ (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
++ (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
++#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
++#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
++#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
++#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
++#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
++
++/* Address of text segment in memory after it is loaded. */
++#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? 4096 : 0)
++
++/* Address of data segment in memory after it is loaded. */
++#define SEGMENT_SIZE 1024
++
++#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
++#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
++
++#define N_DATADDR(x) \
++ (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
++ : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
++#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
++
++#if !defined (N_NLIST_DECLARED)
++struct nlist
++{
++ union
++ {
++ char *n_name;
++ struct nlist *n_next;
++ long n_strx;
++ } n_un;
++ unsigned char n_type;
++ char n_other;
++ short n_desc;
++ unsigned long n_value;
++};
++#endif /* no N_NLIST_DECLARED. */
++
++#define N_UNDF 0
++#define N_ABS 2
++#define N_TEXT 4
++#define N_DATA 6
++#define N_BSS 8
++#define N_FN 15
++#define N_EXT 1
++#define N_TYPE 036
++#define N_STAB 0340
++#define N_INDR 0xa
++#define N_SETA 0x14 /* Absolute set element symbol. */
++#define N_SETT 0x16 /* Text set element symbol. */
++#define N_SETD 0x18 /* Data set element symbol. */
++#define N_SETB 0x1A /* Bss set element symbol. */
++#define N_SETV 0x1C /* Pointer to set vector in data area. */
++
++#if !defined (N_RELOCATION_INFO_DECLARED)
++/* This structure describes a single relocation to be performed.
++ The text-relocation section of the file is a vector of these structures,
++ all of which apply to the text section.
++ Likewise, the data-relocation section applies to the data section. */
++
++struct relocation_info
++{
++ int r_address;
++ unsigned int r_symbolnum:24;
++ unsigned int r_pcrel:1;
++ unsigned int r_length:2;
++ unsigned int r_extern:1;
++ unsigned int r_pad:4;
++};
++#endif /* no N_RELOCATION_INFO_DECLARED. */
++
++#endif /* __A_OUT_GNU_H__ */
+--- /dev/null
++++ b/include/bits/a.out.h
+@@ -0,0 +1,13 @@
++#ifndef __A_OUT_GNU_H__
++# error "Never use <bits/a.out.h> directly; include <a.out.h> instead."
++#endif
++
++#include <bits/wordsize.h>
++
++#if __WORDSIZE == 64
++
++/* Signal to users of this header that this architecture really doesn't
++ support a.out binary format. */
++#define __NO_A_OUT_SUPPORT 1
++
++#endif
diff --git a/package/devel/valgrind/src/abort.c b/package/devel/valgrind/src/abort.c
new file mode 100644
index 0000000..0b4ad98
--- /dev/null
+++ b/package/devel/valgrind/src/abort.c
@@ -0,0 +1,3 @@
+void abort(void)
+{
+}