Mipsel平台valgrind使用,内存泄漏检测不出来!!!

cyg19860205 2017-12-09 04:09:40
版本 valgrind3.13.0
mipsel 32 位 小端模式
Ubuntu 16.04 虚拟机 64位
交叉编译工具链 /opt/toolchain-3.4.x/bin/mipsel-linux-uclibc-

交叉编译步骤:
1、./autogen.sh
2、./configure --host=mipsel-linux-gnu CFLAGS="-mips32r2" CC=/opt/toolchain-3.4.x/bin/mipsel-linux-uclibc-gcc CXX=/opt/toolchain-3.4.x/bin/mipsel-linux-uclibc-c++ --program-prefix=mipsel-linux-uclibc- --prefix=/opt/home/valgrind
3、make
4、make install

将/opt/home/valgrind目录全部移到开发板/opt/home/下

测试程序:
编写测试程序malloc(128),不释放退出。

在PC上用valgrind测试运行,结果显示有128字节的泄漏

用/opt/toolchain-3.4.x/bin/mipsel-linux-uclibc-gcc编译测试程序,在开发板上用mipsel-linux-uclibc-valgrind运行程序,显示
==1054== Memcheck, a memory error detector
==1054== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1054== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1054== Command: ./main1
==1054== Parent PID: 968
==1054==
==1054== Invalid write of size 4
==1054== at 0x4000FC0: _start (in /lib/ld-uClibc-0.9.33.2.so)
==1054== by 0x4000F6C: _start (in /lib/ld-uClibc-0.9.33.2.so)
==1054== Address 0x7eeaecdc is on thread 1's stack
==1054== 4 bytes below stack pointer
==1054==
==1054==
==1054== HEAP SUMMARY:
==1054== in use at exit: 0 bytes in 0 blocks
==1054== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==1054==
==1054== All heap blocks were freed -- no leaks are possible
==1054==
==1054== For counts of detected and suppressed errors, rerun with: -v
==1054== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

128字节内存泄漏显示不出来,只是显示内存写错误。

...全文
868 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hb19860307 2018-01-15
  • 打赏
  • 举报
回复
是否是正常退出,正常退出检测的结果是正确的,自己编写内存泄露代码用来保证工具能够正常检测出来。 用交叉编译工具编译测试一下能够检测出内存泄露。

21,597

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧