How to use Valgrind on WP76 to investigate memory leaks

You can try the procedure below on WP76 R13.3:

  1. download the yocto source code
  2. open ./meta-swi/meta-swi-mdm9x28/recipes-core/images/mdm9x28-image.inc and add the following line:

IMAGE_INSTALL_append = " valgrind"

  1. make the yocto image

  2. there will be error to make the yocto.cwe as it is too big. Instead we need to transfer the binary to module’s RAM area

  3. on module, type the following:
    mkdir /tmp/valgrind

  4. on PC:

scp ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/valgrind/3.13.0-r0/image/usr/bin/* root@192.168.2.2:/tmp/valgrind

scp ./build_bin/tmp/work/armv7a-neon-poky-linux-gnueabi/valgrind/3.13.0-r0/image/usr/lib/valgrind/memcheck-arm-linux root@192.168.2.2:/tmp/valgrind

  1. on module, type the following:
    chmod -R 777 /tmp/valgrind
    export VALGRIND_LIB=/tmp/valgrind

  2. run the program by:
    root@swi-mdm9x28-wp:/tmp/valgrind# /tmp/valgrind/valgrind
    valgrind: no program specified
    valgrind: Use --help for more information.