How To Use Valgrind

Requirements:

General

  • The ARMv7 (Cortex A-5, A-7, A-8, and A-9) and Intel X86/Atom architectures are currently supported by Valgrind

Desktop Factory

  • Select valgrind under Target Software > Software Packages > Development > Debugging and Testing Tools
  • Ensure that Target Configuration > Build RFS > Strip all libraries and binaries in the RFS is not selected.
    • This can notably increase the size of your RFS. If this is a problem, please see the Special Note below.

Operation:

  1. Boot your board, and run valgrind <name of binary> on your target's terminal to use Valgrind.

Special Note:

There is a particular library file on your target that valgrind requires to be unstripped. This file is provided by your c library (glibc or uClibc). For uClibc, the library is located at /lib/ld-uClibc-<uClibc version>.so in your RFS; for glibc, /lib/ld-<glibc version>.so.

By default, your Factory build also produces binary package tarballs for each package you have selected, with no size optimizations applied to the contents of the tarballs. If you explode the uClibc or glibc binary package tarball on top of your stripped RFS, this will provide the proper unstripped library (commands run from Factory build directory):

sudo tar -xvf build_<arch>/packages/<name of c library package>.tgz -C <path of RFS>

For an even finer grain control, just extract ld-*.so from your c library package tarball to your RFS:

sudo tar -xvf build_<arch>/packages/<name of c library package>.tgz -C <path of RFS> --wildcards ./lib/ld-*.so