Valgrind是用于构建动态分析工具的仪器框架。 它附带了一组工具,每个工具都执行某种调试,分析或类似任务,可帮助您改进程序。
Valgrind的架构采用模块化设计,因此可以轻松创建新工具,而不会干扰现有结构。
http://valgrind.org/
./configure --prefix=/home/sun/share/install --host=arm-buildroot-linux-uclibcgnueabi
配置报错:
checking for a supported CPU... no (arm)
configure: error: Unsupported host architecture. Sorry
查看官方网站首页,发现对 ARM-LINUX 是支持的
将 armv7a* 改为 arm* 再次配置就不会报错了
修改前:
修改后:
make -j4
make install
会生成四个目录:bin lib share include
需要删除 lib/valgrind 目录下的文件 以及 整个 share 目录,最后精简到 12M 左右:
sun@machine:~/share/install$ du -sh bin include/ lib/
520K bin
2.1M include/
10M lib/
精简后的lib/valgrind 目录下所有文件:
32bit-core-valgrind-s1.xml 32bit-sse.xml arm-with-vfpv3.xml
32bit-core-valgrind-s2.xml arm-core-valgrind-s1.xml default.supp
32bit-core.xml arm-core-valgrind-s2.xml getoff-arm-linux
32bit-linux-valgrind-s1.xml arm-core.xml memcheck-arm-linux
32bit-linux-valgrind-s2.xml arm-vfpv3-valgrind-s1.xml vgpreload_core-arm-linux.so
32bit-linux.xml arm-vfpv3-valgrind-s2.xml vgpreload_memcheck-arm-linux.so
32bit-sse-valgrind-s1.xml arm-vfpv3.xml
32bit-sse-valgrind-s2.xml arm-with-vfpv3-valgrind.xml
文件名含有 ARM-LINUX 字样的文件信息:
sun@machine:~/share/install/lib/valgrind$ file *arm-linux*
getoff-arm-linux: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, with debug_info, not stripped
memcheck-arm-linux: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, with debug_info, not stripped
vgpreload_core-arm-linux.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped
vgpreload_memcheck-arm-linux.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, with debug_info, not stripped
http://valgrind.org/docs/manual/dist.readme-packagers.html
7. README_PACKAGERS
Greetings, packaging person! This information is aimed at people
building binary distributions of Valgrind.
Thanks for taking the time and effort to make a binary distribution of
Valgrind. The following notes may save you some trouble.
-- If your toolchain (compiler, linker) support lto, using the configure
option --enable-lto=yes will produce a smaller/faster valgrind
(up to 10%).
-- Do not ship your Linux distro with a completely stripped
/lib/ld.so. At least leave the debugging symbol names on -- line
number info isn't necessary. If you don't want to leave symbols on
ld.so, alternatively you can have your distro install ld.so's
debuginfo package by default, or make ld.so.debuginfo be a
requirement of your Valgrind RPM/DEB/whatever.
Reason for this is that Valgrind's Memcheck tool needs to intercept
calls to, and provide replacements for, some symbols in ld.so at
startup (most importantly strlen). If it cannot do that, Memcheck
shows a large number of false positives du