【发布时间】:2022-06-14 00:04:50
【问题描述】:
我已经为嵌入式设备编译了 valgrind,并执行了以下命令来检查泄漏。
./valgrind --leak-check=full --xml=yes --xml-file=<xml file path> <application>
但它给出了以下错误。
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-x86-64.so.2
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-x86-64.so.2
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.
有一个与 valgrind 一起构建的库“ld-2.19.so”,如果我将此库复制到 /lib/(将 /lib/ 下现有的 ld-2.19.so 替换为与 valgrind 一起构建的相同库)然后 valgrind 运行良好。相同的工具链用于为嵌入式设备和 valgrind 构建 rootfs。用与 valgrind 一起构建的库替换现有的“ld-2.19.so”不会影响 valgrind 生成的报告?
【问题讨论】:
-
这到底是什么平台?你应该从一些简单的东西开始(
--tool=none和一个小的可执行文件,如pwd或ls或/bin/echo) -
@PaulFloyd 这是一个英特尔平台(原子处理器)。我已经执行了
./valgrind --tool=none ls,但它给出了错误valgrind: failed to start tool 'none' for platform 'amd64-linux': No such file or directory。 -
@PaulFloyd,如果我们将工具设为无,那么它会给出上述评论中更新的错误。
-
你能告诉你是否有完整的 Valgrind 安装吗?你应该有 [install dir]/libexec/valgrind/none-amd64-linux (对于 AMD64 上的 Linux,对于其他操作系统和硬件会有所不同)
-
我已将所有 valgrind 文件复制到一个路径并在 VALGRIND_LIB 中导出该路径,之后它工作正常。