valgrind 在mips平台移植编译+使用总结

58 篇文章 10 订阅
10 篇文章 0 订阅

valgrind 在mips平台移植编译+使用总结

2. 使用问题汇总说明

2.1. 问题1(Segmentation fault)

运行程序直接报“segmentation fault”,分析是valgrind本身运行mips平台的程序时出错导致。

# ./valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./tz_packtoolpro 
==17683== Memcheck, a memory error detector
==17683== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==17683== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==17683== Command: ./tz_packtoolpro
==17683== 
Segmentation fault
#

解决办法:

原来编译OK的版本是3.11,更新到3.13的版本再进行编译,运行就不会出现这个错误了。初步怀疑,valgrind对mips平台的兼容性还是不够。

另外如果使用V3.14以上的版本,编译时则会报另外的错误(opcode)。

2.2. 问题2(at 0x4000FF0: ??? (in /lib/ld-uClibc-0.9.33.so))

解决问题1后,出现以下问题。

# ./valgrind --tool=memcheck --leak-check=full --show-reachable=yes /bin/tz_
tz_ftpserver       tz_log_backup      tz_mgr             tz_upgrade_client
# ./valgrind --tool=memcheck --leak-check=full --show-reachable=yes /bin/getkmsg 
==18639== Memcheck, a memory error detector
==18639== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==18639== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==18639== Command: /bin/getkmsg
==18639== 
==18639== Invalid write of size 4
==18639==    at 0x4000FF0: ??? (in /lib/ld-uClibc-0.9.33.so)
==18639==    by 0x4000F9C: ??? (in /lib/ld-uClibc-0.9.33.so)
==18639==  Address 0x7ee6be0c is on thread 1's stack
==18639==  4 bytes below stack pointer
==18639== 
==18639== Conditional jump or move depends on uninitialised value(s)
==18639==    at 0x4B0E058: ??? (in /lib/libuClibc-0.9.33.so)
==18639==    by 0x4B0A0A0: ??? (in /lib/libuClibc-0.9.33.so)
==18639== 
==18639== Conditional jump or move depends on uninitialised value(s)
==18639==    at 0x4B0DD60: ??? (in /lib/libuClibc-0.9.33.so)
==18639==    by 0x481A0AC: ??? (in /lib/libmdlbase.so)
==18639== 

解决办法

1)需要将链接的库都改为 not stripped,另外最好在编译时增加-g的选项
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值