valgrind运行错误:Assertion tres.status == VexTransOK failed

问题

完成代码编写之后,打算在服务器使用valgrind测一下是否存在内存泄露。结果刚一运行就结束了,记得应该特别慢才对的啊。赶紧打开保存的log看一下,发现有如下的错误:

valgrind: m_translate.c:1682 (vgPlain_translate): Assertion 'tres.status == VexTransOK' failed

把这个问题搜了一下,发现也有人遇到过这个问题,但是还没有答案解释具体原因和解决方法。

查看了一下使用的valgrind版本:

$ valgrind --version
valgrind-3.10.1

想了一下是不是版本太低导致的问题。打算升级一下版本。

解决

下载新版本

$wget https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2

解压

$tar -jxvf valgrind-3.15.0.tar.bz2

安装


                
==1635== Memcheck, a memory error detector ==1635== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==1635== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info ==1635== Command: ./bin/ft_app_diagnose.out ==1635== valgrind: Fatal error at startup: a function redirection valgrind: which is mandatory for this platform-tool combination valgrind: cannot be set up. Details of the redirection are: valgrind: valgrind: A must-be-redirected function valgrind: whose name matches the pattern: strlen valgrind: in an object with soname matching: ld-linux-aarch64.so.1 valgrind: was not found whilst processing valgrind: symbols from the object with soname: ld-linux-aarch64.so.1 valgrind: valgrind: Possible fixes: (1, short term): install glibc's debuginfo valgrind: package on this machine. (2, longer term): ask the packagers valgrind: for your Linux distribution to please in future ship a non- valgrind: stripped ld.so (or whatever the dynamic linker .so is called) valgrind: that exports the above-named function using the standard valgrind: calling conventions for this platform. The package you need valgrind: to install for fix (1) is called valgrind: valgrind: On Debian, Ubuntu: libc6-dbg valgrind: On SuSE, openSuSE, Fedora, RHEL: glibc-debuginfo valgrind: valgrind: Note that if you are debugging a 32 bit process on a valgrind: 64 bit system, you will need a corresponding 32 bit debuginfo valgrind: package (e.g. libc6-dbg:i386). valgrind: valgrind: Cannot continue -- exiting now. Sorry.是什么报错
最新发布
11-15
### 原因 - **缺少调试信息**:`ld-linux-aarch64.so.1` 是动态链接器,Valgrind 需要该库的调试信息来进行函数重定向。如果系统中没有安装相应的调试信息包,Valgrind 就无法找到 `strlen` 函数的符号,从而导致重定向失败。 - **库文件不完整或损坏**:`ld-linux-aarch64.so.1` 库文件本身可能不完整或已损坏,这会影响 Valgrind 对其符号的解析。 - **Valgrind 版本与系统不兼容**:使用的 Valgrind 版本可能与当前系统的 `ld-linux-aarch64.so.1` 库不兼容,导致无法正确进行函数重定向。 - **系统环境问题**:系统环境变量的设置可能影响了 Valgrind 对库文件的查找和加载,使得 Valgrind 无法正确访问 `ld-linux-aarch64.so.1` 库。 ### 解决办法 - **安装调试信息包**:根据系统类型安装相应的调试信息包。在 Debian、Ubuntu 系统中,使用以下命令安装: ```bash sudo apt-get install libc6-dbg ``` 在 SuSE、openSuSE、Fedora、RHEL 系统中,使用以下命令安装: ```bash sudo yum install glibc-debuginfo ``` - **检查并修复库文件**:使用 `ldd` 命令检查应用程序依赖的库文件是否完整和正确。如果发现 `ld-linux-aarch64.so.1` 库文件有问题,可以尝试重新安装系统的 C 库。例如,在 Ubuntu 系统中,可以使用以下命令: ```bash sudo apt-get install --reinstall libc6 ``` - **更新或降级 Valgrind 版本**:尝试更新到最新版本的 Valgrind,或者降级到已知与系统兼容的版本。可以从 Valgrind 官方网站下载源代码,然后编译安装: ```bash tar -jxvf valgrind-x.x.x.tar.bz2 cd valgrind-x.x.x ./configure make sudo make install ``` - **检查系统环境变量**:确保 `LD_LIBRARY_PATH` 等环境变量没有被错误设置,避免影响 Valgrind 对库文件的查找和加载。可以使用以下命令查看环境变量: ```bash echo $LD_LIBRARY_PATH ``` 如果需要修改环境变量,可以编辑 `~/.bashrc` 或 `/etc/environment` 文件。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值