一、下载
地址: http://valgrind.org/downloads/current.html
二、编译
sudo apt-get install automake //安装make工具
修改configure:
armv7*) 改成 armv7*|arm)
source /opt/fsl-imx-x11/4.9.11-1.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi //指定工具链路径
./configure --prefix=/opt/valgrind --host=arm-linux //配置生成Makefile
make //编译
make install //安装
生成的文件处于/opt/valgrind/
三、移植
1.将/opt/valgrind/bin/下的可执行文件cp到ARM的/usr/bin/
2.在ARM的/opt/下创建目录valgrind/lib/,除去/opt/valgrind/lib/valgrind/下不需要的文件只留下内存相关的,再将valgrind目录cp到ARM的/opt/lib/,裁剪完的文件为:
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下创建的/opt/valgrind/需要和以上的--prefix=/opt/valgrind一致
3.指定库的路径
export VALGRIND_LIB=/opt/valgrind/lib/valgrind
4.测试
valgrind --version