易百纳论坛

 找回密码
 注册
搜索
热搜: 海思 四轴 linux
查看: 344|回复: 5

[求助] valgrind 3535平台移植

[复制链接]
发表于 2016-11-29 09:55:13 | 显示全部楼层 |阅读模式
最近同事需求内存检测工具,打算在HI3536 Hi3535等平台上移植一下valgrind。
移植valgrind-3.12.0到最后挂载程序运行是都提示Illegal instruction

以3535平台为例,移植过程参考网友的http://blog.csdn.net/lizhangping/article/details/51833997这个帖子

解决了valgrind failed to start tool 'memcheck' for platform 'arm-linux': not a direcory问题by
    export VALGRIND_LIB=XXX/../valgrind/lib/valgrind
解决了/lib/下so为strip后的问题,valgrind必须使用为裁剪过的库
     从SDK中找到为裁剪的so文件替换文件系统中已裁剪过的动态库,重新制作了squash的文件文件系统

带-g编译了一个内存泄漏的小demo,挂着跑,出现如下问题:
# ./valgrind ../hello
valgrind: failed to start tool 'memcheck' for platform 'arm-linux': No such file or directory
# export VALGRIND_LIB=/mnt/valgrind/lib/valgrind
# ./valgrind ../hello
==695== Memcheck, a memory error detector
==695== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==695== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==695== Command: ../hello
==695==
==695==
==695== Process terminating with default action of signal 4 (SIGILL)
==695==  Illegal opcode at address 0x38092674
==695==    at 0x4000790: ??? (in /lib/ld-2.11.1.so)
==695==
==695== HEAP SUMMARY:
==695==     in use at exit: 0 bytes in 0 blocks
==695==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==695==
==695== All heap blocks were freed -- no leaks are possible
==695==
==695== For counts of detected and suppressed errors, rerun with: -v
==695== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction


尝试过的解决方法
1.观察valgrind的make过程发现 -fno-builtin  -marm -mcpu=cortex-a8  -O2 -g
  查看3535编译平台信息CFLAGS += -march=armv7-a -mcpu=cortex-a9
  将所有Makefile中cortex-a8 改为cortex-a9 shell脚本如下
  sed -i "s/cortex-a8/cortex-a9/g" `grep "cortex-a8" -rl ./`
  观察到make时 cortex-a8 已被改为cortex-a9
  但是问题依旧。

查资料查到valgrind支持armv7 以上平台,但是出现这个操作码不识别的情况是什么原因,平台架构都已经配置正确了啊。 有移植成功的或者有怀疑对象的童鞋欢迎留言指导。先行谢过。
 楼主| 发表于 2016-11-29 10:06:04 | 显示全部楼层
本帖最后由 vc66vcc 于 2016-11-29 10:15 编辑

文档中写到支持armv7-a指令。
On ARM, essentially the entire ARMv7-A instruction set is supported, in both ARM and Thumb mode. ThumbEE and Jazelle are not supported. NEON, VFPv3 and ARMv6 media support is fairly complete.
发表于 2016-12-2 17:26:44 | 显示全部楼层
请问下,您的问题解决了?
发表于 2016-12-2 17:29:59 | 显示全部楼层
我参照你所说的那个文档进行了移植,结果拷到板子运行程序,总是提示如下信息(任何一个程序都提示如下信息),不知能否给与指点?,运行的提示信息如下:
# valgrind ./BackTraceTest
==3468== Memcheck, a memory error detector
==3468== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==3468== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==3468== Command: ./BackTraceTest
==3468==
==3468== error 22 Invalid argument
==3468== error VG_(am_shared_mmap_file_float_valgrind) /tmp/vgdb-pipe-shared-mem-vgdb-3468-by-root-on-???
发表于 2016-12-2 17:32:44 | 显示全部楼层
同楼主问题一样啊
发表于 2017-1-12 16:59:47 | 显示全部楼层
此文有重要参考意义:   http://blog.csdn.net/jiazhen/article/details/50588608
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|易百纳 ( 苏ICP备14036084 )

GMT+8, 2017-4-29 17:37 , Processed in 0.123858 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表