我已经完成了与此错误相关的答案。但是,我的问题是,一旦我有libc的debuginfo,我应该放置这个库的位置是什么,以便valgrind看到它?
我已经下载了valgrind并为我的目标环境进行了交叉编译。 我尝试了以下所有不同的组合:
最后但并非最不重要的是,以下是实际错误:
==29946== Memcheck, a memory error detector
==29946== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29946== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==29946== Command: /bin/my_prog
==29946==
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: strcmp
valgrind: in an object with soname matching: ld-linux-armhf.so.3
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld-linux-armhf.so.3
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.
答案 0 :(得分:0)
如果目标是glibc,则需要确保没有从动态加载器(@alex-team
)中剥离@alex-team/marketing
。 valgrind需要这些符号才能起作用。
答案 1 :(得分:0)
我遇到了同样的问题,这是我的解决方法:
将ld-xx.so in /lib
路径替换为调试版本。
这是我的情况。我正在使用Yocto来构建rootfs,因此将poky/build/tmp/work/xxxx/glibc/2.26-r0/image/lib/ld-2.26.so
从您的构建路径复制到Linux FS路径/lib
,以替换发行版构建的原始/lib/ld-2.26.so
。
这样做之后,valgrind可以正常工作。
警告:在正在运行的系统上更换装载程序会使其变形!这些步骤有效: