使用Linaro Toolchain的ARM的Valgrind需要带有Buildroot的libc6-dbg

Phi*_*Bot 7 valgrind arm glibc cross-compiling buildroot

我使用以下命令与我的Ubuntu 10.04主机上的Linaro工具链交叉编译Valgrind(http://valgrind.org/downloads/valgrind-3.8.1.tar.bz2)(我正在使用Buildroot):

export PATH=$PATH:/home/user/toolchain/linaro/bin
CC=arm-linux-gnueabi-gcc CFLAGS=-I/home/user/toolchain/linaro/arm-linux-gnueabi/libc/usr/include LDFLAGS=-L/home/user/toolchain/linaro/arm-linux-gnueabi/libc/usr/lib ./configure --prefix=/opt/valgrind --host=armv7-none-linux-gnueabi --target=arm-none-linux-gnueabi --build=i386-ubuntu-linux
make
sudo make install
Run Code Online (Sandbox Code Playgroud)

当我将二进制文件复制到我的ARM目标板时,我收到以下错误:

==413== Memcheck, a memory error detector
==413== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==413== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==413== Command: /home/user/testApp
==413== 

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:      memcpy
valgrind:  in an object with soname matching:   ld-linux.so.3
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux.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:  Cannot continue -- exiting now.  Sorry.
Run Code Online (Sandbox Code Playgroud)

我的Linaro工具链版本是:

gcc version 4.7.1 20120402 (prerelease) (crosstool-NG linaro-1.13.1-2012.04-20120426 - Linaro GCC 2012.04) 
Run Code Online (Sandbox Code Playgroud)

我在Google上搜索过但无法找到解决方案.我怎样才能让Valgrind在我的目标板上工作?我使用Buildroot来构建我的系统,但libc6-dbg不是我在构建系统中可以找到的包.我需要从工具链sysroot中复制一些目录或文件吗?谢谢 -

我用来运行Valgrind的命令如下所示:

# which valgrind
/usr/bin/valgrind
# valgrind /home/user/MyQtApp
==216== Memcheck, a memory error detector
...
...
Run Code Online (Sandbox Code Playgroud)

小智 5

所以你使用Buildroot或OpenEmbedded来构建你的Libc?

如果是OE,则应该在本地存储库(TMPDIR/deploy/ipk)中提供libc6-dbg软件包.或者将"dbg-pkgs"添加到IMAGE_FEATURES中并重建图像.

Glibc 2.12显示您使用的是旧版OpenEmbedded.但即使这样也应该给你libc6-dbg包.

无法使用Buildroot从未使用它.


小智 5

我一直面临同样的问题,并找到了解决方案。因此,如果有人也遇到这个问题,我是这样解决问题的:Valgrind 无法调试应用程序的原因是 C 库中缺少符号。在使用外部工具链(Linaro)构建 buildroot 时,我们可以在 Linaro 树中找到未剥离的 C 库。在arm-linux-gnueabihf\libc\lib\arm-linux-gnueabihf文件夹中,您将找到未剥离的库。只需将未剥离的文件复制到目标上即可。就是这样。希望这会帮助其他人。