Search code examples
armvalgrindcallgrindkcachegrind

valgrind doesnt work on my 32bit executable in linux ubuntu 16.04


I'm trying to run the valgrind tool on my 32bit executable(sample), I built under the linux Ubuntu host 16.04(64bit), but it failed to run, error: wrong ELF.

sample application is built to run in arm32, cross-compiled in my host linux machine.

This is the command I ran.

valgrind --tool=callgrind ./sample
valgrind: wrong ELF executable class (eg. 32-bit instead of 64-bit)
valgrind: ./sample: cannot execute binary file

I ran memcheck tool but that also failed.

valgrind --tool=memcheck ./updater 
valgrind: wrong ELF executable class (eg. 32-bit instead of 64-bit)
valgrind: ./updater: cannot execute binary file

Then what I did, I exported the valgrind lib path but that didn't help+

$export VALGRIND_LIB="/usr/lib/valgrind"

I jut ls my lib dir, I found entire list and find callgrind and all libs are there.

callgrind-amd64-linux          
callgrind-x86-linux

Don't know what is wrong and how to use valgrind on my executables.

Any help, appreciated.


Solution

  • Valgrind does not support a setup where 'host' (where you run valgrind) differs from 'guest' (the application you run under valgrind.

    So, there is no way to run an arm32 application under Valgrind on an x86/amd64 system.

    You should run this on an arm32 system, with a valgrind compiled for arm32. Alternatively, you can use e.g. an android emulator. See README.android and README.android_emulator in Valgrind distribution for more information