This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728 平台使用valgrind工具失败

Other Parts Discussed in Thread: AM5728

sdk5.0.2

在am5728的开发板上运行valgrind:

valgrind -v --log-file=log --tool=memcheck --leak-check=full --show-mismatched--free=yes ./v_test

没有什么结果,提示object doesn's have a symbol table,但是编译已经加了 -g -O选项

  • ==683== Memcheck, a memory error detector
    ==683== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==683== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==683== Command: ./v_test
    ==683== Parent PID: 640
    ==683==
    --683--
    --683-- Valgrind options:
    --683-- -v
    --683-- --log-file=valgrind.log
    --683-- --tool=memcheck
    --683-- --leak-check=full
    --683-- --show-mismatched-frees=yes
    --683-- Contents of /proc/version:
    --683-- Linux version 4.14.79-gb1adb45-dirty (ljc@ubuntu) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #9 SMP PREEMPT Thu Jul 11 15:50:36 CST 2019
    --683--
    --683-- Arch and hwcaps: ARM, LittleEndian, ARMv7-neon-vfp
    --683-- Page sizes: currently 4096, max supported 4096
    --683-- Valgrind library directory: /usr/lib
    --683-- Reading syms from /home/root/v_test
    --683-- Reading syms from /lib/ld-2.25.so
    --683-- Considering /lib/ld-2.25.so ..
    --683-- .. CRC mismatch (computed e3711ca5 wanted 2f1e9f06)
    --683-- object doesn't have a symbol table
    --683-- Reading EXIDX entries: 30 available
    ==683== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
    ==683== Warning: whilst reading EXIDX: ExtabEntryDecode: failed with error code: -10
    --683-- Reading EXIDX entries: 20 attempted, 18 successful

    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.
  • 完整log如上,这个怎么解决?
  • 编译的要debug版本,加 -g就可以

  • Debug 的编译选项必须包含 -O0 和 -g 或者 -ggdb 选项
  • 系统也要debug版本吗?我的测试程序加了-g
  • 我用的编译命令g++ -g -O0 -o v_test main.cpp
  • 这个程序有在别的平台上测试过吗
  • 没有,但是程序是一个明显的内存泄漏的例子。
  • 同样的程序我在Ubuntu上的gcc编译出来可以用valgrind分析,但是在嵌入式板子上用sdk里面valgrind分析sdk gcc里面编译出来的就不行,难受啊
  • 查了很多资料说需要debug版本的libc6-dbg,我怎么获取TI 的libc6-dbg这个库呢,在sdk里面没搜到这个文件
  • 这个是个标准库应该不一定官方的也可以吧
  • 你好,我在使用valgrind时 也遇到了这个问题,使用这个 tisdk-rootfs-image-am57xx-evm.tar.xz 文件系统不会有这个问题,使用arago-base-tisdk-image-am57xx-evm.tar.xz 这个文件系统提示需要安装libc6-dbg,我尝试在前者中 使用 opkg files libc6-dbg 命令 查找包含哪些文件,但是找不到。你解决了吗