嵌入式查找内存泄露_如何运行Valgrind找出我的嵌入式MIPSEL-linux机器上的内存泄漏?...

bd96500e110b49cbb3cd949968f18be7.png

How can I run valgrind on an embedded Linux box to find memory leaks in my main software?

In the rcS script, I am running like this:

./main_app

How can I associate the ./main_app program with valgrind? The main_app process never terminates.

I want to constantly log the data to file. Also, I want to access the log file without terminating the main_app process. I can do telnet and can access the log file. But the problem is until and unless the handler is closed, how can I open the file i.e. I don't quite understand which valgrind parameters control how memory leaks are logged to file. Please help!

解决方案

You can try to build it by your own for mips, here the steps:

download valgrind from here http://valgrind.org/downloads/ - I used Valgrind 3.8.1

unpack archive with valgrind and move to the valgrinds folder

execute:

./autogen.sh

./configure --host=mipsel-linux-gnu --prefix=/home/pub/valgrind CFLAGS="-mips32r2" CC=/opt/toolchains/mips-4.3/bin/mips-linux-gnu-gcc CXX=/opt/toolchains/mips-4.3/bin/mips-linux-gnu-c++

./make -j6

./make install

prefix - folder to install compiled binaries of valgrind;

CC and CXX - path to compilers;

CFLAGS - "-mips32r2" and "-mplt" flags should be passed to compilers if it older then gcc (GCC) 4.5.1

on target mips box export path to valgrind lib folder:

export VALGRIND_LIB=/mnt/nfs/lib/valgrind

Now you can use it as usual, for memory checking features you can look here http://valgrind.org/docs/manual/mc-manual.html

It works for me, good luck.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值