我正在尝试在基于 Debian 的嵌入式 PowerPC 系统上安装 Valgrind。我成功地对其进行了交叉编译,但现在它抱怨找不到调试信息。我已将相关共享对象的未剥离副本放入文件系统,并将此目录告知 Valgrind,但它仍然不起作用。
调用:
[email protected]:/# /root/valgrind/bin/valgrind --extra-debuginfo-path=/root/valgrind/usr/lib/debug /path/to/my_program -log
==6000== Memcheck, a memory error detector
==6000== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6000== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==6000== Command: /path/to/my_program -log
==6000==
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.so.1
valgrind: was not found whilst processing
valgrind: symbols from the object with soname: ld.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: Cannot continue -- exiting now. Sorry.
有问题的文件ld.so.1
位于/lib
,而我的未剥离副本位于单独的目录中:
[email protected]:/# find / -name ld.so.1
/lib/ld.so.1
/root/valgrind/usr/lib/debug/ld.so.1
/root/valgrind/usr/lib/debug/lib/ld.so.1
我的未剥离副本libc6-dbg_2.7-10ubuntu3_powerpc.deb
似乎兼容:
[email protected]:/# file /lib/ld.so.1 /root/valgrind/usr/lib/debug/ld.so.1 /root/valgrind/usr/lib/debug/lib/ld.so.1
/lib/ld.so.1: symbolic link to `ld-2.7.so'
/root/valgrind/usr/lib/debug/ld.so.1: symbolic link to `ld-2.7.so'
/root/valgrind/usr/lib/debug/lib/ld.so.1: symbolic link to `ld-2.7.so'
[email protected]:/# file /lib/ld-2.7.so /root/valgrind/usr/lib/debug/ld-2.7.so /root/valgrind/usr/lib/debug/lib/ld-2.7.so
/lib/ld-2.7.so: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, with unknown capability 0x41000000 = 0x11676e75, with unknown capability 0x10000 = 0x90401, stripped
/root/valgrind/usr/lib/debug/ld-2.7.so: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), dynamically linked, not stripped
/root/valgrind/usr/lib/debug/lib/ld-2.7.so: ELF 32-bit MSB shared object, PowerPC or cisco 4500, version 1 (SYSV), statically linked, not stripped
如果我理解它objdump
的工作原理,那么 Valgrind 提到的“必须重定向的函数”似乎确实在调试副本中有一个条目:
[email protected]:/# objdump -x /lib/ld-2.7.so | grep strlen
[email protected]:/# objdump -x /root/valgrind/usr/lib/debug/lib/ld-2.7.so | grep strlen
0002f734 l O .data.rel.ro 00000004 max_capstrlen
00018ff0 l F .text 000000b8 strlen
但这个--extra-debuginfo-path
论点没有起到作用。手动的,但这几乎就是我能找到的所有信息了。我还遗漏了什么吗?
需要说明的是,这台机器无法连接到互联网,因此很遗憾无法让apt
/来处理这些事情。而且大多数其他系统目录也是以只读方式安装的,因此我不能直接放入一个未剥离的替代品(我不会冒这样的风险)。dpkg
/lib
ld-2.7.so
答案1
我遇到了类似的问题,--allow-mismatched-debuginfo=yes
向 valgrind 添加参数解决了该问题。